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:
parent
db5990cc97
commit
21e2540243
6 changed files with 25 additions and 190 deletions
15
fs/block.c
15
fs/block.c
|
|
@ -21,6 +21,7 @@ struct block_device *block_register(char *name, struct block_device_ops *ops, vo
|
|||
bdev->data = data;
|
||||
bdev->block_count = block_count;
|
||||
bdev->block_size = block_size;
|
||||
bdev->lba_start = 0;
|
||||
memcpy(&bdev->ops, ops, sizeof(struct block_device_ops));
|
||||
|
||||
block_gpt_init(bdev);
|
||||
|
|
@ -37,20 +38,10 @@ struct block_device *block_register(char *name, struct block_device_ops *ops, vo
|
|||
|
||||
inline int block_read(struct block_device *bdev, void *buf, size_t offset, size_t size)
|
||||
{
|
||||
return bdev->ops.read(bdev, buf, offset, size);
|
||||
}
|
||||
|
||||
inline int block_readp(struct block_part *part, void *buf, size_t offset, size_t size)
|
||||
{
|
||||
return part->bdev->ops.read(part->bdev, buf, part->lba_start + offset, size);
|
||||
return bdev->ops.read(bdev, buf, offset + bdev->lba_start, size);
|
||||
}
|
||||
|
||||
inline int block_write(struct block_device *bdev, void *buf, size_t offset, size_t size)
|
||||
{
|
||||
return bdev->ops.write(bdev, buf, offset, size);
|
||||
}
|
||||
|
||||
inline int block_writep(struct block_part *part, void *buf, size_t offset, size_t size)
|
||||
{
|
||||
return part->bdev->ops.write(part->bdev, buf, part->lba_start + offset, size);
|
||||
return bdev->ops.write(bdev, buf, offset + bdev->lba_start, size);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue