block: replace block_part with independent block devices

this also removes the fat32 support for now, as the virtual filesystem
needs more work
This commit is contained in:
Michael Shaw 2023-05-27 17:32:39 -04:00
commit 21e2540243
6 changed files with 25 additions and 190 deletions

View file

@ -12,13 +12,6 @@ struct block_device_ops {
int (*write)(struct block_device *bdev, void *buf, size_t offset, size_t size);
};
struct block_part {
char *name;
struct block_device *bdev;
size_t lba_start;
size_t num_blocks;
};
struct block_device {
char *name;
struct block_device_ops ops;
@ -27,16 +20,14 @@ struct block_device {
size_t block_count;
size_t block_size;
size_t lba_start;
struct block_part *partitions;
size_t partition_count;
};
struct block_device *block_register(char *name, struct block_device_ops *ops, void *data, size_t block_count, size_t block_size);
int block_read(struct block_device *bdev, void *buf, size_t offset, size_t size);
int block_readp(struct block_part *part, void *buf, size_t offset, size_t size);
int block_write(struct block_device *bdev, void *buf, size_t offset, size_t size);
int block_writep(struct block_part *part, void *buf, size_t offset, size_t size);
extern struct block_device *block_devices[];
extern size_t block_devices_count;