TFATFormatter
From Ultibo.org
								
												
				Return to Unit FATFS
Description
To be documented
Class definitions
TFATFormatter = class(TDiskFormatter)
private 
 | |
 function CheckDevice(AVolume:TDiskVolume; ADrive:TDiskDrive; AFloppyType:TFloppyType):Boolean;
 | 
|
 function CheckPartition(AVolume:TDiskVolume; ADrive:TDiskDrive; AFileSysType:TFileSysType):Boolean;
 | 
|
 function GetPartitionId(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType):Byte;
 | 
|
 function UpdatePartitionId(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType):Boolean;
 | 
|
 function GetSectorsPerCluster(AVolume:TDiskVolume; ADrive:TDiskDrive; AFloppyType:TFloppyType; AFileSysType:TFileSysType; ABootSector:PBootSector; var AFATType:TFATType):LongWord;
 | 
|
 function GetSectorsPerFat(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector):LongWord;
 | 
|
 function CreateBootSector(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector):Boolean;
 | 
|
 function WriteBootSector(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector):Boolean;
 | 
|
 function WriteFatTable(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector):Boolean;
 | 
|
 function WriteRootDirectory(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector):Boolean;
 | 
|
 function CreateInfoSector(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector; AInfoSector:PFATInfoSector):Boolean;
 | 
|
 function WriteInfoSector(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector; AInfoSector:PFATInfoSector):Boolean;
 | 
|
public 
 | |
 function AcceptVolume(AVolume:TDiskVolume; AFloppyType:TFloppyType; AFileSysType:TFileSysType):Boolean; override;
 | 
|
 function FormatVolume(AVolume:TDiskVolume; AFloppyType:TFloppyType; AFileSysType:TFileSysType):Boolean; override;
 | 
|
Function declarations
function TFATFormatter.CheckDevice(AVolume:TDiskVolume; ADrive:TDiskDrive; AFloppyType:TFloppyType):Boolean;
Description: Checks Device and Floppy types are suitable for formatting
| Note | Caller must hold the volume lock | 
|---|
function TFATFormatter.CheckPartition(AVolume:TDiskVolume; ADrive:TDiskDrive; AFileSysType:TFileSysType):Boolean;
Description: Checks Partition type is suitable for formatting
| Note |  Also check File System type for non partitioned media
 Caller must hold the volume lock  | 
|---|
function TFATFormatter.GetPartitionId(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType):Byte;
Description: Gets the actual PartitonId to match the FAT type for formatting
| Note | Caller must hold the volume lock | 
|---|
function TFATFormatter.UpdatePartitionId(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType):Boolean;
Description: Updates the PartitionId to match the FAT type for formatting
| Note | Caller must hold the volume lock | 
|---|
function TFATFormatter.GetSectorsPerCluster(AVolume:TDiskVolume; ADrive:TDiskDrive; AFloppyType:TFloppyType; AFileSysType:TFileSysType; ABootSector:PBootSector; var AFATType:TFATType):LongWord;
Description: Determine SectorsPerCluster and FAT type from the tables based on passed parameters
| Note |  Also sets RootEntryCount, SectorsPerFat, MediaId etc in BootSector.
 Caller must hold the volume lock  | 
|---|
function TFATFormatter.GetSectorsPerFat(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector):LongWord;
Description: Calculate SectorsPerFat based on FAT type and Boot Sector values
| Note | Caller must hold the volume lock | 
|---|
function TFATFormatter.CreateBootSector(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector):Boolean;
Description:Fill the Boot Sector with values based on FAT type
| Note | Caller must hold the volume lock | 
|---|
function TFATFormatter.WriteBootSector(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector):Boolean;
Description: Write the created Boot sector to disk and to backup boot if needed
| Note | Caller must hold the volume lock | 
|---|
function TFATFormatter.WriteFatTable(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector):Boolean;
Description: Write an empty FAT table to disk
| Note | Caller must hold the volume lock | 
|---|
function TFATFormatter.WriteRootDirectory(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector):Boolean;
Description: Write an empty root directory to disk
| Note | Caller must hold the volume lock | 
|---|
function TFATFormatter.CreateInfoSector(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector; AInfoSector:PFATInfoSector):Boolean;
Description: Fill the Info Sector with values based on FAT type
| Note | Caller must hold the volume lock | 
|---|
function TFATFormatter.WriteInfoSector(AVolume:TDiskVolume; ADrive:TDiskDrive; AFATType:TFATType; ABootSector:PBootSector; AInfoSector:PFATInfoSector):Boolean;
Description: Write the created Info sector to disk and to backup info if needed
| Note | Caller must hold the volume lock | 
|---|
function TFATFormatter.AcceptVolume(AVolume:TDiskVolume; AFloppyType:TFloppyType; AFileSysType:TFileSysType):Boolean;
Description: To be documented
| Note | Caller must hold the volume lock | 
|---|
function TFATFormatter.FormatVolume(AVolume:TDiskVolume; AFloppyType:TFloppyType; AFileSysType:TFileSysType):Boolean;
Description: To be documented
| Note | Caller must hold the volume writer lock | 
|---|
Return to Unit Reference