WKern
Loading...
Searching...
No Matches
fat16_mnt.c File Reference
#include <fileio/fileio.h>
#include <io/kio.h>

Go to the source code of this file.

Functions

u32 Fat16TotalClusters (struct FaT16Info *fat)
 Calculate the total number of data clusters in a FAT16 filesystem.
u32 Fat16Mount (u32 partition_lba)
 Mounts the FAT16 filesystem from a given partition LBA.

Variables

struct FaT16Info fat16
 Holds FAT16 filesystem info and a sector buffer.

Function Documentation

◆ Fat16Mount()

u32 Fat16Mount ( u32 partition_lba)

Mounts the FAT16 filesystem from a given partition LBA.

Mounts FAT16 partition and reads filesystem info.

Reads the boot sector, validates the FAT16 signature, and initializes the FAT16 info struct with important filesystem layout details.

Parameters
partition_lbaLogical block address of the FAT16 partition.
Returns
1 on success, 0 on failure (invalid boot sector signature).

Prints mount status and key filesystem layout info via Kprintf.

Definition at line 67 of file fat16_mnt.c.

◆ Fat16TotalClusters()

u32 Fat16TotalClusters ( struct FaT16Info * fat)

Calculate the total number of data clusters in a FAT16 filesystem.

Parameters
fatPointer to a FaT16Info struct representing the FAT16 filesystem.
Returns
Number of clusters available in the data region.

This calculates clusters by subtracting reserved, FAT, and root directory sectors from the total sectors and dividing by sectors per cluster.

Definition at line 37 of file fat16_mnt.c.

Variable Documentation

◆ fat16

struct FaT16Info fat16

Holds FAT16 filesystem info and a sector buffer.

Global FAT16 filesystem info struct.

Definition at line 25 of file fat16_mnt.c.