Max OS 0.3
Loading...
Searching...
No Matches
fat32.h File Reference

Defines structures and constants for the File Allocation Table 32 (FAT32) filesystem format and the relevant Filesystem, Directory and File classes. More...

#include <cstdint>
#include <common/macros.h>
#include <drivers/disk/disk.h>
#include <filesystem/filesystem.h>

Go to the source code of this file.

Classes

struct  MaxOS::filesystem::format::BiosParameterBlock32
 Stores information about the FAT32 filesystem. More...
 
struct  MaxOS::filesystem::format::FSInfo
 Stores extra information about the FAT32 filesystem. More...
 
struct  MaxOS::filesystem::format::DirectoryEntry
 Stores information about a file or directory. More...
 
struct  MaxOS::filesystem::format::LongFileNameEntry
 Directory entry for a long file name. More...
 
class  MaxOS::filesystem::format::Fat32Volume
 Handles the FAT table that stores the information about the files on the disk and operations on the disk. More...
 
class  MaxOS::filesystem::format::Fat32File
 Handles the file operations on the FAT32 filesystem. More...
 
class  MaxOS::filesystem::format::Fat32Directory
 Handles the directory operations on the FAT32 filesystem. More...
 
class  MaxOS::filesystem::format::Fat32FileSystem
 Handles the FAT32 filesystem operations. More...
 

Typedefs

typedef struct PACKED MaxOS::filesystem::format::BiosParameterBlock32 MaxOS::filesystem::format::bpb32_t
 Alias for BiosParameterBlock32 struct.
 
typedef struct PACKED MaxOS::filesystem::format::FSInfo MaxOS::filesystem::format::fs_info_t
 Alias for FSInfo struct.
 
typedef struct PACKED MaxOS::filesystem::format::DirectoryEntry MaxOS::filesystem::format::dir_entry_t
 Alias for DirectoryEntry struct.
 
typedef struct PACKED MaxOS::filesystem::format::LongFileNameEntry MaxOS::filesystem::format::long_file_name_entry_t
 Alias for LongFileNameEntry struct.
 

Enumerations

enum class  MaxOS::filesystem::format::DirectoryEntryAttributes {
  FREE = 0x00 , READ_ONLY = 0x01 , HIDDEN = 0x02 , SYSTEM = 0x04 ,
  VOLUME_ID = 0x08 , DIRECTORY = 0x10 , ARCHIVE = 0x20 , LONG_NAME = READ_ONLY | HIDDEN | SYSTEM | VOLUME_ID
}
 Flags for a directory entry in a FAT32 System. More...
 
enum class  MaxOS::filesystem::format::DirectoryEntryType { LAST = 0x00 , FREE = 0xE5 }
 The type of a directory entry. More...
 
enum class  MaxOS::filesystem::format::ClusterState : uint32_t { FREE = 0x00000000 , BAD = 0x0FFFFFF7 , END_OF_CHAIN = 0xFFFFFFFF }
 The state of a cluster in the FAT32 filesystem. More...
 

Variables

constexpr uint16_t MaxOS::filesystem::format::MAX_NAME_LENGTH = 255
 Highest number of characters in a file/directory name.
 

Detailed Description

Defines structures and constants for the File Allocation Table 32 (FAT32) filesystem format and the relevant Filesystem, Directory and File classes.

Date
1st January 2023
Author
Max Tyson
Todo:

BUG: Subdirectory seems to write to the disk this end but tools like fatcat complain the that the EOC isn't written (cluster 3037)

Implment: create/delete/rename files & directories

Definition in file fat32.h.

Enumeration Type Documentation

◆ ClusterState

enum class MaxOS::filesystem::format::ClusterState : uint32_t
strong

The state of a cluster in the FAT32 filesystem.

Definition at line 158 of file fat32.h.

158 : uint32_t {
159 FREE = 0x00000000,
160 BAD = 0x0FFFFFF7,
161 END_OF_CHAIN = 0xFFFFFFFF,
162 };

◆ DirectoryEntryAttributes

Flags for a directory entry in a FAT32 System.

Definition at line 115 of file fat32.h.

115 {
116 FREE = 0x00,
117 READ_ONLY = 0x01,
118 HIDDEN = 0x02,
119 SYSTEM = 0x04,
120 VOLUME_ID = 0x08,
121 DIRECTORY = 0x10,
122 ARCHIVE = 0x20,
123 LONG_NAME = READ_ONLY | HIDDEN | SYSTEM | VOLUME_ID,
124 };

◆ DirectoryEntryType

The type of a directory entry.

Definition at line 130 of file fat32.h.

130 {
131 LAST = 0x00,
132 FREE = 0xE5,
133 };

Variable Documentation

◆ MAX_NAME_LENGTH

constexpr uint16_t MaxOS::filesystem::format::MAX_NAME_LENGTH = 255
constexpr

Highest number of characters in a file/directory name.

Definition at line 165 of file fat32.h.

Referenced by MaxOS::filesystem::format::Fat32Directory::create_file(), and MaxOS::filesystem::format::Fat32Directory::create_subdirectory().