TDiskPartitioner
Return to Unit Filesystem
Description
To be documented
Class definitions
TDiskPartitioner = class(TObject)
constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TSynchronizerHandle;
|
|
FLocalLock:TMutexHandle;
|
|
protected
| |
FDriver:TFileSysDriver;
|
|
FRecognizer:TRecognizer;
|
|
FInitChar:Byte;
|
Character to initialize sectors when adding partitions |
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
|
function CheckLogical(ADevice:TDiskDevice; AParent:TDiskPartition; APartitionId:Byte):Boolean; virtual;
|
|
function CheckExtended(ADevice:TDiskDevice; AParent:TDiskPartition; APartitionId:Byte):Boolean; virtual;
|
|
function GetLogicalChild(ADevice:TDiskDevice; APartition:TDiskPartition; ALock:Boolean; AState:LongWord):TDiskPartition;
|
|
function GetExtendedSibling(ADevice:TDiskDevice; AParent:TDiskPartition; ALock:Boolean; AState:LongWord):TDiskPartition;
|
|
function GetExtendedParent(ADevice:TDiskDevice; AParent:TDiskPartition; AStart:LongWord; ALock:Boolean; AState:LongWord):TDiskPartition;
|
|
function GetEndCHS(ADevice:TDiskDevice; AStart,ACount:LongWord; var ACylinder,AHead,ASector:Word):Boolean; virtual;
|
|
function GetStartCHS(ADevice:TDiskDevice; AStart,ACount:LongWord; var ACylinder,AHead,ASector:Word):Boolean; virtual;
|
|
function GetSectorCount(ADevice:TDiskDevice; AStart,ACount:LongWord):LongWord; virtual;
|
|
function GetStartSector(ADevice:TDiskDevice; AExtended,ALogical:Boolean; AStart:LongWord; var ACount:LongWord):LongWord; virtual;
|
|
function GetSectorOffset(ADevice:TDiskDevice; AParent:TDiskPartition; AExtended:Boolean; AStart:LongWord):LongWord; virtual;
|
|
function GetPartitionId(ADevice:TDiskDevice; AParent:TDiskPartition; AStart,ACount:LongWord; APartitionId:Byte):Byte; virtual;
|
|
function InitPartition(ADevice:TDiskDevice; AParent:TDiskPartition; AStart,ACount:LongWord; APartitionId:Byte):Boolean; virtual;
|
|
function CreatePartitionRecord(ADevice:TDiskDevice; ARecord:PPartitionRecord):Boolean;
|
|
function CreatePartitionEntry(ADevice:TDiskDevice; AStart,ACount,AOffset:LongWord; APartitionId:Byte; AActive:Boolean; var AEntry:TPartitionEntry):Boolean;
|
|
function FillSectors(ADevice:TDiskDevice; APartition:TDiskPartition; ASector,ACount:LongWord; AValue:Byte):Boolean;
|
|
function ReadSectors(ADevice:TDiskDevice; APartition:TDiskPartition; ASector,ACount:LongWord; var ABuffer):Boolean;
|
|
function WriteSectors(ADevice:TDiskDevice; APartition:TDiskPartition; ASector,ACount:LongWord; const ABuffer):Boolean;
|
|
public
| |
property InitChar:Byte read FInitChar write FInitChar;
|
|
function ReaderLock:Boolean;
|
|
function ReaderUnlock:Boolean;
|
|
function WriterLock:Boolean;
|
|
function WriterUnlock:Boolean;
|
|
function AcceptPartition(ADevice:TDiskDevice; APartition,AParent:TDiskPartition; APartitionId:Byte):Boolean; virtual;
|
|
function CreatePartition(ADevice:TDiskDevice; AParent:TDiskPartition; APartitionId:Byte; ACount:LongWord; AActive:Boolean):Boolean; virtual;
|
|
function DeletePartition(APartition:TDiskPartition):Boolean; virtual;
|
|
function ModifyPartition(APartition:TDiskPartition; APartitionId:Byte; AOverride:Boolean):Boolean; virtual;
|
|
function ActivatePartition(APartition:TDiskPartition; AActive:Boolean):Boolean; virtual;
|
Function declarations
constructor TDiskPartitioner.Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);
Note | None documented |
---|
destructor TDiskPartitioner.Destroy;
Note | None documented |
---|
function TDiskPartitioner.AcquireLock:Boolean;
Note | None documented |
---|
function TDiskPartitioner.ReleaseLock:Boolean;
Note | None documented |
---|
function TDiskPartitioner.CheckLogical(ADevice:TDiskDevice; AParent:TDiskPartition; APartitionId:Byte):Boolean;
Note | Caller must hold the device and partition lock |
---|
function TDiskPartitioner.CheckExtended(ADevice:TDiskDevice; AParent:TDiskPartition; APartitionId:Byte):Boolean;
Note | Caller must hold the device and partition lock |
---|
function TDiskPartitioner.GetLogicalChild(ADevice:TDiskDevice; APartition:TDiskPartition; ALock:Boolean; AState:LongWord):TDiskPartition;
Note | Used to find the logical child of a Partition being deleted
Caller must hold the device and partition lock |
---|
function TDiskPartitioner.GetExtendedSibling(ADevice:TDiskDevice; AParent:TDiskPartition; ALock:Boolean; AState:LongWord):TDiskPartition;
Note | Passed Parent should be the actual Parent
Also used to find the next sibling of a Partition being deleted
|
---|
function TDiskPartitioner.GetExtendedParent(ADevice:TDiskDevice; AParent:TDiskPartition; AStart:LongWord; ALock:Boolean; AState:LongWord):TDiskPartition;
Note | Passed Parent should be the Root extended
Caller must hold the device and partition lock |
---|
function TDiskPartitioner.GetEndCHS(ADevice:TDiskDevice; AStart,ACount:LongWord; var ACylinder,AHead,ASector:Word):Boolean;
Note | Start and Count must be Cylinder aligned when passed
Caller must hold the device lock |
---|
function TDiskPartitioner.GetStartCHS(ADevice:TDiskDevice; AStart,ACount:LongWord; var ACylinder,AHead,ASector:Word):Boolean;
Note | Start and Count must be Cylinder aligned when passed
Caller must hold the device lock |
---|
function TDiskPartitioner.GetSectorCount(ADevice:TDiskDevice; AStart,ACount:LongWord):LongWord;
Start | Start must be Cylinder aligned when passed |
---|---|
Note | The actual result will be a Count that is aligned to a Cylinder boundary
Caller must hold the device lock |
function TDiskPartitioner.GetStartSector(ADevice:TDiskDevice; AExtended,ALogical:Boolean; AStart:LongWord; var ACount:LongWord):LongWord;
Note | The actual result will be a Start that is aligned to a Cylinder boundary
For first Partition (not Extended) and Logical the Start is aligned to a Head boundary
|
---|
function TDiskPartitioner.GetSectorOffset(ADevice:TDiskDevice; AParent:TDiskPartition; AExtended:Boolean; AStart:LongWord):LongWord;
Start | Start must be Cylinder aligned when passed |
---|---|
Note | Accounts for Offset behaviour of second level extended and logical partitions
Caller must hold the device and partition lock |
function TDiskPartitioner.GetPartitionId(ADevice:TDiskDevice; AParent:TDiskPartition; AStart,ACount:LongWord; APartitionId:Byte):Byte;
Note | Caller must hold the device and partition lock |
---|
function TDiskPartitioner.InitPartition(ADevice:TDiskDevice; AParent:TDiskPartition; AStart,ACount:LongWord; APartitionId:Byte):Boolean;
Start | Start is the absolute start sector on the device |
---|---|
Note | Caller must hold the device and partition lock |
function TDiskPartitioner.CreatePartitionRecord(ADevice:TDiskDevice; ARecord:PPartitionRecord):Boolean;
Note | Create an empty Partition record (or Master Boot Record) if not valid
Caller must hold the device lock |
---|
function TDiskPartitioner.CreatePartitionEntry(ADevice:TDiskDevice; AStart,ACount,AOffset:LongWord; APartitionId:Byte; AActive:Boolean; var AEntry:TPartitionEntry):Boolean;
Note | Caller must hold the device lock |
---|
function TDiskPartitioner.FillSectors(ADevice:TDiskDevice; APartition:TDiskPartition; ASector,ACount:LongWord; AValue:Byte):Boolean;
Sector | Sector is relative to the StartSector of the Partition |
---|---|
Note | Caller must hold the device and partition lock |
function TDiskPartitioner.ReadSectors(ADevice:TDiskDevice; APartition:TDiskPartition; ASector,ACount:LongWord; var ABuffer):Boolean;
Sector | Sector is relative to the StartSector of the Device or Partition |
---|---|
Note | Caller must hold the device and partition lock, cache will serialize access to device. |
function TDiskPartitioner.WriteSectors(ADevice:TDiskDevice; APartition:TDiskPartition; ASector,ACount:LongWord; const ABuffer):Boolean;
Sector | Sector is relative to the StartSector of the Device or Partition |
---|---|
Note | Caller must hold the device and partition lock, cache will serialize access to device. |
function TDiskPartitioner.ReaderLock:Boolean;
Note | None documented |
---|
function TDiskPartitioner.ReaderUnlock:Boolean;
Note | None documented |
---|
function TDiskPartitioner.WriterLock:Boolean;
Note | None documented |
---|
function TDiskPartitioner.WriterUnlock:Boolean;
Note | None documented |
---|
function TDiskPartitioner.AcceptPartition(ADevice:TDiskDevice; APartition,AParent:TDiskPartition; APartitionId:Byte):Boolean;
Note | Caller must hold the device and partition and parent lock |
---|
function TDiskPartitioner.CreatePartition(ADevice:TDiskDevice; AParent:TDiskPartition; APartitionId:Byte; ACount:LongWord; AActive:Boolean):Boolean;
Note | When creating Logical partitions the passed Parent must be the Root Extended
Caller must hold the device and parent writer locks |
---|
function TDiskPartitioner.DeletePartition(APartition:TDiskPartition):Boolean;
Note | Caller must hold the device and partition writer locks |
---|
function TDiskPartitioner.ModifyPartition(APartition:TDiskPartition; APartitionId:Byte; AOverride:Boolean):Boolean;
Note | Override disables the normalisation of PartitionId to suit size and type and also disables dismount and remount of any volumes and drives etc
Caller must hold the partition writer lock |
---|
function TDiskPartitioner.ActivatePartition(APartition:TDiskPartition; AActive:Boolean):Boolean;
Note | Also allows making the specified Partition inactive
No need to check for Extended as AcceptPartition does
|
---|
Return to Unit Reference