Basic Solution File System - BSFS
Loading...
Searching...
No Matches
rec_entry_t Struct Reference

Represents a deleted file entry stored in the recovery B-tree. More...

#include <filesystem_bsfs.h>

Public Attributes

uint32_t recovery_id
uint64_t deleted_at
uint32_t original_parent_ino
char original_name [256]
uint32_t inode_number
uint8_t file_type
uint16_t uid
uint16_t gid
uint16_t permissions
uint32_t file_size
uint32_t block_count
bspan_t direct_blocks [16]
uint32_t btree_root
uint64_t retention_until

Detailed Description

Represents a deleted file entry stored in the recovery B-tree.

Each recovery entry acts as a snapshot of a file's inode at the moment it was deleted. These entries enable the filesystem to restore deleted files without immediately freeing their data blocks. Recovery entries are stored in a dedicated B-tree, separate from the inode tree, and remain valid until they are purged manually or by retention policies.

Member Data Documentation

◆ block_count

uint32_t rec_entry_t::block_count

Number of blocks allocated to the file at deletion time.

◆ btree_root

uint32_t rec_entry_t::btree_root

Root block number of the B-tree containing additional block spans for large files. Preserved so that the full file data mapping can be recovered.

◆ deleted_at

uint64_t rec_entry_t::deleted_at

Timestamp of when the file was deleted, in Unix time (seconds since epoch). Used for listing recovery entries chronologically and for retention checks.

◆ direct_blocks

bspan_t rec_entry_t::direct_blocks[16]

Snapshot of the inode's 16 direct block spans, pointing to the physical blocks used by the file. Preserved to allow block reuse during restoration.

◆ file_size

uint32_t rec_entry_t::file_size

Total logical size of the file in bytes at deletion time.

◆ file_type

uint8_t rec_entry_t::file_type

Type of the file at deletion (e.g., regular file, directory, symlink). Uses the same enum/constant values as inode_t::file_type.

◆ gid

uint16_t rec_entry_t::gid

Group ID of the file owner at deletion time.

◆ inode_number

uint32_t rec_entry_t::inode_number

Inode number of the deleted file. Can be reused when restoring the file to simplify consistency with previous references.

◆ original_name

char rec_entry_t::original_name[256]

Original file name at deletion time. Used when restoring the file or displaying it in recovery listings.

◆ original_parent_ino

uint32_t rec_entry_t::original_parent_ino

Inode number of the original parent directory where the file resided. Useful for restoring the file to its original location, if available.

◆ permissions

uint16_t rec_entry_t::permissions

File permissions (e.g., 0755 format), copied from the inode at deletion.

◆ recovery_id

uint32_t rec_entry_t::recovery_id

Unique identifier for this recovery entry, assigned sequentially or uniquely at deletion time. Used by user-facing recovery commands (e.g., listing and restoring deleted files).

◆ retention_until

uint64_t rec_entry_t::retention_until

Timestamp until which this recovery entry is retained, in Unix time. After this point, a garbage collector may safely purge the entry and release its data blocks back to the free space pool.

◆ uid

uint16_t rec_entry_t::uid

User ID of the file owner at deletion time.


The documentation for this struct was generated from the following file: