miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
Block Layer

A simple, cached block layer that abstracts the underlying ATA driver. More...

Functions

int block_read (uint64_t lba, uint16_t count, void *buf)
 Reads count blocks starting at lba into buf. If count is 1, this operation will be serviced by the cache. Multi-block reads currently bypass the cache and read directly from the disk.
int block_write (uint64_t lba, uint16_t count, const void *buf)
 Writes count blocks starting at lba. This is a write-through operation. The data is written to the underlying disk, and if a cached copy of the block exists, it is updated.
void block_layer_init (void)
 Called once during kernel startup to allocate memory for the cache and prepare the block layer for use.

Detailed Description

A simple, cached block layer that abstracts the underlying ATA driver.

Provides a block-oriented read/write interface with a write-through cache. Currently only supports single-block operations when caching is active.

Function Documentation

◆ block_layer_init()

void block_layer_init ( void )

Called once during kernel startup to allocate memory for the cache and prepare the block layer for use.

block_layer_init() - Initializes the block layer and its cache.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ block_read()

int block_read ( uint64_t lba,
uint16_t count,
void * buf )

Reads count blocks starting at lba into buf. If count is 1, this operation will be serviced by the cache. Multi-block reads currently bypass the cache and read directly from the disk.

block_read() - Read one or more blocks from the block device. @lba: The logical block address to start reading from. @count: The number of blocks to read. @buf: A buffer large enough to hold count blocks.

Returns
0 on success, negative error code on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ block_write()

int block_write ( uint64_t lba,
uint16_t count,
const void * buf )

Writes count blocks starting at lba. This is a write-through operation. The data is written to the underlying disk, and if a cached copy of the block exists, it is updated.

block_write() - Write one or more blocks to the block device. @lba: The logical block address to start writing to. @count: The number of blocks to write. @buf: A buffer containing the data to write.

Returns
0 on success, negative error code on failure.
Here is the call graph for this function:
Here is the caller graph for this function: