|
ginnOS
The reference: libc, the libraries and the kernel
|
#include "ext2.h"#include "common/error.h"#include "common/memory.h"#include "common/string.h"#include "common/stdio.h"Go to the source code of this file.
Macros | |
| #define | EXT2_SECTOR_SIZE 512u |
| #define | EXT2_MIN(a, b) |
| #define | OFFSETOF(type, member) |
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. | |
| bool | inode_location (ext2_volume_t *volume, uint32_t inode_number, ext2_block_group_desc_t *desc_out, uint32_t *inode_byte_offset_out, uint32_t *group_out) |
| determines the location of a specific inode within the EXT2 volume, including its block group descriptor and byte offset. | |
| bool | write_inode (ext2_volume_t *volume, uint32_t inode_number, const ext2_inode_t *inode) |
| writes an inode to the EXT2 volume at the specified inode number. | |
| bool | update_group_and_super_counts (ext2_volume_t *volume, uint32_t group, int32_t free_blocks_delta, int32_t free_inodes_delta, int32_t used_dirs_delta) |
| updates the free block count, free inode count, and used directory count in both the block group descriptor and the superblock for the specified block group. | |
| bool | alloc_inode (ext2_volume_t *volume, uint32_t *inode_number_out) |
| allocates a free inode from the EXT2 volume and returns its inode number. | |
| bool | free_inode (ext2_volume_t *volume, uint32_t inode_number) |
| frees an allocated inode in the EXT2 volume, marking it as available for future use. | |
| bool | alloc_block (ext2_volume_t *volume, uint32_t *block_number_out) |
| allocates a free block from the EXT2 volume and returns its block number. | |
| bool | free_block (ext2_volume_t *volume, uint32_t block_number) |
| frees an allocated block in the EXT2 volume, marking it as available for future use. | |
| bool | free_inode_block_chain (ext2_volume_t *volume, ext2_inode_t *inode) |
| frees all blocks associated with an inode, including direct, single indirect, double indirect, and triple indirect blocks. | |
| bool | inode_is_dir (const ext2_inode_t *inode) |
| determines if a given inode represents a directory by checking its mode against the directory file type constant. | |
| bool | inode_is_regular (const ext2_inode_t *inode) |
| determines if a given inode represents a regular file by checking its mode against the regular file type constant. | |
| bool | inode_is_directory (const ext2_inode_t *inode) |
| determines if a given inode represents a directory by checking its mode against the directory file type constant. | |
| uint8_t | inode_to_file_type (const ext2_inode_t *inode) |
| maps an inode's mode to the corresponding EXT2 file type constant, returning the appropriate value for directory or regular file types, or 0 for unsupported types. | |
| bool | inode_is_symlink (const ext2_inode_t *inode) |
| bool | inode_is_fast_symlink (const ext2_inode_t *inode) |
| bool | inode_has_no_blocks (const ext2_inode_t *inode) |
| kerr_t | find_in_directory (ext2_volume_t *volume, uint32_t dir_inode_number, const char *name, uint32_t name_len, uint32_t *inode_out) |
| searches for a directory entry with a specific name within a given directory inode, returning the inode number of the found entry if it exists. | |
| bool | resolve_data_block (ext2_volume_t *volume, const ext2_inode_t *inode, uint32_t logical_block_index, uint32_t *physical_block_out) |
| resolves a logical block index within an inode to its corresponding physical block number on disk, handling direct, single indirect, double indirect, and triple indirect block addressing as defined by the EXT2 filesystem structure. | |
| bool | find_directory_entry (ext2_volume_t *volume, uint32_t dir_inode_number, const char *name, uint32_t name_len, uint32_t *block_index_out, uint32_t *offset_out, ext2_dir_entry_t *entry_out) |
| searches for a directory entry with a specific name within a given directory inode, returning the block index, offset, and entry details if found. | |
| bool | append_or_replace_directory_entry (ext2_volume_t *volume, uint32_t parent_inode_number, ext2_inode_t *parent_inode, const char *name, uint32_t name_len, uint32_t child_inode_number, uint8_t file_type) |
| appends a new directory entry to a parent directory inode or replaces an existing entry with the same name, ensuring proper space allocation and alignment within the directory's data blocks. | |
| bool | update_directory_entry_name (ext2_volume_t *volume, uint32_t dir_inode_number, const char *old_name, uint32_t old_name_len, const char *new_name, uint32_t new_name_len) |
| updates the name of an existing directory entry within a specified directory inode, ensuring that the new name fits within the allocated space for the entry. | |
| bool | directory_is_empty (ext2_volume_t *volume, uint32_t inode_number) |
| checks if a directory represented by a given inode number is empty, meaning it contains no entries other than the standard '. | |
| bool | update_directory_parent_link (ext2_volume_t *volume, uint32_t dir_inode_number, uint32_t parent_inode_number) |
| updates the '..' entry in a directory to point to a new parent inode number, effectively changing the parent directory reference for that directory. | |
| bool | remove_directory_entry (ext2_volume_t *volume, uint32_t dir_inode_number, const char *name, uint32_t name_len) |
| removes a directory entry with a specific name from a given directory inode, effectively deleting the entry from the directory's data blocks. | |
| bool | setup_new_file_inode (ext2_inode_t *inode) |
| initializes a new inode structure for a regular file, setting its mode, link count, and clearing other fields to prepare it for use in the filesystem. | |
| bool | setup_new_dir_inode (ext2_inode_t *inode, ext2_volume_t *volume) |
| initializes a new inode structure for a directory, setting its mode, link count, size, and block count to prepare it for use in the filesystem. | |
| bool | initialize_directory_block (ext2_volume_t *volume, uint32_t inode_number, uint32_t parent_inode_number, uint32_t block_number) |
| initializes a new directory block with the standard '. | |
| bool | lookup_parent_and_name (ext2_volume_t *volume, const char *path, uint32_t *parent_inode_out, char *name_out, uint32_t name_out_size, char *parent_path, uint32_t parent_path_size) |
| looks up the parent directory inode and the name of the final component in a given path, splitting the path into its parent and child components and verifying that the parent is a valid directory. | |
| bool | lookup_child_type (ext2_volume_t *volume, uint32_t parent_inode_number, const char *name, uint32_t name_len, uint32_t *child_inode_out, uint8_t *child_type_out) |
| looks up a child directory entry by name within a specified parent directory inode, returning the child's inode number and file type if found. | |
| bool | free_inode_and_blocks (ext2_volume_t *volume, uint32_t inode_number, ext2_inode_t *inode) |
| frees the blocks associated with a given inode and then frees the inode itself, effectively removing the file or directory represented by that inode from the filesystem. | |
| #define EXT2_SECTOR_SIZE 512u |
| #define EXT2_MIN | ( | a, | |
| b ) |
| #define OFFSETOF | ( | type, | |
| member ) |
| 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.
| disk | pointer to the block device representing the disk. |
| byte_offset | the absolute byte offset on the disk to start reading from. |
| size | the number of bytes to read. |
| out | pointer to the output buffer where the read bytes will be stored. |
| sector_buf | scratch buffer for partial-sector reads (must be EXT2_SECTOR_SIZE bytes). |
| bool read_block | ( | ext2_volume_t * | volume, |
| uint32_t | block, | ||
| void * | out ) |
reads a block from the EXT2 volume into the provided output buffer.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| block | the block number to read from the volume. |
| out | pointer to the output buffer where the read block will be stored. |
| 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.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| group | the block group number to read the descriptor for. |
| out_desc | pointer to the ext2_block_group_desc_t structure where the read descriptor will be stored. |
| 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.
| disk | pointer to the block device representing the disk. |
| byte_offset | the absolute byte offset on the disk to start writing to. |
| size | the number of bytes to write. |
| in | pointer to the input buffer containing the bytes to be written. |
| sector_buf | scratch buffer for partial-sector read-modify-write (must be EXT2_SECTOR_SIZE bytes). |
| 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.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| block | the block number to write to the volume. |
| in | pointer to the input buffer containing the block data to be written. |
| 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.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| group | the block group number to write the descriptor for. |
| desc | pointer to the ext2_block_group_desc_t structure containing the descriptor data to be written. |
| bool write_superblock | ( | ext2_volume_t * | volume | ) |
writes the superblock to the EXT2 volume.
| volume | pointer to the ext2_volume_t structure representing the filesystem 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.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| group | the block group number to read the inode bitmap for. |
| bitmap | pointer to the output buffer where the read inode bitmap will be stored. |
| 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.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| group | the block group number to write the inode bitmap for. |
| bitmap | pointer to the input buffer containing the inode bitmap data to be written. |
| 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.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| group | the block group number to read the block bitmap for. |
| bitmap | pointer to the output buffer where the read block bitmap will be stored. |
| 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.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| group | the block group number to write the block bitmap for. |
| bitmap | pointer to the input buffer containing the block bitmap data to be written. |
| bool inode_location | ( | ext2_volume_t * | volume, |
| uint32_t | inode_number, | ||
| ext2_block_group_desc_t * | desc_out, | ||
| uint32_t * | inode_byte_offset_out, | ||
| uint32_t * | group_out ) |
determines the location of a specific inode within the EXT2 volume, including its block group descriptor and byte offset.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| inode_number | the inode number to locate (1-based index). |
| desc_out | pointer to an ext2_block_group_desc_t structure where the block group descriptor will be stored. |
| inode_byte_offset_out | pointer to a variable where the byte offset of the inode within the volume will be stored. |
| group_out | optional pointer to a variable where the block group number will be stored (can be NULL if not needed). |
| bool write_inode | ( | ext2_volume_t * | volume, |
| uint32_t | inode_number, | ||
| const ext2_inode_t * | inode ) |
writes an inode to the EXT2 volume at the specified inode number.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| inode_number | the inode number to write to (1-based index). |
| inode | pointer to the ext2_inode_t structure containing the inode data to be written. |
| bool update_group_and_super_counts | ( | ext2_volume_t * | volume, |
| uint32_t | group, | ||
| int32_t | free_blocks_delta, | ||
| int32_t | free_inodes_delta, | ||
| int32_t | used_dirs_delta ) |
updates the free block count, free inode count, and used directory count in both the block group descriptor and the superblock for the specified block group.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| group | the block group number to update. |
| free_blocks_delta | the change in the number of free blocks (positive to increase, negative to decrease). |
| free_inodes_delta | the change in the number of free inodes (positive to increase, negative to decrease). |
| used_dirs_delta | the change in the number of used directories (positive to increase, negative to decrease). |
| bool alloc_inode | ( | ext2_volume_t * | volume, |
| uint32_t * | inode_number_out ) |
allocates a free inode from the EXT2 volume and returns its inode number.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| inode_number_out | pointer to a variable where the allocated inode number will be stored (1-based index). |
| bool free_inode | ( | ext2_volume_t * | volume, |
| uint32_t | inode_number ) |
frees an allocated inode in the EXT2 volume, marking it as available for future use.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| inode_number | the inode number to free (1-based index). |
| bool alloc_block | ( | ext2_volume_t * | volume, |
| uint32_t * | block_number_out ) |
allocates a free block from the EXT2 volume and returns its block number.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| block_number_out | pointer to a variable where the allocated block number will be stored. |
| bool free_block | ( | ext2_volume_t * | volume, |
| uint32_t | block_number ) |
frees an allocated block in the EXT2 volume, marking it as available for future use.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| block_number | the block number to free. |
| bool free_inode_block_chain | ( | ext2_volume_t * | volume, |
| ext2_inode_t * | inode ) |
frees all blocks associated with an inode, including direct, single indirect, double indirect, and triple indirect blocks.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| inode | pointer to the ext2_inode_t structure representing the inode whose blocks are to be freed. |
| bool inode_is_dir | ( | const ext2_inode_t * | inode | ) |
determines if a given inode represents a directory by checking its mode against the directory file type constant.
| inode | pointer to the ext2_inode_t structure to be checked. |
| bool inode_is_regular | ( | const ext2_inode_t * | inode | ) |
determines if a given inode represents a regular file by checking its mode against the regular file type constant.
| inode | pointer to the ext2_inode_t structure to be checked. |
| bool inode_is_directory | ( | const ext2_inode_t * | inode | ) |
determines if a given inode represents a directory by checking its mode against the directory file type constant.
| inode | pointer to the ext2_inode_t structure to be checked. |
| uint8_t inode_to_file_type | ( | const ext2_inode_t * | inode | ) |
maps an inode's mode to the corresponding EXT2 file type constant, returning the appropriate value for directory or regular file types, or 0 for unsupported types.
| inode | pointer to the ext2_inode_t structure whose file type is to be determined. |
| bool inode_is_symlink | ( | const ext2_inode_t * | inode | ) |
| bool inode_is_fast_symlink | ( | const ext2_inode_t * | inode | ) |
| bool inode_has_no_blocks | ( | const ext2_inode_t * | inode | ) |
| kerr_t find_in_directory | ( | ext2_volume_t * | volume, |
| uint32_t | dir_inode_number, | ||
| const char * | name, | ||
| uint32_t | name_len, | ||
| uint32_t * | inode_out ) |
searches for a directory entry with a specific name within a given directory inode, returning the inode number of the found entry if it exists.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| dir_inode_number | the inode number of the directory to search within. |
| name | the name of the directory entry to search for. |
| name_len | the length of the name to search for. |
| inode_out | pointer to a variable where the inode number of the found entry will be stored if the entry is found. |
| bool resolve_data_block | ( | ext2_volume_t * | volume, |
| const ext2_inode_t * | inode, | ||
| uint32_t | logical_block_index, | ||
| uint32_t * | physical_block_out ) |
resolves a logical block index within an inode to its corresponding physical block number on disk, handling direct, single indirect, double indirect, and triple indirect block addressing as defined by the EXT2 filesystem structure.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| inode | pointer to the ext2_inode_t structure representing the inode whose block is being resolved. |
| logical_block_index | the logical block index to resolve (0-based). |
| physical_block_out | pointer to a variable where the resolved physical block number will be stored. |
| bool find_directory_entry | ( | ext2_volume_t * | volume, |
| uint32_t | dir_inode_number, | ||
| const char * | name, | ||
| uint32_t | name_len, | ||
| uint32_t * | block_index_out, | ||
| uint32_t * | offset_out, | ||
| ext2_dir_entry_t * | entry_out ) |
searches for a directory entry with a specific name within a given directory inode, returning the block index, offset, and entry details if found.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| dir_inode_number | the inode number of the directory to search within. |
| name | the name of the directory entry to search for. |
| name_len | the length of the name to search for. |
| block_index_out | pointer to a variable where the block index of the found entry will be stored. |
| offset_out | pointer to a variable where the byte offset of the found entry within the block will be stored. |
| entry_out | pointer to an ext2_dir_entry_t structure where the details of the found entry will be stored. |
| bool append_or_replace_directory_entry | ( | ext2_volume_t * | volume, |
| uint32_t | parent_inode_number, | ||
| ext2_inode_t * | parent_inode, | ||
| const char * | name, | ||
| uint32_t | name_len, | ||
| uint32_t | child_inode_number, | ||
| uint8_t | file_type ) |
appends a new directory entry to a parent directory inode or replaces an existing entry with the same name, ensuring proper space allocation and alignment within the directory's data blocks.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| parent_inode_number | the inode number of the parent directory where the entry will be added or replaced. |
| parent_inode | pointer to the ext2_inode_t structure representing the parent directory inode. |
| name | the name of the directory entry to add or replace. |
| name_len | the length of the name of the directory entry. |
| child_inode_number | the inode number of the child entry to be added or replaced. |
| file_type | the type of the file (e.g., regular file, directory) for the new directory entry. |
| bool update_directory_entry_name | ( | ext2_volume_t * | volume, |
| uint32_t | dir_inode_number, | ||
| const char * | old_name, | ||
| uint32_t | old_name_len, | ||
| const char * | new_name, | ||
| uint32_t | new_name_len ) |
updates the name of an existing directory entry within a specified directory inode, ensuring that the new name fits within the allocated space for the entry.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| dir_inode_number | the inode number of the directory containing the entry to be renamed. |
| old_name | the current name of the directory entry to be renamed. |
| old_name_len | the length of the current name of the directory entry. |
| new_name | the new name to assign to the directory entry. |
| new_name_len | the length of the new name to assign to the directory entry. |
| bool directory_is_empty | ( | ext2_volume_t * | volume, |
| uint32_t | inode_number ) |
checks if a directory represented by a given inode number is empty, meaning it contains no entries other than the standard '.
' and '..' entries.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| inode_number | the inode number of the directory to check. |
| bool update_directory_parent_link | ( | ext2_volume_t * | volume, |
| uint32_t | dir_inode_number, | ||
| uint32_t | parent_inode_number ) |
updates the '..' entry in a directory to point to a new parent inode number, effectively changing the parent directory reference for that directory.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| dir_inode_number | the inode number of the directory whose parent link is to be updated. |
| parent_inode_number | the inode number of the new parent directory to which the '..' entry should point. |
| bool remove_directory_entry | ( | ext2_volume_t * | volume, |
| uint32_t | dir_inode_number, | ||
| const char * | name, | ||
| uint32_t | name_len ) |
removes a directory entry with a specific name from a given directory inode, effectively deleting the entry from the directory's data blocks.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| dir_inode_number | the inode number of the directory from which the entry will be removed. |
| name | the name of the directory entry to be removed. |
| name_len | the length of the name of the directory entry to be removed. |
| bool setup_new_file_inode | ( | ext2_inode_t * | inode | ) |
initializes a new inode structure for a regular file, setting its mode, link count, and clearing other fields to prepare it for use in the filesystem.
| inode | pointer to the ext2_inode_t structure to be initialized. |
| bool setup_new_dir_inode | ( | ext2_inode_t * | inode, |
| ext2_volume_t * | volume ) |
initializes a new inode structure for a directory, setting its mode, link count, size, and block count to prepare it for use in the filesystem.
| inode | pointer to the ext2_inode_t structure to be initialized. |
| volume | pointer to the ext2_volume_t structure representing the filesystem volume, used to determine the block size and sectors per block for the directory inode. |
| bool initialize_directory_block | ( | ext2_volume_t * | volume, |
| uint32_t | inode_number, | ||
| uint32_t | parent_inode_number, | ||
| uint32_t | block_number ) |
initializes a new directory block with the standard '.
' and '..' entries, setting their inode numbers and ensuring proper formatting for the directory structure.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| inode_number | the inode number of the directory being initialized (for the '.' entry). |
| parent_inode_number | the inode number of the parent directory (for the '..' entry). |
| block_number | the block number where the new directory block will be written. |
| bool lookup_parent_and_name | ( | ext2_volume_t * | volume, |
| const char * | path, | ||
| uint32_t * | parent_inode_out, | ||
| char * | name_out, | ||
| uint32_t | name_out_size, | ||
| char * | parent_path, | ||
| uint32_t | parent_path_size ) |
looks up the parent directory inode and the name of the final component in a given path, splitting the path into its parent and child components and verifying that the parent is a valid directory.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| path | the input path string to be looked up (must start with '/'). |
| parent_inode_out | pointer to a variable where the inode number of the parent directory will be stored. |
| name_out | buffer to store the name of the final component (file or directory) in the path. |
| name_out_size | the size of the name_out buffer in bytes. |
| parent_path | buffer to store the parent directory path. |
| parent_path_size | the size of the parent_path buffer in bytes. |
| bool lookup_child_type | ( | ext2_volume_t * | volume, |
| uint32_t | parent_inode_number, | ||
| const char * | name, | ||
| uint32_t | name_len, | ||
| uint32_t * | child_inode_out, | ||
| uint8_t * | child_type_out ) |
looks up a child directory entry by name within a specified parent directory inode, returning the child's inode number and file type if found.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| parent_inode_number | the inode number of the parent directory to search within. |
| name | the name of the child directory entry to look up. |
| name_len | the length of the name of the child directory entry. |
| child_inode_out | pointer to a variable where the inode number of the found child entry will be stored. |
| child_type_out | pointer to a variable where the file type of the found child entry will be stored. |
| bool free_inode_and_blocks | ( | ext2_volume_t * | volume, |
| uint32_t | inode_number, | ||
| ext2_inode_t * | inode ) |
frees the blocks associated with a given inode and then frees the inode itself, effectively removing the file or directory represented by that inode from the filesystem.
| volume | pointer to the ext2_volume_t structure representing the filesystem volume. |
| inode_number | the inode number of the file or directory to be freed. |
| inode | pointer to the ext2_inode_t structure representing the inode to be freed. If null, the function will read the inode from the filesystem. |