1 #ifndef __LUNAIX_BLOCK_H
2 #define __LUNAIX_BLOCK_H
4 #include <hal/ahci/hba.h>
5 #include <lunaix/blkio.h>
6 #include <lunaix/device.h>
8 #define LPT_SIG 0x414e554c
9 #define PARTITION_NAME_SIZE 48
10 #define DEV_ID_SIZE 32
16 int (*block_read)(struct block_dev*, void*, u64_t, size_t);
17 int (*block_write)(struct block_dev*, void*, u64_t, size_t);
18 void* (*block_alloc)(struct block_dev*);
19 void (*block_free)(struct block_dev*, void*);
24 struct llist_header parts;
25 struct blkio_context* blkio;
27 char bdev_id[DEV_ID_SIZE];
28 char name[PARTITION_NAME_SIZE];
33 struct block_dev_ops ops;
34 struct devclass* class;
37 // Lunaix Partition Table
45 } __attribute__((packed));
47 typedef u64_t partition_t;
49 typedef void (*devfs_exporter)(struct block_dev* bdev, void* fsnode);
51 static inline struct block_dev*
52 block_dev(struct device* dev)
54 return (struct block_dev*)dev->underlay;
61 block_alloc_dev(const char* blk_id, void* driver, req_handler ioreq_handler);
64 block_mount(struct block_dev* bdev, devfs_exporter export);
70 blk_set_blkmapping(struct block_dev* bdev, void* fsnode);
73 blk_mount_part(struct block_dev* bdev,
79 #endif /* __LUNAIX_BLOCK_H */