|
Basic Solution File System - BSFS
|
Core data structures for the BSFS (Basic Solution File System). More...
Classes | |
| struct | superblock_t |
| Represents the superblock of the BSFS file system. More... | |
| struct | bitmap_block_t |
| Represents a block of the allocation bitmap in the BSFS file system. More... | |
| struct | bspan_t |
| Represents a contiguous span of blocks in the BSFS file system. More... | |
| struct | inode_t |
| Represents an inode in the BSFS file system. More... | |
| struct | rec_entry_t |
| Represents a deleted file entry stored in the recovery B-tree. More... | |
| struct | dir_entry_t |
| Represents a directory entry in the BSFS file system. More... | |
| struct | file_t |
| Represents an open file in memory within the BSFS file system. More... | |
Macros | |
| #define | MAGIC_NUMBER 0x53465342 |
| Magic number used to identify a BSFS-formatted file system. | |
| #define | BLOCK_SIZE 4096 |
| Size of a block in bytes. | |
| #define | MAX_FILENAME 255 |
| Maximum length (in bytes) of a file or directory name. | |
| #define | INODE_SIZE 512 |
| Size of an inode in bytes. | |
| #define | ADDRESSES_PER_BLOCK (BLOCK_SIZE / sizeof(uint32_t)) |
| Number of 32-bit addresses that fit in a block. | |
| #define | BITMAP_BLOCK_BYTES (BLOCK_SIZE - sizeof(uint32_t)) |
| Number of usable bytes for bitmap bits in a bitmap block. | |
| #define | INVALID_BLOCK 0xFFFFFFFF |
| Special value representing an invalid or null block reference. | |
| #define | FILE_TYPE_DIR 1 |
| #define | FILE_TYPE_FILE 2 |
| #define | DEFAULT_RECOVERY_TTL (30ULL * 24ULL * 60ULL * 60ULL) |
Core data structures for the BSFS (Basic Solution File System).
This header file defines the main data structures used by the BSFS file system, both on-disk and in-memory. It includes:
These structures define the foundation of the BSFS layout and behavior, and are used throughout the system for file management, block allocation, recovery, and directory operations.
| #define ADDRESSES_PER_BLOCK (BLOCK_SIZE / sizeof(uint32_t)) |
Number of 32-bit addresses that fit in a block.
Used for indexing and pointer arrays inside blocks. Helper: number of 32-bit addresses per block.
| #define BITMAP_BLOCK_BYTES (BLOCK_SIZE - sizeof(uint32_t)) |
Number of usable bytes for bitmap bits in a bitmap block.
The last 4 bytes of the block are reserved for the next block pointer. Usable bytes in a bitmap block (reserve 4B for next pointer).
| #define BLOCK_SIZE 4096 |
Size of a block in bytes.
All operations in the file system are based on fixed-size blocks. Logical block size in bytes.
| #define DEFAULT_RECOVERY_TTL (30ULL * 24ULL * 60ULL * 60ULL) |
Default retention period for recovery entries (seconds).
| #define FILE_TYPE_DIR 1 |
File type code: directory.
| #define FILE_TYPE_FILE 2 |
File type code: regular file.
| #define INODE_SIZE 512 |
Size of an inode in bytes.
Used when allocating or reading inodes from disk. Size of an inode on disk (bytes).
| #define INVALID_BLOCK 0xFFFFFFFF |
Special value representing an invalid or null block reference.
Sentinel for an invalid or absent block address.
| #define MAGIC_NUMBER 0x53465342 |
Magic number used to identify a BSFS-formatted file system.
Represents the ASCII string "BSFS" encoded as hexadecimal. Magic number used to identify a BSFS image ("BSFS" in hex).
| #define MAX_FILENAME 255 |
Maximum length (in bytes) of a file or directory name.
Does not include the null terminator. Maximum filename length (bytes, excluding NUL).