My Project
Loading...
Searching...
No Matches
block.h
Go to the documentation of this file.
1// kernel/drivers/blk/block.h
2#ifndef X86_KERNEL_DRIVER_BLK_BLOCK_H
3#define X86_KERNEL_DRIVER_BLK_BLOCK_H
4
5// Standard headers, required.
6#include <stddef.h>
7#include <stdbool.h>
8#include <stdint.h>
9#include "../../mtstatus.h"
10
11typedef struct _BLOCK_DEVICE {
13 uint32_t lba,
14 void* buf,
15 size_t bytes);
17 uint32_t lba,
18 const void* buf,
19 size_t bytes);
20 void* dev_data;
22
23/* Register a block device so `get_block_device()` can find it */
25
26/* Get the "n" registered device (0, 1, ...), or NULL if out of range. */
28
29#endif // X86_KERNEL_DRIVER_BLK_BLOCK_H
struct _BLOCK_DEVICE BLOCK_DEVICE
void register_block_device(BLOCK_DEVICE *dev)
Definition block.c:17
BLOCK_DEVICE * get_block_device(int index)
Definition block.c:32
int32_t MTSTATUS
Definition mtstatus.h:12
void * dev_data
Definition block.h:20
MTSTATUS(* read_sector)(struct _BLOCK_DEVICE *dev, uint32_t lba, void *buf, size_t bytes)
Definition block.h:12
MTSTATUS(* write_sector)(struct _BLOCK_DEVICE *dev, uint32_t lba, const void *buf, size_t bytes)
Definition block.h:16