diff options
Diffstat (limited to 'src/block')
| -rw-r--r-- | src/block/block.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/block/block.c b/src/block/block.c new file mode 100644 index 0000000..d4758f5 --- /dev/null +++ b/src/block/block.c @@ -0,0 +1,44 @@ +#include <toxic/config.h> +#include <toxic/string.h> +#include <block/block.h> +#include <ata/ata.h> + +/* + * Only primary ATA disk is supported by now, just + * hardcode it here. + */ +struct bdev hda; + +/* Init block layer */ +void +block_init() +{ + memset(&hda, 0, sizeof(struct bdev)); + hda.id = TOXIC_HDA_0; + hda.sector_size = SECTOR_SIZE; +} + +struct bdev * +bdev_get(int id) +{ + /* Just a single bdev is supported */ + if (id) + return NULL; + + return &hda; +} + +/* Read len bytes from bdev starting at addr into buf*/ +int +bread( + struct bdev *bdev, + unsigned int addr, + unsigned int len, + void *buf) +{ + /* + * XXX: This should be a function call into the disk driver. + * i.e. bdev->read(), or something like that + */ + return ata_read_sector(addr, len, buf); +} |
