Retro Rocket Kernel
BASIC-Powered Operating System
fat32.h File Reference
#include "kernel.h"

Data Structures

struct  fat32_fs_info_t
 FAT32 FSINFO structure. More...
 
struct  fat32_t
 FAT32 filesystem information, used internally by the driver. This is a higher level version of FSINFO. More...
 
struct  directory_entry_t
 A directory entry, e.g. file, volume label, directory, long filename entry. More...
 
struct  parameter_block_t
 FAT32 BIOS parameter block (BPB), stored in the boot sector of the drive. More...
 
struct  lfn_t
 Long filename entry, overlays a directory_entry_t. These entries repeat before a non-lfn entry, each holding up to 13 UCS-2 characters. Note that they are not stored in order, the 'order' attribute indicates which order they go in. More...
 

Macros

#define FAT32_SIGNATURE   0x41615252
 FAT32 FSINFO sector signature. More...
 
#define FAT32_SIGNATURE2   0x61417272
 
#define FAT32_SIGNATURE3   0xAA550000
 
#define ATTR_READ_ONLY   0x01
 
#define ATTR_HIDDEN   0x02
 
#define ATTR_SYSTEM   0x04
 
#define ATTR_VOLUME_ID   0x08
 
#define ATTR_DIRECTORY   0x10
 
#define ATTR_ARCHIVE   0x20
 
#define ATTR_LONG_NAME   0x0F
 
#define ATTR_LFN_DELETED   0x80
 
#define ATTR_LFN_LAST_ENTRY   0x40
 
#define DELETED_ENTRY   0xE5
 
#define CLUSTER_END   0x0FFFFFF8
 
#define CLUSTER_BAD   0x0FFFFFF7
 
#define CLUSTER_FREE   0x00000000
 
#define GPT_EFI_SYSTEM   "28732AC1-1FF8-D211-BA4B-00A0C93EC93B"
 EFI system partition GUID. More...
 
#define GPT_MICROSOFT_BASIC_DATA   "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"
 Microsoft basic data partition GUID. More...
 

Functions

struct fat32_fs_info_t __attribute__ ((packed)) fat32_fs_info_t
 FAT32 FSINFO structure. More...
 
void init_fat32 ()
 Register fat32 as a filesystem type. More...
 

Variables

uint32_t signature1
 
char reserved1 [480]
 
uint32_t structsig
 
uint32_t freecount
 
uint32_t nextfree
 
char reserved2 [12]
 
uint32_t trailsig
 
char name [11]
 
uint8_t attr
 
uint8_t nt
 
uint8_t create_time_tenths
 
uint16_t create_time
 
uint16_t create_date
 
uint16_t access_date
 
uint16_t first_cluster_hi
 
uint16_t write_time
 
uint16_t write_date
 
uint16_t first_cluster_lo
 
uint32_t size
 
uint8_t code1
 
uint8_t code2
 
uint8_t code3
 
char oemidentifier [8]
 
uint16_t bytespersector
 
uint8_t sectorspercluster
 
uint16_t reservedsectors
 
uint8_t numberoffats
 
uint16_t numberofdirentries
 
uint16_t totalsectors
 
uint8_t mediatype
 
uint16_t unusedsectorsperfat
 
uint16_t sectorspertrack
 
uint16_t numberofheads
 
uint32_t hiddensectors
 
uint32_t sectorsonmedia
 
uint32_t sectorsperfat
 
uint16_t flags
 
uint16_t fatversion
 
uint32_t rootdircluster
 
uint16_t fsinfocluster
 
uint16_t backupbootsectorcluster
 
char reserved [12]
 
uint8_t drivenumber
 
uint8_t ntflags
 
uint8_t signature
 
uint32_t serialnumber
 
char volumelabel [11]
 
char systemid [9]
 
uint8_t order
 Note the order is arbitrary. It may have the value 0, 3, 65, 48... No way to know! To work around this weirdness, we have an array of lfn_t[256] that holds all possible entries ordered by the order value, which we can then iterate once we encounter a non-lfn to build the name. More...
 
uint16_t first [5]
 
uint8_t attributes
 
uint8_t entry_type
 
uint8_t checksum
 
uint16_t second [6]
 
uint16_t third [2]
 

Detailed Description

Author
Craig Edwards (craig.nosp@m.edwa.nosp@m.rds@b.nosp@m.rain.nosp@m.box.c.nosp@m.c)

Macro Definition Documentation

◆ ATTR_ARCHIVE

#define ATTR_ARCHIVE   0x20

◆ ATTR_DIRECTORY

#define ATTR_DIRECTORY   0x10

◆ ATTR_HIDDEN

#define ATTR_HIDDEN   0x02

◆ ATTR_LFN_DELETED

#define ATTR_LFN_DELETED   0x80

◆ ATTR_LFN_LAST_ENTRY

#define ATTR_LFN_LAST_ENTRY   0x40

◆ ATTR_LONG_NAME

#define ATTR_LONG_NAME   0x0F

◆ ATTR_READ_ONLY

#define ATTR_READ_ONLY   0x01

◆ ATTR_SYSTEM

#define ATTR_SYSTEM   0x04

◆ ATTR_VOLUME_ID

#define ATTR_VOLUME_ID   0x08

◆ CLUSTER_BAD

#define CLUSTER_BAD   0x0FFFFFF7

◆ CLUSTER_END

#define CLUSTER_END   0x0FFFFFF8

◆ CLUSTER_FREE

#define CLUSTER_FREE   0x00000000

◆ DELETED_ENTRY

#define DELETED_ENTRY   0xE5

◆ FAT32_SIGNATURE

#define FAT32_SIGNATURE   0x41615252

FAT32 FSINFO sector signature.

◆ FAT32_SIGNATURE2

#define FAT32_SIGNATURE2   0x61417272

◆ FAT32_SIGNATURE3

#define FAT32_SIGNATURE3   0xAA550000

◆ GPT_EFI_SYSTEM

#define GPT_EFI_SYSTEM   "28732AC1-1FF8-D211-BA4B-00A0C93EC93B"

EFI system partition GUID.

◆ GPT_MICROSOFT_BASIC_DATA

#define GPT_MICROSOFT_BASIC_DATA   "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"

Microsoft basic data partition GUID.

Function Documentation

◆ __attribute__()

struct fat32_fs_info_t __attribute__ ( (packed)  )

FAT32 FSINFO structure.

Long filename entry, overlays a directory_entry_t. These entries repeat before a non-lfn entry, each holding up to 13 UCS-2 characters. Note that they are not stored in order, the 'order' attribute indicates which order they go in.

FAT32 BIOS parameter block (BPB), stored in the boot sector of the drive.

A directory entry, e.g. file, volume label, directory, long filename entry.

◆ init_fat32()

void init_fat32 ( )

Register fat32 as a filesystem type.

Variable Documentation

◆ access_date

uint16_t access_date

◆ attr

uint8_t attr

◆ attributes

uint8_t attributes

◆ backupbootsectorcluster

uint16_t backupbootsectorcluster

◆ bytespersector

uint16_t bytespersector

◆ checksum

uint8_t checksum

◆ code1

uint8_t code1

◆ code2

uint8_t code2

◆ code3

uint8_t code3

◆ create_date

uint16_t create_date

◆ create_time

uint16_t create_time

◆ create_time_tenths

uint8_t create_time_tenths

◆ drivenumber

uint8_t drivenumber

◆ entry_type

uint8_t entry_type

◆ fatversion

uint16_t fatversion

◆ first

uint16_t first[5]

◆ first_cluster_hi

uint16_t first_cluster_hi

◆ first_cluster_lo

uint16_t first_cluster_lo

◆ flags

uint16_t flags

◆ freecount

uint32_t freecount

◆ fsinfocluster

uint16_t fsinfocluster

◆ hiddensectors

uint32_t hiddensectors

◆ mediatype

uint8_t mediatype

◆ name

char name[11]

◆ nextfree

uint32_t nextfree

◆ nt

uint8_t nt

◆ ntflags

uint8_t ntflags

◆ numberofdirentries

uint16_t numberofdirentries

◆ numberoffats

uint8_t numberoffats

◆ numberofheads

uint16_t numberofheads

◆ oemidentifier

char oemidentifier[8]

◆ order

uint8_t order

Note the order is arbitrary. It may have the value 0, 3, 65, 48... No way to know! To work around this weirdness, we have an array of lfn_t[256] that holds all possible entries ordered by the order value, which we can then iterate once we encounter a non-lfn to build the name.

◆ reserved

uint16_t reserved

◆ reserved1

char reserved1[480]

◆ reserved2

char reserved2[12]

◆ reservedsectors

uint16_t reservedsectors

◆ rootdircluster

uint32_t rootdircluster

◆ second

uint16_t second[6]

◆ sectorsonmedia

uint32_t sectorsonmedia

◆ sectorspercluster

uint8_t sectorspercluster

◆ sectorsperfat

uint32_t sectorsperfat

◆ sectorspertrack

uint16_t sectorspertrack

◆ serialnumber

uint32_t serialnumber

◆ signature

uint8_t signature

◆ signature1

uint32_t signature1

◆ size

uint32_t size

◆ structsig

uint32_t structsig

◆ systemid

char systemid[9]

◆ third

uint16_t third[2]

◆ totalsectors

uint16_t totalsectors

◆ trailsig

uint32_t trailsig

◆ unusedsectorsperfat

uint16_t unusedsectorsperfat

◆ volumelabel

char volumelabel[11]

◆ write_date

uint16_t write_date

◆ write_time

uint16_t write_time