TDiskPartition

From Ultibo.org
Jump to: navigation, search

Return to Unit Filesystem


Description


To be documented

Class definitions



TDiskPartition = class(TListObject)

constructor Create(ADriver:TFileSysDriver; ADevice:TDiskDevice; APartition:TDiskPartition; APartitionNo:Integer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FDevice:TDiskDevice;  
FPartition:TDiskPartition;  
 
FPartitionNo:Integer; \Partition1, \Partition2 etc - See Notes
 
FEntryNo:Integer; 0,1,2,3
FPartitionId:Byte; Partition Type from Table
 
FBeginHead:Word; Logical Starting Head (not Physical)
FBeginSector:Word; Logical Starting Sector (not Physical)
FBeginCylinder:Word; Logical Starting Cylinder (not Physical)
FEndHead:Word; Logical Ending Head (not Physical)
FEndSector:Word; Logical Ending Sector (not Physical)
FEndCylinder:Word; Logical Ending Cylinder (not Physical)
FSectorOffset:LongWord; Offset in Sectors from Location of Table to StartSector
 
FActive:Boolean; Active Partition Indicator ($80)
FExtended:Boolean; Extended Partition Type (no Volume) - Set by Recognizer
FRecognizable:Boolean; Partition allows Recognize Partition
FRecognized:Boolean; Recognized Partition Id - Set by Recognizer
 
FNonVolume:Boolean; Non Volume Partition (eg Linux Swap) - Set by Recognizer
FMultiVolume:Boolean; Multiple Volume Partition (eg Netware) - Set by Recognizer
 
FStartSector:Int64; Absolute Start Sector on Device
FSectorCount:LongWord; Total Sectors in Partition
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetName:String;  
function GetPath:String;  
function GetParent:String;  
function GetLogical:Boolean;  
function GetPrimary:Boolean;  
procedure SetExtended(AExtended:Boolean);  
 
function GetFreeSectors:LongWord; Unused Sectors in Partition
function GetAvailableSectors:LongWord; Largest block of Unused Sectors
 
function GetAvailableBlock(var AStart,ACount:LongWord):Boolean;  
 
function GetRoot:TDiskPartition;  
function GetParentStart:LongWord;  
 
function GetPartitionRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
function SetPartitionRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
public
property Name:String read GetName;  
property Path:String read GetPath;  
property Parent:String read GetParent;  
property Device:TDiskDevice read FDevice;  
property Partition:TDiskPartition read FPartition;  
property PartitionNo:Integer read FPartitionNo;  
 
property EntryNo:Integer read FEntryNo write FEntryNo;  
property PartitionId:Byte read FPartitionId;  
 
property BeginHead:Word read FBeginHead;  
property BeginSector:Word read FBeginSector;  
property BeginCylinder:Word read FBeginCylinder;  
property EndHead:Word read FEndHead;  
property EndSector:Word read FEndSector;  
property EndCylinder:Word read FEndCylinder;  
property SectorOffset:LongWord read FSectorOffset;  
 
property Active:Boolean read FActive;  
property Logical:Boolean read GetLogical;  
property Primary:Boolean read GetPrimary;  
property Extended:Boolean read FExtended write SetExtended;  
property Recognizable:Boolean read FRecognizable;  
property Recognized:Boolean read FRecognized write FRecognized;  
 
property NonVolume:Boolean read FNonVolume write FNonVolume;  
property MultiVolume:Boolean read FMultiVolume write FMultiVolume;  
 
property StartSector:Int64 read FStartSector;  
property SectorCount:LongWord read FSectorCount;  
 
property FreeSectors:LongWord read GetFreeSectors;  
property AvailableSectors:LongWord read GetAvailableSectors;  
 
property Root:TDiskPartition read GetRoot;  
property ParentStart:LongWord read GetParentStart;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  
 
function PartitionInit:Boolean; virtual;  
 
function LocatePartitions:Boolean; virtual;  
function LocateVolumes:Boolean; virtual;  
 
function CreateVolume:TDiskVolume; virtual;  
function DeleteVolume(AVolume:TDiskVolume):Boolean; virtual;  
 
function OpenPartition(AMode:Integer):Integer; virtual;  
procedure ClosePartition(AHandle:Integer); virtual;  
function ReadPartition(AHandle:Integer; var ABuffer; ACount:Integer):Integer; virtual;  
function WritePartition(AHandle:Integer; const ABuffer; ACount:Integer):Integer; virtual;  
function SeekPartition(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64; virtual;  


Function declarations



constructor TDiskPartition.Create(ADriver:TFileSysDriver; ADevice:TDiskDevice; APartition:TDiskPartition; APartitionNo:Integer);
Description: To be documented
Note None documented


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


function TDiskPartition.AcquireLock:Boolean;
Description: To be documented
Note None documented


function TDiskPartition.ReleaseLock:Boolean;
Description: To be documented
Note None documented


function TDiskPartition.GetName:String;
Description: To be documented
Note None documented


function TDiskPartition.GetPath:String;
Description: To be documented
Note None documented


function TDiskPartition.GetParent:String;
Description: To be documented
Note None documented


function TDiskPartition.GetLogical:Boolean;
Description: Check for a non extended partition with a parent
Note None documented


function TDiskPartition.GetPrimary:Boolean;
Description: Check for a non extended partition with no parent
Note None documented


procedure TDiskPartition.SetExtended(AExtended:Boolean);
Description: Mark partition as extended, update no and recalculate start
Note Once extended is enabled it cannot be turned off

If already enabled then no action is taken


function TDiskPartition.GetFreeSectors:LongWord;
Description: Get the total Count of Unused Sectors in the Partition
Note None documented


function TDiskPartition.GetAvailableSectors:LongWord;
Description: Get the largest Count of Unused Sectors in the Partition
Note None documented


function TDiskPartition.GetAvailableBlock(var AStart,ACount:LongWord):Boolean;
Description: Get the Start and Count of largest Unused Sectors in the Partition
Note None documented


function TDiskPartition.GetRoot:TDiskPartition;
Description: Returns the first level extended for a second level plus partition
Note None documented


function TDiskPartition.GetParentStart:LongWord;
Description: To be documented
Note None documented


function TDiskPartition.ReaderLock:Boolean;
Description: To be documented
Note None documented


function TDiskPartition.ReaderUnlock:Boolean;
Description: To be documented
Note None documented


function TDiskPartition.ReaderConvert:Boolean;
Description: Convert a Reader lock to a Writer lock
Note None documented


function TDiskPartition.WriterLock:Boolean;
Description: To be documented
Note None documented


function TDiskPartition.WriterUnlock:Boolean;
Description: To be documented
Note None documented


function TDiskPartition.WriterConvert:Boolean;
Description: Convert a Writer lock to a Reader lock
Note None documented


function TDiskPartition.PartitionInit:Boolean;
Description: To be documented
Note None documented


function TDiskPartition.LocatePartitions:Boolean;
Description: To be documented
Note None documented


function TDiskPartition.LocateVolumes:Boolean;
Description: To be documented
Note None documented


function TDiskPartition.CreateVolume:TDiskVolume;
Description: To be documented
Note None documented


function TDiskPartition.DeleteVolume(AVolume:TDiskVolume):Boolean;
Description: To be documented
Note Caller must hold the volume writer lock


function TDiskPartition.OpenPartition(AMode:Integer):Integer;
Description: To be documented
Note None documented


procedure TDiskPartition.ClosePartition(AHandle:Integer);
Description: To be documented
Note None documented


function TDiskPartition.ReadPartition(AHandle:Integer; var ABuffer; ACount:Integer):Integer;
Description: To be documented
Note Raw Reads must be in Sector sized multiples


function TDiskPartition.WritePartition(AHandle:Integer; const ABuffer; ACount:Integer):Integer;
Description: To be documented
Note Raw Writes must be in Sector sized multiples


function TDiskPartition.SeekPartition(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64;
Description: To be documented
Note Raw Seeks must be in Sector sized multiples

Raw Seeks cannot extend the size of the Partition


Return to Unit Reference