|
ginnOS
The reference: libc, the libraries and the kernel
|
#include "block_device.h"Functions | |
| bool | block_device_read (block_device_t *device, uint32_t startBlock, uint8_t blockCount, void *dest) |
| read blocks from a block device. | |
| bool | block_device_write (block_device_t *device, uint32_t startBlock, uint8_t blockCount, const void *src) |
| write blocks to a block device. | |
| bool | block_device_flush (block_device_t *device) |
| flush any cached writes to the underlying media. | |
| bool | block_device_trim (block_device_t *device, uint32_t startBlock, uint32_t blockCount) |
| hint that a range of blocks is no longer in use (TRIM/discard). | |
| bool block_device_read | ( | block_device_t * | device, |
| uint32_t | startBlock, | ||
| uint8_t | blockCount, | ||
| void * | dest ) |
read blocks from a block device.
| device | initialized block device backend. |
| startBlock | starting block number to read from. |
| blockCount | number of blocks to read. |
| dest | destination buffer to store the read data. |
| bool block_device_write | ( | block_device_t * | device, |
| uint32_t | startBlock, | ||
| uint8_t | blockCount, | ||
| const void * | src ) |
write blocks to a block device.
| device | initialized block device backend. |
| startBlock | starting block number to write to. |
| blockCount | number of blocks to write. |
| src | source buffer containing the data to write. |
| bool block_device_flush | ( | block_device_t * | device | ) |
flush any cached writes to the underlying media.
devices without a write-back cache leave the flush op NULL, this wrapper treats that as a successful no-op so callers can flush unconditionally.
| device | initialized block device backend. |
| bool block_device_trim | ( | block_device_t * | device, |
| uint32_t | startBlock, | ||
| uint32_t | blockCount ) |
hint that a range of blocks is no longer in use (TRIM/discard).
this is only an optimization for SSDs and virtual disks, devices that do not support it leave the trim op NULL and this wrapper is a no-op success.
| device | initialized block device backend. |
| startBlock | first block in the range. |
| blockCount | number of blocks in the range. |