|
miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
|
#include <miniOS/io.h>#include <miniOS/drivers/block_layer.h>#include <miniOS/drivers/ata.h>#include <miniOS/mm/pmm.h>#include <miniOS/mm/vmm.h>#include <miniOS/mm/heap.h>#include <miniOS/arch/x86_64/spinlock.h>#include <string.h>
Classes | |
| struct | cache_entry_t |
| struct | block_cache_t |
Macros | |
| #define | BLOCK_SIZE 512 |
| #define | CACHE_SIZE_BLOCKS 64 |
Functions | |
| static cache_entry_t * | block_cache_lookup_locked (uint64_t lba) |
| static cache_entry_t * | block_cache_evict_locked (void) |
| void | block_layer_init (void) |
| Called once during kernel startup to allocate memory for the cache and prepare the block layer for use. | |
| 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. | |
Variables | |
| static block_cache_t | g_block_cache |
| static spinlock_t | g_cache_lock |
| #define BLOCK_SIZE 512 |
| #define CACHE_SIZE_BLOCKS 64 |
|
static |

|
static |

|
static |
|
static |