|
Basic Solution File System - BSFS
|
Command table and prototypes for the BSFS browser. More...
Classes | |
| struct | Command |
| Name-to-function descriptor for a browser command. More... | |
Functions | |
| int | bsfs_cmd_exit (FILE *file, superblock_t *sb, char **args) |
| Exit the BSFS browser loop. | |
| int | bsfs_cmd_info (FILE *file, superblock_t *sb, char **args) |
| Print filesystem information from the superblock. | |
| int | bsfs_cmd_help (FILE *file, superblock_t *sb, char **args) |
| Display a help summary for available commands. | |
| int | cd (FILE *disk, superblock_t *sb, char **args) |
| Change current working directory. | |
| int | pwd (FILE *disk, superblock_t *sb, char **args) |
| Print the current working directory. | |
| int | list (FILE *disk, superblock_t *sb, char **args) |
| List contents of a directory. | |
| int | mkdir (FILE *disk, superblock_t *sb, char **args) |
| Create a new directory. | |
| int | rmdir (FILE *disk, superblock_t *sb, char **args) |
| Remove an empty directory. | |
| int | touch (FILE *disk, superblock_t *sb, char **args) |
| Create an empty regular file. | |
| int | rm (FILE *disk, superblock_t *sb, char **args) |
| Remove a file (logical delete with Recovery snapshot). | |
| int | cp (FILE *disk, superblock_t *sb, char **args) |
| Copy a file. | |
| int | mv (FILE *disk, superblock_t *sb, char **args) |
| Move or rename a file or directory. | |
| int | cat (FILE *disk, superblock_t *sb, char **args) |
| Display file contents. | |
| int | echo (FILE *disk, superblock_t *sb, char **args) |
| Write text or append text to a file, or echo to screen. | |
| int | stat (FILE *disk, superblock_t *sb, char **args) |
| Show inode metadata for a path. | |
| int | dd (FILE *disk, superblock_t *sb, char **args) |
| Generate a file by copying blocks from /dev/zero or /dev/random. | |
| int | fill_cmd (FILE *disk, superblock_t *sb, char **args) |
| Implements the fill command for the BSFS browser. | |
| int | whoami_cmd (FILE *disk, superblock_t *sb, char **args) |
| Print current session uid, gid and umask. | |
| int | su (FILE *disk, superblock_t *sb, char **args) |
| Switch the browser session identity (testing helper). | |
| int | umask_cmd (FILE *disk, superblock_t *sb, char **args) |
| Show or set the session umask (octal). | |
| int | chmod (FILE *disk, superblock_t *sb, char **args) |
| Change permission bits of a path. | |
| int | chown (FILE *disk, superblock_t *sb, char **args) |
| Change file owner (uid) of a path (root only). | |
| int | chgrp (FILE *disk, superblock_t *sb, char **args) |
| Change file group (gid) of a path (root only). | |
| int | recovery (FILE *disk, superblock_t *sb, char **args) |
| List Recovery snapshots, optionally filtered by original name. | |
| int | restore (FILE *disk, superblock_t *sb, char **args) |
| Restore a deleted file by recovery ID or original name. | |
| int | purge (FILE *disk, superblock_t *sb, char **args) |
| BSFS browser command: purge Recovery snapshots to reclaim space. | |
Command table and prototypes for the BSFS browser.
Exposes the browser command registry and individual command function signatures. Each command receives the open filesystem image, the loaded superblock, and the tokenized argv-like vector.
| int bsfs_cmd_exit | ( | FILE * | file, |
| superblock_t * | sb, | ||
| char ** | args ) |
Exit the BSFS browser loop.
Usage: exit
Prints a farewell message and returns 0 so the main loop terminates.
| file | Open filesystem image (unused). |
| sb | Loaded superblock (unused). |
| args | Tokenized arguments (unused). |
| int bsfs_cmd_help | ( | FILE * | file, |
| superblock_t * | sb, | ||
| char ** | args ) |
Display a help summary for available commands.
Usage: help
Prints categories and usage examples for navigation, file, directory, recovery and system commands available in the browser.
| file | Open filesystem image (unused). |
| sb | Loaded superblock (unused). |
| args | Tokenized arguments (unused). |
| int bsfs_cmd_info | ( | FILE * | file, |
| superblock_t * | sb, | ||
| char ** | args ) |
Print filesystem information from the superblock.
Usage: info
Dumps key fields such as magic, block size, total blocks, bitmap layout, inode and recovery roots, and the root inode number.
| file | Open filesystem image (unused). |
| sb | Loaded superblock. |
| args | Tokenized arguments (unused). |
| int cat | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Display file contents.
Usage: cat <path>
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | File path in args[1]. |
| int cd | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Change current working directory.
Usage: cd <directory>
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Expects directory path in args[1]. |
| int chgrp | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Change file group (gid) of a path (root only).
Parses a decimal gid and updates the target's group via the API. Prints usage on invalid arguments and a concise error on failure.
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Command argv-like vector; expects gid in args[1], path in args[2]. |
| int chmod | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Change permission bits of a path.
Parses the octal mode and calls the high-level API to update permission bits. Prints usage on invalid input and a concise error on failure.
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Command argv-like vector; expects mode in args[1], path in args[2]. |
| int chown | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Change file owner (uid) of a path (root only).
Parses a decimal uid and updates the target's owner via the API. Prints usage on invalid arguments and a concise error on failure.
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Command argv-like vector; expects uid in args[1], path in args[2]. |
| int cp | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Copy a file.
Usage: cp <src> <dst>
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Source path in args[1], destination path in args[2]. |
| int dd | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Generate a file by copying blocks from /dev/zero or /dev/random.
Usage: dd if=/dev/zero of=<file> bs=<size> count=<n>
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Key-value args (if/of/bs/count) parsed by the command. |
| int echo | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Write text or append text to a file, or echo to screen.
Usage: echo "text" [> file | >> file]
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Text tokens and optional redirection operator + filename. |
| int fill_cmd | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Implements the fill command for the BSFS browser.
The fill command creates a number of files with a given size, measuring the elapsed time for the operation. Files are created sequentially using the high-level API and filled with a predictable byte pattern.
Usage: fill <count> <size> [prefix] [bs=<block>] [pattern=index|zero|random]
Parameters:
| int list | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
List contents of a directory.
Usage: ls [path] or list [path]
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Optional directory path in args[1]; defaults to ".". |
| int mkdir | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Create a new directory.
Usage: mkdir <directory>
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Directory name in args[1]. |
| int mv | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Move or rename a file or directory.
Usage: mv <src> <dst>
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Source path in args[1], destination path in args[2]. |
| int purge | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
BSFS browser command: purge Recovery snapshots to reclaim space.
Usage:
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Tokenized arguments per usage above. |
| int pwd | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Print the current working directory.
Usage: pwd
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Unused. |
| int recovery | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
List Recovery snapshots, optionally filtered by original name.
Usage: recovery [name]
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Optional name filter in args[1]. |
| int restore | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Restore a deleted file by recovery ID or original name.
If the first argument parses as a numeric ID, restores that snapshot. Otherwise treats it as a name and disambiguates if multiple snapshots share the same name, printing a table of candidates with deletion timestamps.
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | argv-like vector; id or name in args[1], optional dest dir in args[2]. |
| int rm | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Remove a file (logical delete with Recovery snapshot).
Unlinks the directory entry and inserts a snapshot into the Recovery tree so the file can be restored later. Prints a confirmation or a concise error message (including permission denied when applicable).
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Command argv-like vector; expects target path in args[1]. |
| int rmdir | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Remove an empty directory.
Usage: rmdir <directory>
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Directory name in args[1]. |
| int stat | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Show inode metadata for a path.
Usage: stat <path>
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Path in args[1]. |
| int su | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Switch the browser session identity (testing helper).
Changes the API session uid (and optionally gid) used for permission checks. Accepts decimal values. Intended for testing permission behavior in the browser; no OS-level identity is changed.
| disk | Open filesystem image (unused). |
| sb | Loaded superblock (unused). |
| args | argv-like vector; expects uid in args[1], optional gid in args[2]. |
| int touch | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Create an empty regular file.
Usage: touch <filename>
| disk | Open filesystem image. |
| sb | Loaded superblock. |
| args | Target filename in args[1]. |
| int umask_cmd | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Show or set the session umask (octal).
With no argument, prints the current umask. With a single octal argument, sets the session umask for subsequent creates. Values must be 000..777.
| disk | Open filesystem image (unused). |
| sb | Loaded superblock (unused). |
| args | argv-like vector; optional octal value in args[1]. |
| int whoami_cmd | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| char ** | args ) |
Print current session uid, gid and umask.
Reads the API session identity and umask and prints them in a compact form.
| disk | Open filesystem image (unused). |
| sb | Loaded superblock (unused). |
| args | argv-like vector (unused). |