|
Basic Solution File System - BSFS
|
Interface for restoring files from the Recovery tree in BSFS. More...
Functions | |
| int | restore_file_by_id (FILE *disk, superblock_t *sb, btree_handle_t *inode_tree, btree_handle_t *rec_tree, uint32_t recovery_id, const char *dest_dir_path, dir_t *cwd) |
| Restore a file from the Recovery tree by its recovery ID. | |
Interface for restoring files from the Recovery tree in BSFS.
This header declares high-level routines to restore a previously deleted file by using its snapshot stored in the Recovery B-tree. Restoration recreates the inode (reusing the recorded block spans) and links a new directory entry at the chosen destination directory. The corresponding recovery entry is then removed from the Recovery tree.
| int restore_file_by_id | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| btree_handle_t * | inode_tree, | ||
| btree_handle_t * | rec_tree, | ||
| uint32_t | recovery_id, | ||
| const char * | dest_dir_path, | ||
| dir_t * | cwd ) |
Restore a file from the Recovery tree by its recovery ID.
Semantics:
recovery_id.dest_dir_path is non-NULL, resolves it to a directory inode (relative to cwd if needed). If NULL or resolution fails, attempts to use the original parent recorded in the snapshot; if that is not available, falls back to cwd.sb->inode_root if the insertion creates the tree root.| disk | Open filesystem image. |
| sb | Loaded superblock (may be updated if inode root is first created during restore). |
| inode_tree | Inode B-tree handle (handle->root_block should be set from sb->inode_root if it already exists). |
| rec_tree | Recovery B-tree handle (handle->root_block should be set from sb->recovery_root). |
| recovery_id | Unique ID of the recovery snapshot to restore. |
| dest_dir_path | Optional destination directory path (absolute or relative to cwd). If NULL, attempt original parent then cwd. |
| cwd | Current working directory context for resolving relative paths and as a fallback destination. |