feat: implemented errno, strtol. Started ustar. Reformatted headers and
code. Added some self-tests. Started prepwork for vfs.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#ifndef NEW_KERNEL_BLOCKDEV_H
|
||||
#define NEW_KERNEL_BLOCKDEV_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
#include <myke/driver.h>
|
||||
|
||||
@@ -24,18 +25,19 @@
|
||||
#define BLOCK_DEV_REGISTER_FULL 1
|
||||
|
||||
|
||||
typedef struct block_device block_device;
|
||||
typedef struct block_device block_device_t;
|
||||
|
||||
typedef uint8_t (*block_device_driver_check_device)(const block_device *device, uint8_t *first_sector);
|
||||
typedef uint8_t (*block_device_driver_check_device)(const block_device_t *device, uint8_t *first_sector);
|
||||
|
||||
typedef uint8_t (*block_device_driver_free)(const block_device *device);
|
||||
typedef uint8_t (*block_device_driver_free)(const block_device_t *device);
|
||||
|
||||
typedef uint8_t (*block_device_access)(const block_device *device, uint8_t direction, uint32_t lba, uint8_t sectors, void *target);
|
||||
typedef uint8_t (*block_device_access)(const block_device_t *device, uint8_t direction, uint32_t lba, uint8_t sectors,
|
||||
void *target);
|
||||
|
||||
struct block_dev_driver {
|
||||
char name[16];
|
||||
struct {
|
||||
uint8_t root_only: 1;
|
||||
uint8_t partitioning: 1;
|
||||
} flags;
|
||||
block_device_driver_check_device check_device;
|
||||
block_device_driver_free free_device;
|
||||
@@ -43,7 +45,7 @@ struct block_dev_driver {
|
||||
|
||||
#define BLOCK_DEV_DRIVER(order) GENERIC_DRIVER(block_dev_driver, order)
|
||||
|
||||
typedef struct block_device {
|
||||
struct block_device {
|
||||
struct {
|
||||
uint8_t present: 1;
|
||||
uint8_t scanned: 1;
|
||||
@@ -58,14 +60,16 @@ typedef struct block_device {
|
||||
struct block_dev_driver *driver;
|
||||
void *device_info; // pointer to driver defined structure
|
||||
// todo device info
|
||||
} block_device;
|
||||
};
|
||||
|
||||
uint8_t block_dev_register(block_device *device);
|
||||
uint8_t block_dev_register(block_device_t *device);
|
||||
|
||||
void block_dev_free(block_device *device);
|
||||
void block_dev_free(block_device_t *device);
|
||||
|
||||
void block_dev_start_task();
|
||||
|
||||
void block_dev_print_info();
|
||||
|
||||
bool block_dev_mount(char *identifier, char *driver);
|
||||
|
||||
#endif //NEW_KERNEL_BLOCKDEV_H
|
||||
|
||||
Reference in New Issue
Block a user