miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
block_device.h File Reference
#include <miniOS/types.h>
Include dependency graph for block_device.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  block_device_t

Macros

#define BLKDEV_MAX   16
#define BLKDEV_MAJOR_SATA   8 /* SCSI/ATA disk major, matching Linux convention */

Functions

void blkdev_init (void)
: Short device name ("sda", "sda1", ...). Must be < 16 chars.

blkdev_register() - Add a block device to the registry.

@major: Device major number. @minor: Device minor number. @lba_start: First LBA of the device's data region. @lba_end: Last LBA inclusive (both 0 if not a partition). @is_partition: True if this entry represents a partition.

Returns
: 0 on success, -1 if the registry is full.
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)

Macro Definition Documentation

◆ BLKDEV_MAJOR_SATA

#define BLKDEV_MAJOR_SATA   8 /* SCSI/ATA disk major, matching Linux convention */

◆ BLKDEV_MAX

#define BLKDEV_MAX   16

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: