⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module blockfs

Module blockfs 

Source
Expand description

Block-based persistent filesystem (BlockFS)

A simple ext2-like filesystem with:

  • Superblock with metadata
  • Inode table for file/directory metadata
  • Block allocation bitmap
  • Data blocks for file content

Structs§

BlockBitmap
Block allocation bitmap
BlockFs
BlockFS filesystem
BlockFsInner
Internal BlockFS state
BlockFsNode
BlockFS node implementation
DiskDirEntry
On-disk directory entry (ext2-style variable-length record)
DiskInode
On-disk inode structure
Superblock
Superblock structure
VirtioBlockBackend
Adapter that wraps the global virtio-blk device as a DiskBackend.

Constants§

BLOCKFS_MAGIC
Magic number for BlockFS
BLOCK_SIZE
Block size (4KB)
DIRECT_BLOCKS
Number of direct block pointers in a DiskInode
DIRECT_MAX_BLOCKS
Maximum file size addressable via direct blocks only: 12 * 4KB = 48KB
DIR_ENTRY_HEADER_SIZE
Size of the fixed header in a DiskDirEntry (inode + rec_len + name_len + file_type)
DOUBLE_INDIRECT_MAX_BLOCKS
Maximum file size addressable via direct + single + double indirect: 12 + 1024 + 1024*1024 = 1_049_612 blocks = ~4GB
MAX_FILENAME_LEN
Maximum filename length
PTRS_PER_BLOCK
Number of block pointers that fit in one indirect block (4096 / 4 = 1024)
SINGLE_INDIRECT_MAX_BLOCKS
Maximum file size addressable via direct + single indirect: 12 + 1024 = 1036 blocks = ~4MB

Traits§

DiskBackend
Trait for a block-level disk backend that BlockFS can sync to.

Functions§

attach_virtio_backend
Try to attach the virtio-blk device as a disk backend for the given BlockFS instance. Returns true if a device was found and attached.
init
Initialize BlockFS