Retro Rocket Kernel
BASIC-Powered Operating System
storage_device_t Struct Reference

Represents a block storage device e.g. a hard disk, DVD-ROM drive, etc. More...

#include <filesystem.h>

+ Collaboration diagram for storage_device_t:

Data Fields

char name [16]
 Storage device name, e.g. 'hd0'. You should use make_unique_device_name() to fill this field. More...
 
uint64_t size
 Total extent of storage device if known, otherwise this value should be SIZE_MAX. More...
 
block_read blockread
 Function pointer for blockread() Block reads are always expected to be in increments of block_size. More...
 
block_write blockwrite
 Function pointer for blockwrite() Block writes are always expected to be in increments of block_size. More...
 
uint32_t block_size
 The block size read and write operations. This is usually a sector size on disk drives. More...
 
uint64_t opaque1
 An opaque integer value which can be given meaning by the storage device driver. More...
 
void * opaque2
 An opaque pointer value which can be given meaning by the storage device driver. More...
 
struct storage_device_tnext
 Pointer to next storage device, or NULL. More...
 

Detailed Description

Represents a block storage device e.g. a hard disk, DVD-ROM drive, etc.

A block storage device is expected to provide at least one endpoint for a readonly storage device like a ROM or CD, which is blockread(). Reads and writes are always performed in block_size chunks, and any buffers used for requests are expected to be a clean modulus of this block size.

Writeable filesystems should also implement blockwrite().

Field Documentation

◆ block_size

uint32_t storage_device_t::block_size

The block size read and write operations. This is usually a sector size on disk drives.

◆ blockread

block_read storage_device_t::blockread

Function pointer for blockread() Block reads are always expected to be in increments of block_size.

◆ blockwrite

block_write storage_device_t::blockwrite

Function pointer for blockwrite() Block writes are always expected to be in increments of block_size.

◆ name

char storage_device_t::name[16]

Storage device name, e.g. 'hd0'. You should use make_unique_device_name() to fill this field.

◆ next

struct storage_device_t* storage_device_t::next

Pointer to next storage device, or NULL.

◆ opaque1

uint64_t storage_device_t::opaque1

An opaque integer value which can be given meaning by the storage device driver.

◆ opaque2

void* storage_device_t::opaque2

An opaque pointer value which can be given meaning by the storage device driver.

◆ size

uint64_t storage_device_t::size

Total extent of storage device if known, otherwise this value should be SIZE_MAX.