slab: replace struct slab with slab_t
This type should never be modified by the user, and only passed into the functions in slab.c. Using a typedef to notifies the user semantically of this fact
This commit is contained in:
parent
0395b65ad8
commit
29a0435cf6
13 changed files with 196 additions and 46 deletions
|
|
@ -12,6 +12,13 @@ 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;
|
||||
|
|
@ -21,14 +28,15 @@ struct block_device {
|
|||
size_t block_count;
|
||||
size_t block_size;
|
||||
|
||||
struct gpt_header *gpt_header;
|
||||
struct gpt_entry *gpt_entries;
|
||||
size_t gpt_entries_count;
|
||||
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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue