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

Implementation of superblock manipulation functions in the BSFS file system. More...

Functions

int write_superblock (FILE *disk, const superblock_t *sb)
 Writes the superblock to block 0 of the filesystem.
int read_superblock (FILE *disk, superblock_t *sb)
 Reads the superblock from block 0 of the filesystem.

Detailed Description

Implementation of superblock manipulation functions in the BSFS file system.

This file contains routines to read and write the superblock, which is located at block 0 of the filesystem and stores essential metadata required to mount and navigate the file system.

Function Documentation

◆ read_superblock()

int read_superblock ( FILE * disk,
superblock_t * sb )

Reads the superblock from block 0 of the filesystem.

Parameters
diskPointer to the open filesystem image (disk).
sbPointer to the superblock structure to populate.
Returns
0 on success, -1 on failure.

◆ write_superblock()

int write_superblock ( FILE * disk,
const superblock_t * sb )

Writes the superblock to block 0 of the filesystem.

Parameters
diskPointer to the open filesystem image (disk).
sbPointer to the superblock structure to write.
Returns
0 on success, -1 on failure.