feat: Vfs and Ext2 support. Code style/attribute improvements
Added VFS and Ext2 support. Optimized attributes of methods to improve code highlighting. Printf attribute, malloc attribute, etc.
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <myke/driver.h>
|
||||
|
||||
#define BLOCK_DEV_LBA_SIZE 512
|
||||
|
||||
#define BLOCK_DEV_ACCESS_OK 0
|
||||
#define BLOCK_DEV_ACCESS_ERR 1
|
||||
|
||||
@@ -27,21 +29,21 @@
|
||||
|
||||
typedef struct block_device block_device_t;
|
||||
|
||||
typedef uint8_t (*block_device_driver_check_device)(const block_device_t *device, uint8_t *first_sector);
|
||||
typedef uint8_t (*block_device_driver_check_device)(block_device_t *device);
|
||||
|
||||
typedef uint8_t (*block_device_driver_free)(const block_device_t *device);
|
||||
typedef uint8_t (*block_device_driver_free)(block_device_t *device);
|
||||
|
||||
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 {
|
||||
typedef struct block_dev_driver {
|
||||
char name[16];
|
||||
struct {
|
||||
uint8_t partitioning: 1;
|
||||
} flags;
|
||||
block_device_driver_check_device check_device;
|
||||
block_device_driver_free free_device;
|
||||
} __attribute__((__aligned__(STRUCT_ALIGNMENT)));
|
||||
} __attribute__((__aligned__(STRUCT_ALIGNMENT))) block_dev_driver_t;
|
||||
|
||||
#define BLOCK_DEV_DRIVER(order) GENERIC_DRIVER(block_dev_driver, order)
|
||||
|
||||
@@ -59,6 +61,7 @@ struct block_device {
|
||||
block_device_access access;
|
||||
struct block_dev_driver *driver;
|
||||
void *device_info; // pointer to driver defined structure
|
||||
void *driver_info; // pointer to driver defined structure
|
||||
// todo device info
|
||||
};
|
||||
|
||||
@@ -66,8 +69,8 @@ uint8_t block_dev_register(block_device_t *device);
|
||||
|
||||
void block_dev_free(block_device_t *device);
|
||||
|
||||
void *block_dev_mount(const char *device, const char *driver_name);
|
||||
|
||||
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