Fennix
1.0.0
Full Documentation
|
Go to the source code of this file.
Data Structures | |
struct | BlockDevice |
Functions | |
dev_t | RegisterBlockDevice (struct BlockDevice *Device) |
Registers a block device with the kernel block subsystem. | |
int | UnregisterBlockDevice (dev_t DeviceID) |
Unregisters a block device from the kernel block subsystem. | |
struct BlockDevice |
Data Fields | ||
---|---|---|
size_t | BlockCount |
Number of blocks in the device. This value is calculated as Size / BlockSize. It represents the total number of addressable blocks on the device. |
uint32_t | BlockSize |
Size of a single block in bytes. All read and write operations are performed in multiples of this block size. Typical values are 512 or 4096 bytes. |
const char * | Name |
Base name of the device. This name is used to identify the device in the system. It should be unique across all block devices. The kernel may append a number to this name to create a unique device name (e.g., "ahci0", "ahci1"). |
const InodeOperations * | Ops |
Pointer to the block device operations structure. This structure contains function pointers for various operations that can be performed on the block device, such as read, write, and ioctl. Yea, inode operations are used for block devices too. |
void * | PrivateData |
Opaque pointer to driver-specific or hardware-specific data. This field allows the driver to associate private context or state with the device, such as controller registers or internal buffers. |
size_t | Size |
Total size of the device in bytes. This value represents the total addressable storage capacity of the device. It is used for bounds checking and partitioning. |
dev_t RegisterBlockDevice | ( | struct BlockDevice * | Device | ) |
Registers a block device with the kernel block subsystem.
This function should be called by block device drivers after initializing a device. The kernel will take ownership of the device structure and assign it a unique device ID. The device will then be accessible for filesystem mounting and I/O operations.
Device | Pointer to a fully initialized BlockDevice structure. All required fields must be set and valid for the lifetime of the device. |
int UnregisterBlockDevice | ( | dev_t | DeviceID | ) |
Unregisters a block device from the kernel block subsystem.
This function should be called by drivers when a device is being removed or is no longer available. The kernel will release any resources associated with the device and invalidate its device ID.
DeviceID | The device ID (dev_t) previously returned by RegisterBlockDevice(). |