-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock.h
More file actions
25 lines (19 loc) · 742 Bytes
/
block.h
File metadata and controls
25 lines (19 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef BLOCK_H
#define BLOCK_H
#include "types.h"
typedef struct block_device block_device_t;
typedef uint32_t (*block_read_t)(block_device_t* dev, uint32_t lba, uint32_t count, uint8_t* buffer);
typedef uint32_t (*block_write_t)(block_device_t* dev, uint32_t lba, uint32_t count, const uint8_t* buffer);
struct block_device {
uint32_t id;
uint32_t block_size;
uint32_t block_count;
block_read_t read;
block_write_t write;
void* impl;
};
int block_register(block_device_t* dev);
block_device_t* block_get(uint32_t id);
uint32_t block_read(block_device_t* dev, uint32_t lba, uint32_t count, uint8_t* buffer);
uint32_t block_write(block_device_t* dev, uint32_t lba, uint32_t count, const uint8_t* buffer);
#endif