TFATFileSystem

From Ultibo.org
Revision as of 04:02, 18 October 2022 by Ultibo (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Return to Unit FATFS


Description


To be documented

Class definitions



TFATFileSystem = class(TFileSystem)

constructor Create(ADriver:TFileSysDriver; AVolume:TDiskVolume; ADrive:TDiskDrive);  
destructor Destroy; override;  
private
FFATType:TFATType;  
FCaseFlags:Boolean; Allow writing entries with the Lowercase Flags set (Reading is always supported)
FVolumeFlags:LongWord; Volume Dirty/Error flags
 
FInfoSectorEnable:Boolean; Enable use of FAT32 info sector for free cluster count and next free cluster
FInfoImmediateUpdate:Boolean; Enable immediate update of FAT32 info sector on allocate or release of clusters
 
FEndOfFile:LongWord;  
FEndOfCluster:LongWord;  
FFreeCluster:LongWord;  
FBadCluster:LongWord;  
FMediaCluster:LongWord;  
FStartCluster:LongWord;  
 
FHardError:LongWord;  
FCleanShutdown:LongWord;  
FReservedBits:LongWord;  
 
FNumberOfFats:Word; Usually 2
FSectorsPerFat:LongWord;  
FSectorsPerCluster:LongWord; Usually 1,2,4,8,16,32,64,128 etc
 
FReservedSectors:LongWord;  
 
FRootEntryCount:LongWord; Number of Directory entries in Root Directory
FRootSectorCount:LongWord; Number of Sectors occupied by Root Directory
FRootStartSector:LongWord; First Sector of Root Directory (Relative to StartSector)
 
FInfoSector:LongWord; Relative to StartSector
FInfoBackup:LongWord; Relative to StartSector
 
FRootStartCluster:LongWord; First Cluster of Root Directory
 
FActiveFat:Word; Zero based number of active FAT (Always 0 for FAT12/16)
FFatMirroring:Boolean; FAT Mirroring Enabled if True (Always True for FAT12/16)
 
FEntriesPerSector:LongWord; Number of Directory entries in a Sector
FEntriesPerCluster:LongWord; Number of Directory entries in a Cluster
 
FEntriesPerBlock:LongWord; Number of FAT entries per Block
FSectorsPerBlock:LongWord; Number of Sectors per Block of FAT entries
 
FBlockShiftCount:Word; Shift count for Cluster <-> BlockNo
FSectorShiftCount:Word; Shift count for Sector <-> Cluster
FClusterShiftCount:Word; Shift count for Cluster <-> Bytes
 
FDataStartSector:LongWord; First Sector of First Data Cluster (Relative to StartSector)
FDataClusterCount:LongWord; Number of usable data clusters
FTotalClusterCount:LongWord; Total number of clusters including reserved clusters
 
FLastFreeCluster:LongWord; Or $FFFFFFFF if not known
FFreeClusterCount:LongWord; Or $FFFFFFFF if not known
 
FClusterSize:LongWord; Size of a Cluster in Bytes (Max 65536 > Word)
 
FInfoBuffer:Pointer; Buffer for info sector handling (Sector size)
FInfoLock:TMutexHandle; Lock for info buffer
 
FNameBuffer:Pointer; Buffer for long name handling
FNameLock:TMutexHandle; Lock for name buffer
 
FReadBuffer:Pointer; Buffer for partial cluster entry reads (Cluster size)
FReadLock:TMutexHandle; Lock for read buffer
 
FWriteBuffer:Pointer; Buffer for partial cluster entry writes (Cluster size)
FWriteLock:TMutexHandle; Lock for write buffer
 
FClusterBuffer:Pointer; Buffer of exactly cluster size
FClusterLock:TMutexHandle; Lock for cluster buffer
 
function InfoLock:Boolean;  
function InfoUnlock:Boolean;  
 
function NameLock:Boolean;  
function NameUnlock:Boolean;  
 
function ReadLock:Boolean;  
function ReadUnlock:Boolean;  
 
function WriteLock:Boolean;  
function WriteUnlock:Boolean;  
 
function ClusterLock:Boolean;  
function ClusterUnlock:Boolean;  
 
function IsRemovable:Boolean;  
 
function GetHardError:Boolean;  
procedure SetHardError(AValue:Boolean);  
 
function GetCleanShutdown:Boolean;  
procedure SetCleanShutdown(AValue:Boolean);  
 
function GetVolumeFlags:LongWord;  
function SetVolumeFlags(AFlags:LongWord):Boolean;  
 
function UpdateInfoSector:Boolean;  
 
function FillCluster(ACluster:LongWord; AValue:Byte):Boolean;  
 
function ReadCluster(ACluster:LongWord; var ABuffer):Boolean;  
function WriteCluster(ACluster:LongWord; const ABuffer):Boolean;  
 
function GetNextFreeCluster:LongWord;  
function GetFreeClusterCount:LongWord;  
 
function SetNextFreeCluster(ACluster:LongWord):Boolean;  
function SetFreeClusterCount(ACount:LongWord):Boolean;  
 
function GetStartCluster(AEntry:TDiskEntry):LongWord;  
function GetParentCluster(AParent:TDiskEntry):LongWord;  
function CheckClusterBlock(ACluster,ANext:LongWord):Boolean;  
 
function GetNextChainCluster(AParent:LongWord):LongWord;  
function GetLastChainCluster(AParent:LongWord):LongWord;  
function GetChainClusterCount(AParent:LongWord):LongWord;  
 
function GetCluster(ACluster:LongWord):LongWord;  
function SetCluster(ACluster,AValue:LongWord;ACommit:Boolean):Boolean;  
 
function AllocCluster(AParent:LongWord; var ACluster:LongWord; ACount:LongWord):Boolean;  
function ReleaseCluster(AParent,ACluster:LongWord):Boolean;  
 
function CheckDirectoryRoot(AParent:TDiskEntry):Boolean;  
function CheckDirectoryStart(AParent:TDiskEntry):Boolean;  
 
function GetFirstDirectorySector(AParent:TDiskEntry; var ASector:LongWord):Boolean;  
function GetNextDirectorySector(AParent:TDiskEntry; var ASector:LongWord; AWrite:Boolean):Boolean;  
function GetDirectorySectorCount(AParent:TDiskEntry; AWrite:Boolean):LongWord;  
function GetDirectorySectorOffset(AParent:TDiskEntry):LongWord;  
 
function AllocDirectory(AParent:TDiskEntry; ACount:Byte; var AOffset,ASector:LongWord):Boolean;  
function ReleaseDirectory(AParent:TDiskEntry; ACount:Byte; AOffset,ASector:LongWord):Boolean;  
 
function GetBlockShiftCount(ASize:Word;AType:TFATType):Word;  
function GetSectorShiftCount(ASectorsPerCluster:LongWord):Word;  
function GetClusterShiftCount(AClusterSize:LongWord):Word;  
 
function GetEntriesPerBlock(ASize:Word; AType:TFATType):LongWord;  
function GetSectorsPerBlock(ASize:Word; AType:TFATType):LongWord;  
 
procedure ReadConvert(ADirectory:PFATDirectory);  
procedure WriteConvert(ADirectory:PFATDirectory);  
 
function NameToEntry(AName:Pointer; AEntry:TFATDiskEntry; AShort:Boolean):Boolean;  
function EntryToName(AEntry:TFATDiskEntry; AName:Pointer; AShort:Boolean):Boolean;  
 
function BufferToName(ABuffer:Pointer; var AName:String):Boolean;  
function NameToBuffer(const AName:String; ABuffer:Pointer):Boolean;  
 
function DirectoryToBuffer(ADirectory,ABuffer:Pointer; ACount,AChecksum:Byte; ALast:Boolean):Boolean;  
function BufferToDirectory(ABuffer,ADirectory:Pointer; ACount,AChecksum:Byte; ALast:Boolean):Boolean;  
 
function DirectoryToEntry(ADirectory:Pointer; AEntry:TFATDiskEntry; AShort:Boolean):Boolean;  
function EntryToDirectory(AEntry:TFATDiskEntry; ADirectory:Pointer; AShort:Boolean):Boolean;  
 
function FATTypeToFileSysType(AFATType:TFATType):TFileSysType;  
protected
function LoadMaxFile:Integer; override;  
function LoadMaxPath:Integer; override;  
function LoadAttributes:LongWord; override;  
function LoadMaxAttributes:LongWord; override;  
function LoadMinFileTime:TFileTime; override;  
function LoadSystemName:String; override;  
function LoadVolumeName:String; override;  
function LoadVolumeSerial:LongWord; override;  
function LoadFileSysType:TFileSysType; override;  
 
function SetVolumeName(const AName:String):Boolean;  
function SetVolumeSerial(ASerial:LongWord):Boolean;  
 
function ReadEntry(AParent,AEntry:TDiskEntry; var ABuffer; const AStart:Int64; ACount:LongWord; var AOffset,AValue:LongWord):Integer; override;  
function WriteEntry(AParent,AEntry:TDiskEntry; const ABuffer; const AStart:Int64; ACount:LongWord; var AOffset,AValue:LongWord):Integer; override;  
 
function LoadTables:Boolean; override;  
function LoadBlocks:Boolean; override;  
function LoadEntries(AParent:TDiskEntry):Boolean; override;  
 
function LoadTable(ATableNo:LongWord):Boolean; override;  
function LoadBlock(ABlockNo:LongWord):Boolean; override;  
function LoadEntry(AParent:TDiskEntry; ABuffer:Pointer; var ABlockOffset,AEntryOffset,ABlockSector,AEntrySector:LongWord):Boolean; Not override
function LoadLong(AParent:TDiskEntry; ABuffer:Pointer; var ABlockOffset,AEntryOffset,ABlockSector,AEntrySector:LongWord):Boolean; Not override
 
function AddEntry(AParent:TDiskEntry; const AName:String; AAttributes:LongWord; AReference:Boolean):TDiskEntry; override;  
function AddEntryEx(AParent:TDiskEntry; const AName,AAltName:String; AAttributes:LongWord; AReference:Boolean):TDiskEntry; override;  
function RemoveEntry(AParent,AEntry:TDiskEntry):Boolean; override;  
function RenameEntry(AParent,AEntry:TDiskEntry; const AName:String):Boolean; override;  
function RenameEntryEx(AParent,AEntry:TDiskEntry; const AAltName:String):Boolean; override;  
function MoveEntry(ASource,ADest,AEntry:TDiskEntry):Boolean; override;  
 
function SetBlock(ABlock:TDiskBlock):Boolean; override;  
function SetEntry(AParent,AEntry:TDiskEntry):Boolean; override;  
function SetLong(AParent,AEntry:TDiskEntry):Boolean; {Not override}  
 
function SizeEntry(AParent,AEntry:TDiskEntry; const ASize:Int64):Boolean; override;  
 
function GetBlock(ABlockNo:LongWord):TDiskBlock; override;  
function GetBlockEx(ABlockNo:LongWord; AWrite:Boolean):TDiskBlock; override;  
 
function CheckName(const AName:String):Boolean; override;  
function CountName(const AName:String):Byte;  
function CompareName(const AName,AMatch:String; AWildcard:Boolean):Boolean; override;  
function ChecksumName(AEntry:TDiskEntry):Byte;  
function GenerateName(AParent,AEntry:TDiskEntry; const AName:String):String;  
 
function GetNameFlags(const AName:String):LongWord;  
function CheckFlagName(const AName:String):Boolean;  
 
function ValidateName(AName:Pointer):Boolean;  
function ValidateDirectory(ADirectory:Pointer):Boolean;  
public
property CaseFlags:Boolean read FCaseFlags write FCaseFlags;  
property OemConvert:Boolean read FOemConvert write FOemConvert;  
property NumericTail:Boolean read FNumericTail write FNumericTail;  
 
property ReadOnly:Boolean read FReadOnly write FReadOnly;  
property LongNames:Boolean read FLongNames write FLongNames;  
property CasePreserved:Boolean read FCasePreserved write FCasePreserved;  
property UnicodeNames:Boolean read FUnicodeNames write FUnicodeNames;  
 
property InfoSectorEnable:Boolean read FInfoSectorEnable write FInfoSectorEnable;  
property InfoImmediateUpdate:Boolean read FInfoImmediateUpdate write FInfoImmediateUpdate;  
 
property HardError:Boolean read GetHardError write SetHardError;  
property CleanShutdown:Boolean read GetCleanShutdown write SetCleanShutdown;  
 
function FileSystemInit:Boolean; override;  
 
function MountFileSystem:Boolean; override;  
function DismountFileSystem:Boolean; override;  
function InitializeFileSystem(ASectorsPerCluster:LongWord; AFileSysType:TFileSysType):Boolean; override;  
 
function GetDriveLabel:String; override;  
function SetDriveLabel(const ALabel:String):Boolean; override;  
function SetDriveSerial(ASerial:LongWord):Boolean; override;  
 
function GetDriveFreeSpaceEx:Int64; override;  
function GetDriveTotalSpaceEx:Int64; override;  
 
function GetDriveInformation(var AClusterSize:LongWord; var ATotalClusterCount,AFreeClusterCount:Int64):Boolean; override;  


Function declarations



constructor TFATFileSystem.Create(ADriver:TFileSysDriver; AVolume:TDiskVolume; ADrive:TDiskDrive);
Description: To be documented
Note None documented


destructor TFATFileSystem.Destroy;
Description: To be documented
Note None documented


function TFATFileSystem.InfoLock:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.InfoUnlock:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.NameLock:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.NameUnlock:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.ReadLock:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.ReadUnlock:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.WriteLock:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.WriteUnlock:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.ClusterLock:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.ClusterUnlock:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.IsRemovable:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.GetHardError:Boolean;
Description: To be documented
Note Bit is on for Good and off for Error. Opposite to CleanShutdown.


procedure TFATFileSystem.SetHardError(AValue:Boolean);
Description: To be documented
Note Bit is on for Good and off for Error. Opposite to CleanShutdown.


function TFATFileSystem.GetCleanShutdown:Boolean;
Description: To be documented
Note Bit is on for Clean and off for Dirty. Opposite to HardError.


procedure TFATFileSystem.SetCleanShutdown(AValue:Boolean);
Description: To be documented
Note Bit is on for Clean and off for Dirty. Opposite to HardError.


function TFATFileSystem.GetVolumeFlags:LongWord;
Description: Get the volume flags from cluster zero of the FAT
Note None documented


function TFATFileSystem.SetVolumeFlags(AFlags:LongWord):Boolean;
Description: Set the volume flags in cluster zero of the FAT
Note None documented


function TFATFileSystem.UpdateInfoSector:Boolean;
Description: Update the FAT32 Info Sector with current values
Note None documented


function TFATFileSystem.FillCluster(ACluster:LongWord; AValue:Byte):Boolean;
Description: Fill one cluster with the supplied value
Note None documented


function TFATFileSystem.ReadCluster(ACluster:LongWord; var ABuffer):Boolean;
Description: Read one Cluster from the Volume or Drive using Cache
Note Performs conversion of Cluster to Sector based on Offsets

Sector is relative to StartSector and DataStartSector of the FileSystem


function TFATFileSystem.WriteCluster(ACluster:LongWord; const ABuffer):Boolean;
Description: Write one Cluster to the Volume or Drive using Cache
Note Performs conversion of Cluster to Sector based on Offsets

Sector is relative to StartSector and DataStartSector of the FileSystem


function TFATFileSystem.GetNextFreeCluster:LongWord;
Description: To be documented
Note For speed does direct FAT lookup instead of GetCluster

For speed uses the LastFreeCluster after first lookup


function TFATFileSystem.GetFreeClusterCount:LongWord;
Description: To be documented
Note For speed does direct FAT lookup instead of GetCluster

For speed uses the FreeClusterCount after first lookup


function TFATFileSystem.SetNextFreeCluster(ACluster:LongWord):Boolean;
Description: Sets the last free cluster in the info sector on FAT32
Note None documented


function TFATFileSystem.SetFreeClusterCount(ACount:LongWord):Boolean;
Description: Sets the free cluster count in the info sector on FAT32
Note None documented


function TFATFileSystem.GetStartCluster(AEntry:TDiskEntry):LongWord;
Description: Get the starting cluster number or zero for FAT12/16 root
Note Handles FAT12/16 Root special case

Differs from GetParentCluster below. Used by AllocDirectory.
The Root entry on FAT32 has an actual Start cluster unlike FAT12/16


function TFATFileSystem.GetParentCluster(AParent:TDiskEntry):LongWord;
Description: Get the starting cluster number of the supplied parent or zero for root
Note Handles FAT12/16 Root special case

Differs from GetStartCluster above. Used by AddEntry.
The DotDot entry must always point to zero for Root even on FAT32


function TFATFileSystem.CheckClusterBlock(ACluster,ANext:LongWord):Boolean;
Description: Check if 2 clusters are in the same block for SetCluster commit
Note None documented


function TFATFileSystem.GetNextChainCluster(AParent:LongWord):LongWord;
Description: Get the next cluster in the chain after the supplied cluster
Note Returns zero on end of chain or error


function TFATFileSystem.GetLastChainCluster(AParent:LongWord):LongWord;
Description: Get the last cluster in the chain of the supplied cluster
Note Returns zero on error or parent on end of chain


function TFATFileSystem.GetChainClusterCount(AParent:LongWord):LongWord;
Description: Get the cluster count in the chain of the supplied cluster
Note Returns zero on error


function TFATFileSystem.GetCluster(ACluster:LongWord):LongWord;
Description: To be documented
Note None documented


function TFATFileSystem.SetCluster(ACluster,AValue:LongWord; ACommit:Boolean):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.AllocCluster(AParent:LongWord; var ACluster:LongWord; ACount:LongWord):Boolean;
Description: Allocate count clusters from next free
Note Add to the parent chain if supplied


function TFATFileSystem.ReleaseCluster(AParent,ACluster:LongWord):Boolean;
Description: Release this cluster and all clusters to the end of the chain
Note Update the parent cluster if supplied


function TFATFileSystem.CheckDirectoryRoot(AParent:TDiskEntry):Boolean;
Description: Check for the FAT12/16 Root directory
Note Handles FAT12/16 Root special case


function TFATFileSystem.CheckDirectoryStart(AParent:TDiskEntry):Boolean;
Description: Check that the start cluster/sector of the directory is valid
Note Handles FAT12/16 Root special case


function TFATFileSystem.GetFirstDirectorySector(AParent:TDiskEntry; var ASector:LongWord):Boolean;
Description: Returns the First Sector of the Directory entries for the parent
Note Handles FAT12/16 Root special case


function TFATFileSystem.GetNextDirectorySector(AParent:TDiskEntry; var ASector:LongWord; AWrite:Boolean):Boolean;
Description: Returns the Next Sector of the Directory entries for the parent
Note Handles FAT12/16 Root special case


function TFATFileSystem.GetDirectorySectorCount(AParent:TDiskEntry; AWrite:Boolean):LongWord;
Description: Returns the Sector Count per block of Directory entries for the parent
Note Handles FAT12/16 Root special case


function TFATFileSystem.GetDirectorySectorOffset(AParent:TDiskEntry):LongWord;
Description: Returns the Sector Offset of Directory entries for the parent
Note Handles FAT12/16 Root special case


function TFATFileSystem.AllocDirectory(AParent:TDiskEntry; ACount:Byte; var AOffset,ASector:LongWord):Boolean;
Description: Allocate Count contiguous Directories from free in the Parent entries
Note Allocate new Cluster if no free available (and not FAT12/16 Root)

Offset and Sector are undefined on call
Offset and Sector point to the first directory entry on return


function TFATFileSystem.ReleaseDirectory(AParent:TDiskEntry; ACount:Byte; AOffset,ASector:LongWord):Boolean;
Description: Release Count contiguous Directories to free in the Parent entries
Note Offset and Sector point to the first directory entry on call


function TFATFileSystem.GetBlockShiftCount(ASize:Word; AType:TFATType):Word;
Description: From the table get the block shift count value for this sector size
Note None documented


function TFATFileSystem.GetSectorShiftCount(ASectorsPerCluster:LongWord):Word;
Description: Calculate the sector shift count for sector to cluster conversion
Note None documented


function TFATFileSystem.GetClusterShiftCount(AClusterSize:LongWord):Word;
Description: Calculate the cluster shift count for cluster to bytes conversion
Note None documented


function TFATFileSystem.GetEntriesPerBlock(ASize:Word; AType:TFATType):LongWord;
Description: From the table get the entries per block value for this sector size
Note None documented


function TFATFileSystem.GetSectorsPerBlock(ASize:Word; AType:TFATType):LongWord;
Description: From the table get the sectors per block value for this sector size
Note None documented


procedure TFATFileSystem.ReadConvert(ADirectory:PFATDirectory);
Description: To be documented
Note None documented


procedure TFATFileSystem.WriteConvert(ADirectory:PFATDirectory);
Description: To be documented
Note None documented


function TFATFileSystem.NameToEntry(AName:Pointer; AEntry:TFATDiskEntry; AShort:Boolean):Boolean;
Description: Loads an Entry from a Name
Note Should only be called by DirectoryToEntry


function TFATFileSystem.EntryToName(AEntry:TFATDiskEntry; AName:Pointer; AShort:Boolean):Boolean;
Description: Loads a Name from an Entry
Note Should only be called by EntryToDirectory and ChecksumName


function TFATFileSystem.BufferToName(ABuffer:Pointer; var AName:String):Boolean;
Description: Converts a Long Name Buffer to a String
Note Should only be called by LoadLong


function TFATFileSystem.NameToBuffer(const AName:String; ABuffer:Pointer):Boolean;
Description: Converts a String to a Long Name Buffer
Note Should only be called by SetLong


function TFATFileSystem.DirectoryToBuffer(ADirectory,ABuffer:Pointer; ACount,AChecksum:Byte; ALast:Boolean):Boolean;
Description: Loads a Long Name buffer from a Directory entry
Note Should only be called by LoadLong

Caller must check the lfnEntryLast flag


function TFATFileSystem.BufferToDirectory(ABuffer,ADirectory:Pointer; ACount,AChecksum:Byte; ALast:Boolean):Boolean;
Description: Loads a Directory entry from a Long Name Buffer
Note Should only be called by SetLong


function TFATFileSystem.DirectoryToEntry(ADirectory:Pointer; AEntry:TFATDiskEntry; AShort:Boolean):Boolean;
Description: Loads an Entry from a Directory entry
Note Should only be called by LoadEntry and LoadLong


function TFATFileSystem.EntryToDirectory(AEntry:TFATDiskEntry; ADirectory:Pointer; AShort:Boolean):Boolean;
Description: Loads a Directory entry from an Entry
Note Should only be called by SetEntry and SetLong


function TFATFileSystem.FATTypeToFileSysType(AFATType:TFATType):TFileSysType;
Description: To be documented
Note None documented


function TFATFileSystem.LoadMaxFile:Integer;
Description: To be documented
Note None documented


function TFATFileSystem.LoadMaxPath:Integer;
Description: To be documented
Note None documented


function TFATFileSystem.LoadAttributes:LongWord;
Description: To be documented
Note None documented


function TFATFileSystem.LoadMaxAttributes:LongWord;
Description: Load the Maximum File Attributes (FileSetAttr)
Note None documented


function TFATFileSystem.LoadMinFileTime:TFileTime; override;
Description: Load the Minimum File Time value (WriteTime/CreateTime/AccessTime)
Note None documented


function TFATFileSystem.LoadSystemName:String;
Description: Load System Name from Boot Sector
Note None documented


function TFATFileSystem.LoadVolumeName:String;
Description: Load Volume Name from Boot Sector
Note None documented


function TFATFileSystem.LoadVolumeSerial:LongWord;
Description: Load Volume Serial from Boot Sector
Note None documented


function TFATFileSystem.LoadFileSysType:TFileSysType;
Description: To be documented
Note None documented


function TFATFileSystem.SetVolumeName(const AName:String):Boolean;
Description: Set Volume Name in Boot Sector
Note None documented


function TFATFileSystem.SetVolumeSerial(ASerial:LongWord):Boolean;
Description: Set Volume Serial in Boot Sector
Note None documented


function TFATFileSystem.ReadEntry(AParent,AEntry:TDiskEntry; var ABuffer; const AStart:Int64; ACount:LongWord; var AOffset,AValue:LongWord):Integer;
Description: To be documented
Note The caller must ensure the entry is large enough or the read will fail


function TFATFileSystem.WriteEntry(AParent,AEntry:TDiskEntry; const ABuffer; const AStart:Int64; ACount:LongWord; var AOffset,AValue:LongWord):Integer;
Description: To be documented
Note The caller must ensure the entry is large enough or the write will fail


function TFATFileSystem.LoadTables:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.LoadBlocks:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.LoadEntries(AParent:TDiskEntry):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.LoadTable(ATableNo:LongWord):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.LoadBlock(ABlockNo:LongWord):Boolean;
Description: To be documented
Note LoadBlock reads up to SectorsPerBlock sectors from the disk


function TFATFileSystem.LoadEntry(AParent:TDiskEntry; ABuffer:Pointer; var ABlockOffset,AEntryOffset,ABlockSector,AEntrySector:LongWord):Boolean;
Description: To be documented
Note Offset and Sector point to the first directory entry of the entry on call

Offset and Sector point to the last directory entry of the entry on return
Should only be called by LoadEntries or LoadLong
Calls LoadLong if the passed entry is a long name
Caller must hold the entries writer lock


function TFATFileSystem.LoadLong(AParent:TDiskEntry; ABuffer:Pointer; var ABlockOffset,AEntryOffset,ABlockSector,AEntrySector:LongWord):Boolean;
Description: To be documented
Note Offset and Sector point to the first directory entry of the entry on call

Offset and Sector point to the last directory entry of the entry on return
Should only be called by LoadEntries via LoadEntry
Calls LoadEntry if a short entry is found before long entry loaded
Caller must hold the entries writer lock


function TFATFileSystem.AddEntry(AParent:TDiskEntry; const AName:String; AAttributes:LongWord; AReference:Boolean):TDiskEntry;
Description: To be documented
Reference Add a reference on the returned entry if True


function TFATFileSystem.AddEntryEx(AParent:TDiskEntry; const AName,AAltName:String; AAttributes:LongWord; AReference:Boolean):TDiskEntry;
Description: To be documented
Reference Add a reference on the returned entry if True
Note If AltName already exists then a generated one will be provided, will not fail due to AltName.


function TFATFileSystem.RemoveEntry(AParent,AEntry:TDiskEntry):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.RenameEntry(AParent,AEntry:TDiskEntry; const AName:String):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.RenameEntryEx(AParent,AEntry:TDiskEntry; const AAltName:String):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.MoveEntry(ASource,ADest,AEntry:TDiskEntry):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.SetBlock(ABlock:TDiskBlock):Boolean;
Description: To be documented
Note SetBlock writes up to SectorsPerBlock sectors to the disk


function TFATFileSystem.SetEntry(AParent,AEntry:TDiskEntry):Boolean;
Description: To be documented
Note Should only be called by SetTime/SetAttr/SetSize/Rename/Move/Add

Calls SetLong if EntryCount > 1


function TFATFileSystem.SetLong(AParent,AEntry:TDiskEntry):Boolean;
Description: To be documented
Note Should only be called by Rename/Move/Add

SetLong updates the EntryOffset/Sector but EntryCount must be correct
Calls SetEntry if EntryCount = 1


function TFATFileSystem.SizeEntry(AParent,AEntry:TDiskEntry; const ASize:Int64):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.GetBlock(ABlockNo:LongWord):TDiskBlock;
Description: To be documented
Note Overidden to implement multiple entry blocks


function TFATFileSystem.GetBlockEx(ABlockNo:LongWord; AWrite:Boolean):TDiskBlock;
Description: To be documented
Note Overidden to implement multiple entry blocks


function TFATFileSystem.CheckName(const AName:String):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.CountName(const AName:String):Byte;
Description: To be documented
Note None documented


function TFATFileSystem.CompareName(const AName,AMatch:String; AWildcard:Boolean):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.ChecksumName(AEntry:TDiskEntry):Byte;
Description: To be documented
Note None documented


function TFATFileSystem.GenerateName(AParent,AEntry:TDiskEntry; const AName:String):String;
Description: To be documented
Note None documented


function TFATFileSystem.GetNameFlags(const AName:String):LongWord;
Description: To be documented
Note None documented


function TFATFileSystem.CheckFlagName(const AName:String):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.ValidateName(AName:Pointer):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.ValidateDirectory(ADirectory:Pointer):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.FileSystemInit:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.MountFileSystem:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.DismountFileSystem:Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.InitializeFileSystem(ASectorsPerCluster:LongWord; AFileSysType:TFileSysType):Boolean;
Description: To be documented
Note None documented


function TFATFileSystem.GetDriveLabel:String;
Description: Get Volume Label from Root Directory and Boot Sector
Note Overidden to Account for Volume Label entry in Root


function TFATFileSystem.SetDriveLabel(const ALabel:String):Boolean;
Description: Set Volume Label in Root Directory and Boot Sector
Note None documented


function TFATFileSystem.SetDriveSerial(ASerial:LongWord):Boolean;
Description: Set Volume Serial in Boot Sector
Note None documented


function TFATFileSystem.GetDriveFreeSpaceEx:Int64;
Description: Calculate Free space from FAT (or FileSysInfo for FAT32)
Note None documented


function TFATFileSystem.GetDriveTotalSpaceEx:Int64;
Description: Calculate Total space from internal FAT data
Note None documented


function TFATFileSystem.GetDriveInformation(var AClusterSize:LongWord; var ATotalClusterCount,AFreeClusterCount:Int64):Boolean;
Description: Get Drive Information from internal FAT data
Note None documented


Return to Unit Reference