miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
block_device.c File Reference
#include <miniOS/drivers/block_device.h>
#include <miniOS/io.h>
#include <string.h>
Include dependency graph for block_device.c:

Functions

void blkdev_init (void)
int blkdev_register (const char *name, uint8_t major, uint8_t minor, uint64_t lba_start, uint64_t lba_end, bool is_partition)
const block_device_tblkdev_find (uint8_t major, uint8_t minor)
const block_device_tblkdev_get (int index)
int blkdev_count (void)

Variables

static block_device_t g_devices [BLKDEV_MAX]
static int g_count

Function Documentation

◆ blkdev_count()

int blkdev_count ( void )

blkdev_count() - Return the number of registered block devices.

◆ blkdev_find()

const block_device_t * blkdev_find ( uint8_t major,
uint8_t minor )

blkdev_find() - Look up a block device by major and minor number. @major: Device major number. @minor: Device minor number.

Returns
: Pointer to the registry entry, or NULL if not found.
Here is the caller graph for this function:

◆ blkdev_get()

const block_device_t * blkdev_get ( int index)

blkdev_get() - Get a block device by index. @index: Zero-based index into the registry.

Returns
: Pointer to the entry, or NULL if @index is out of range.

◆ blkdev_init()

void blkdev_init ( void )

blkdev_init() - Clear the block device registry. Called once during kernel startup before any blkdev_register() calls.

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

◆ blkdev_register()

int blkdev_register ( const char * name,
uint8_t major,
uint8_t minor,
uint64_t lba_start,
uint64_t lba_end,
bool is_partition )
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_count

int g_count
static

◆ g_devices

block_device_t g_devices[BLKDEV_MAX]
static