Basic Solution File System - BSFS
Loading...
Searching...
No Matches
restore.c File Reference

Implements the restore command for the BSFS filesystem. More...

Functions

int restore (FILE *disk, superblock_t *sb, char **args)
 Restore a deleted file by recovery ID or original name.

Detailed Description

Implements the restore command for the BSFS filesystem.

Restores a deleted file from the Recovery tree by its recovery ID.

Usage:

  • restore <recovery_id>
  • restore <recovery_id> <dest_dir>

Function Documentation

◆ restore()

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.

Parameters
diskOpen filesystem image.
sbLoaded superblock.
argsargv-like vector; id or name in args[1], optional dest dir in args[2].
Returns
1 to continue the browser loop.