RPV Event driven kernel
Loading...
Searching...
No Matches
Kernel file I/O subsystem

Kernel filesystem and drive management middleware API extending kernel shell runtime with file mangement commands. More...

Functions

void _kernel_fio (void)
 Initializes kernel file I/O subsystem.
 
char _kernel_cdrive (void)
 Retrieves current active drive letter.
 
bool _kernel_unmount (void)
 Unmounts the currently mounted drive.
 
bool _kernel_mount (char letter)
 Mounts a drive by letter.
 
size_t _kernel_drives (char *drive_lt, size_t nlt)
 Retrieves available drive letters.
 
void _kernel_cd (char const *path)
 Changes the current working directory.
 
void _kernel_mkdir (char const *path)
 Creates a new directory.
 
void _kernel_rmfile (char const *path)
 Removes a file.
 
void _kernel_ls (const int argc, const char **argv)
 Lists directory contents.
 

Detailed Description

Kernel filesystem and drive management middleware API extending kernel shell runtime with file mangement commands.

Function Documentation

◆ _kernel_cd()

void _kernel_cd ( char const *  path)

Changes the current working directory.

Parameters
[in]pathTarget directory path.
Precondition
  • path must not be NULL.

Changes the active working directory within the kernel filesystem context.

Behavior on invalid path is implementation-defined (e.g., error message output, silent failure, etc.).

Side Effects:
  • Updates current working directory state.
Note
Path resolution rules: absolute and relative.

◆ _kernel_cdrive()

char _kernel_cdrive ( void  )

Retrieves current active drive letter.

Returns
Drive letter of the currently mounted filesystem.
Return values
0No drive mounted.

Returns the logical drive identifier (e.g., 'A', 'B', 'C').

◆ _kernel_drives()

size_t _kernel_drives ( char *  drive_lt,
size_t  nlt 
)

Retrieves available drive letters.

Parameters
[out]drive_ltBuffer receiving drive letters.
[in]nltMaximum number of letters to store.
Returns
Number of drive letters written to buffer.
Precondition
  • drive_lt must not be NULL if nlt > 0.

Writes up to nlt available drive identifiers into the provided buffer. Letters are not null-terminated unless explicitly handled by the caller.

Note
If the number of available drives exceeds nlt, the list is truncated.

◆ _kernel_fio()

void _kernel_fio ( void  )

Initializes kernel file I/O subsystem.

Prepares internal filesystem structures, mount tables, and underlying block device interfaces.

Must be called before invoking mount, unmount, or drive-related functions.

Postcondition
  • Filesystem subsystem is ready.
  • Internal drive state is initialized.
Side Effects:
  • Initializes internal static state.
  • May access storage hardware.

◆ _kernel_ls()

void _kernel_ls ( const int  argc,
const char **  argv 
)

Lists directory contents.

Parameters
[in]argcNumber of arguments.
[in]argvArgument vector.
Precondition
  • argv must not be NULL if argc > 0.

Implements directory listing functionality. Arguments may include:

  • Target path
  • Optional flags.

Intended for invocation from kernel shell.

Side Effects:
  • Produces formatted output to console.

◆ _kernel_mkdir()

void _kernel_mkdir ( char const *  path)

Creates a new directory.

Parameters
[in]pathDirectory path to create.
Precondition
  • path must not be NULL.

Creates a directory at the specified path.

Side Effects:
  • Modifies filesystem metadata.

◆ _kernel_mount()

bool _kernel_mount ( char  letter)

Mounts a drive by letter.

Parameters
[in]letterLogical drive letter to mount.
Return values
trueMount successful.
falseMount failed.
Precondition
  • letter must correspond to a valid available drive.
Postcondition
  • Specified drive becomes active on success.
Side Effects:
  • Initializes filesystem structures for the drive.

◆ _kernel_rmfile()

void _kernel_rmfile ( char const *  path)

Removes a file.

Parameters
[in]pathPath to file to remove.
Precondition
  • path must not be NULL.

Deletes the specified file from the filesystem.

Removal of directories using this function when not empty will result in access denied.

Side Effects:
  • Modifies filesystem structures.
Warning
Operation is irreversible.

◆ _kernel_unmount()

bool _kernel_unmount ( void  )

Unmounts the currently mounted drive.

Return values
trueUnmount successful.
falseUnmount failed or no drive mounted.
Postcondition
  • No active filesystem is mounted on success.
Side Effects:
  • Flushes pending filesystem operations.
  • Updates internal mount state.