BeRTOS
|
Go to the source code of this file.
Data Structures | |
struct | KBlock |
KBlock: interface for a generic block device. More... | |
Defines | |
#define | KB_BUFFERED BV(0) |
Internal flag: true if the KBlock has a buffer. | |
#define | KB_CACHE_DIRTY BV(1) |
Internal flag: true if the cache is dirty. | |
#define | KB_PARTIAL_WRITE BV(2) |
Internal flag: true if the device allows partial block write. | |
Typedefs | |
typedef uint32_t | block_idx_t |
Type for addressing blocks in the device. | |
Prototypes for KBlock low level access functions. | |
When writing a driver implementing the KBlock interface you can choose which function subset to implement, but you have to set to NULL unimplemented features. | |
typedef size_t(* | kblock_read_direct_t )(struct KBlock *b, block_idx_t index, void *buf, size_t offset, size_t size) |
typedef size_t(* | kblock_write_direct_t )(struct KBlock *b, block_idx_t index, const void *buf, size_t offset, size_t size) |
typedef size_t(* | kblock_read_t )(struct KBlock *b, void *buf, size_t offset, size_t size) |
typedef size_t(* | kblock_write_t )(struct KBlock *b, const void *buf, size_t offset, size_t size) |
typedef int(* | kblock_load_t )(struct KBlock *b, block_idx_t index) |
typedef int(* | kblock_store_t )(struct KBlock *b, block_idx_t index) |
typedef int(* | kblock_error_t )(struct KBlock *b) |
typedef void(* | kblock_clearerr_t )(struct KBlock *b) |
typedef int(* | kblock_close_t )(struct KBlock *b) |
Functions | |
int | kblock_trim (struct KBlock *b, block_idx_t start, block_idx_t count) |
Use a subset of the blocks on the device. | |
int | kblock_error (struct KBlock *b) |
Get the current errors for the device. | |
void | kblock_clearerr (struct KBlock *b) |
Clear the errors of the device. | |
int | kblock_flush (struct KBlock *b) |
Flush the cache (if any) to the device. | |
int | kblock_close (struct KBlock *b) |
Close the device. | |
bool | kblock_buffered (struct KBlock *b) |
block_idx_t | kblock_cachedBlock (struct KBlock *b) |
bool | kblock_cacheDirty (struct KBlock *b) |
Return the status of the internal cache. | |
bool | kblock_partialWrite (struct KBlock *b) |
size_t | kblock_read (struct KBlock *b, block_idx_t idx, void *buf, size_t offset, size_t size) |
Read data from the block device. | |
size_t | kblock_write (struct KBlock *b, block_idx_t idx, const void *buf, size_t offset, size_t size) |
Write data to the block device. | |
int | kblock_copy (struct KBlock *b, block_idx_t src, block_idx_t dest) |
Copy one block to another. |
Definition in file kblock.h.