The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
ext2_io.c File Reference
#include "ext2_internal.h"

Functions

bool read_abs_bytes (block_device_t *disk, uint32_t byte_offset, uint32_t size, void *out, uint8_t *sector_buf)
 reads bytes from the disk at the specified absolute byte offset and size into the provided output buffer.
bool read_block (ext2_volume_t *volume, uint32_t block, void *out)
 reads a block from the EXT2 volume into the provided output buffer.
bool read_group_desc (ext2_volume_t *volume, uint32_t group, ext2_block_group_desc_t *out_desc)
 reads the block group descriptor for the specified group from the EXT2 volume into the provided output structure.
bool write_abs_bytes (block_device_t *disk, uint32_t byte_offset, uint32_t size, const void *in, uint8_t *sector_buf)
 writes bytes to the disk at the specified absolute byte offset and size from the provided input buffer.
bool write_block (ext2_volume_t *volume, uint32_t block, const void *in)
 writes a block to the EXT2 volume from the provided input buffer.
bool write_group_desc (ext2_volume_t *volume, uint32_t group, const ext2_block_group_desc_t *desc)
 writes the block group descriptor for the specified group to the EXT2 volume from the provided input structure.
bool write_superblock (ext2_volume_t *volume)
 writes the superblock to the EXT2 volume.
bool read_inode_bitmap (ext2_volume_t *volume, uint32_t group, uint8_t *bitmap)
 reads the inode bitmap for the specified block group from the EXT2 volume into the provided output buffer.
bool write_inode_bitmap (ext2_volume_t *volume, uint32_t group, const uint8_t *bitmap)
 writes the inode bitmap for the specified block group to the EXT2 volume from the provided input buffer.
bool read_block_bitmap (ext2_volume_t *volume, uint32_t group, uint8_t *bitmap)
 reads the block bitmap for the specified block group from the EXT2 volume into the provided output buffer.
bool write_block_bitmap (ext2_volume_t *volume, uint32_t group, const uint8_t *bitmap)
 writes the block bitmap for the specified block group to the EXT2 volume from the provided input buffer.

Function Documentation

◆ read_abs_bytes()

bool read_abs_bytes ( block_device_t * disk,
uint32_t byte_offset,
uint32_t size,
void * out,
uint8_t * sector_buf )

reads bytes from the disk at the specified absolute byte offset and size into the provided output buffer.

Parameters
diskpointer to the block device representing the disk.
byte_offsetthe absolute byte offset on the disk to start reading from.
sizethe number of bytes to read.
outpointer to the output buffer where the read bytes will be stored.
sector_bufscratch buffer for partial-sector reads (must be EXT2_SECTOR_SIZE bytes).
Returns
true if the read operation was successful, false otherwise.

◆ read_block()

bool read_block ( ext2_volume_t * volume,
uint32_t block,
void * out )

reads a block from the EXT2 volume into the provided output buffer.

Parameters
volumepointer to the ext2_volume_t structure representing the filesystem volume.
blockthe block number to read from the volume.
outpointer to the output buffer where the read block will be stored.
Returns
true if the read operation was successful, false otherwise.

◆ read_group_desc()

bool read_group_desc ( ext2_volume_t * volume,
uint32_t group,
ext2_block_group_desc_t * out_desc )

reads the block group descriptor for the specified group from the EXT2 volume into the provided output structure.

Parameters
volumepointer to the ext2_volume_t structure representing the filesystem volume.
groupthe block group number to read the descriptor for.
out_descpointer to the ext2_block_group_desc_t structure where the read descriptor will be stored.
Returns
true if the read operation was successful, false otherwise.

◆ write_abs_bytes()

bool write_abs_bytes ( block_device_t * disk,
uint32_t byte_offset,
uint32_t size,
const void * in,
uint8_t * sector_buf )

writes bytes to the disk at the specified absolute byte offset and size from the provided input buffer.

Parameters
diskpointer to the block device representing the disk.
byte_offsetthe absolute byte offset on the disk to start writing to.
sizethe number of bytes to write.
inpointer to the input buffer containing the bytes to be written.
sector_bufscratch buffer for partial-sector read-modify-write (must be EXT2_SECTOR_SIZE bytes).
Returns
true if the write operation was successful, false otherwise.

◆ write_block()

bool write_block ( ext2_volume_t * volume,
uint32_t block,
const void * in )

writes a block to the EXT2 volume from the provided input buffer.

Parameters
volumepointer to the ext2_volume_t structure representing the filesystem volume.
blockthe block number to write to the volume.
inpointer to the input buffer containing the block data to be written.
Returns
true if the write operation was successful, false otherwise.

◆ write_group_desc()

bool write_group_desc ( ext2_volume_t * volume,
uint32_t group,
const ext2_block_group_desc_t * desc )

writes the block group descriptor for the specified group to the EXT2 volume from the provided input structure.

Parameters
volumepointer to the ext2_volume_t structure representing the filesystem volume.
groupthe block group number to write the descriptor for.
descpointer to the ext2_block_group_desc_t structure containing the descriptor data to be written.
Returns
true if the write operation was successful, false otherwise.

◆ write_superblock()

bool write_superblock ( ext2_volume_t * volume)

writes the superblock to the EXT2 volume.

Parameters
volumepointer to the ext2_volume_t structure representing the filesystem volume.
Returns
true if the write operation was successful, false otherwise.

◆ read_inode_bitmap()

bool read_inode_bitmap ( ext2_volume_t * volume,
uint32_t group,
uint8_t * bitmap )

reads the inode bitmap for the specified block group from the EXT2 volume into the provided output buffer.

Parameters
volumepointer to the ext2_volume_t structure representing the filesystem volume.
groupthe block group number to read the inode bitmap for.
bitmappointer to the output buffer where the read inode bitmap will be stored.
Returns
true if the read operation was successful, false otherwise.

◆ write_inode_bitmap()

bool write_inode_bitmap ( ext2_volume_t * volume,
uint32_t group,
const uint8_t * bitmap )

writes the inode bitmap for the specified block group to the EXT2 volume from the provided input buffer.

Parameters
volumepointer to the ext2_volume_t structure representing the filesystem volume.
groupthe block group number to write the inode bitmap for.
bitmappointer to the input buffer containing the inode bitmap data to be written.
Returns
true if the write operation was successful, false otherwise.

◆ read_block_bitmap()

bool read_block_bitmap ( ext2_volume_t * volume,
uint32_t group,
uint8_t * bitmap )

reads the block bitmap for the specified block group from the EXT2 volume into the provided output buffer.

Parameters
volumepointer to the ext2_volume_t structure representing the filesystem volume.
groupthe block group number to read the block bitmap for.
bitmappointer to the output buffer where the read block bitmap will be stored.
Returns
true if the read operation was successful, false otherwise.

◆ write_block_bitmap()

bool write_block_bitmap ( ext2_volume_t * volume,
uint32_t group,
const uint8_t * bitmap )

writes the block bitmap for the specified block group to the EXT2 volume from the provided input buffer.

Parameters
volumepointer to the ext2_volume_t structure representing the filesystem volume.
groupthe block group number to write the block bitmap for.
bitmappointer to the input buffer containing the block bitmap data to be written.
Returns
true if the write operation was successful, false otherwise.