TDiskDevice

From Ultibo.org
Revision as of 03:48, 17 May 2018 by Ultibo (Talk | contribs) (Created page with "Return to Unit Filesystem __TOC__ === Description === ---- ''To be documented'' === Class definitions === ---- <div class="toccolours mw-collapsible...")

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

Return to Unit Filesystem


Description


To be documented

Class definitions



TDiskDevice = class(TListObject)

constructor Create(ADriver:TFileSysDriver; AController:TDiskController; AImage:TDiskImage; AStorage:PStorageDevice; ADeviceNo:Integer; const AIdentifier:String);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FController:TDiskController;  
FImage:TDiskImage;  
FStorage:PStorageDevice;  
 
FDeviceNo:Integer; 00h, 01h, 80h, 81h etc - See Notes
FIdentifier:String; Controller Specific Identifier
FInformation:String; Description of Device - eg "Standard ATA Disk"
 
FVendorId:Word; PCI or USB Vendor Id
FDeviceId:Word; PCI or USB Device Id
 
FManufacturer:String; Device Manufacturer name
FProduct:String; Device Product name
FSerialNumber:String; Device Serial Number
 
FHostBus:String; PCI, ISA etc
FBusNumber:Word; PCI Bus No
FDeviceNumber:Word; PCI Device No
FFunctionNumber:Word; PCI Function No
FBaseAddress:Word; ISA Base Address
FInterfaceType:String; ATA, ATAPI, SCSI, USB, 1394, FIBRE
 
FSlave:Boolean; Device is Slave
FLogicalUnitNo:LongWord; LUN No eg SCSI, ATAPI or USB
FFireWireGUID:Int64; FireWire GUID No
FWorldWideNo:Int64; Fibre Channel WWN
 
FPhysicalPort:Word; Physical IO Port
FControlPort:Word; Drive Control Port
FIRQ:LongWord; IRQ No
 
FPIO:Boolean; PIO Transfer Enabled
FDMA:Boolean; DMA Transfer Enabled
FLBA:Boolean; Supports LBA (eg Int13 Extensions)
FVersion:LongWord; Version Information (eg Int13 Extensions Version 01h,20h,21h,30h)
 
FMediaType:TMediaType; Media Type eg Fixed, Removable, Floppy
FFloppyType:TFloppyType; Floppy Type eg 360K, 1.44M, ATAPI
FReady:Boolean; Media is Inserted in Drive
FLocked:Boolean; Media is Locked in Drive
FLockable:Boolean; Media is Lockable
FEjectable:Boolean; Media is Ejectable
FReadable:Boolean; Media is Readable
FWriteable:Boolean; Media is Writeable
FEraseable:Boolean; Media is Eraseable
FRemovable:Boolean; Media is Removable
FChangeLine:Boolean; Supports ChangeLine detection
 
FPhysicalCylinders:LongWord; Physical Cylinders on Drive
FPhysicalHeads:LongWord; Physical Heads on Drive
FPhysicalSectors:LongWord; Physical Sectors per Track
 
FLogicalCylinders:LongWord; Logical Cylinders on Drive
FLogicalHeads:LongWord; Logical Heads on Drive
FLogicalSectors:LongWord; Logical Sectors per Track
 
FSectorSize:Word; Bytes Per Sector
FSectorCount:Int64; Total Sectors
FSectorShiftCount:Word; Sectors to Bytes Shift Count
 
FPageCount:Word; Cache Page Count for this Device
FPageShift:Word; Cache Page Shift for this Device
FPageMask:LongWord; Cache Page Mask for this Device
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetName:String;  
 
function GetIdentifier:String;  
function GetInformation:String;  
 
function GetManufacturer:String;  
function GetProduct:String;  
function GetSerialNumber:String;  
 
function GetHostBus:String;  
function GetInterfaceType:String;  
 
function GetFreeSectors:Int64; Unused Sectors on Device
function GetAvailableSectors:Int64; Largest block of Unused Sectors
 
function GetAvailableBlock(var AStart,ACount:Int64):Boolean;  
 
function GetDiskSignature:LongWord; virtual;  
procedure SetDiskSignature(ADiskSignature:LongWord); virtual;  
 
function GetBootRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
function SetBootRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
public
property Name:String read GetName;  
property Controller:TDiskController read FController;  
property Image:TDiskImage read FImage;  
property Storage:PStorageDevice read FStorage;  
 
property DeviceNo:Integer read FDeviceNo;  
property Identifier:String read GetIdentifier;  
property Information:String read GetInformation;  
 
property VendorId:Word read FVendorId;  
property DeviceId:Word read FDeviceId;  
 
property Manufacturer:String read GetManufacturer;  
property Product:String read GetProduct;  
property SerialNumber:String read GetSerialNumber;  
 
property HostBus:String read GetHostBus;  
property BusNumber:Word read FBusNumber;  
property DeviceNumber:Word read FDeviceNumber;  
property FunctionNumber:Word read FFunctionNumber;  
property BaseAddress:Word read FBaseAddress;  
property InterfaceType:String read GetInterfaceType;  
 
property Slave:Boolean read FSlave;  
property LogicalUnitNo:LongWord read FLogicalUnitNo;  
property FireWireGUID:Int64 read FFireWireGUID;  
property WorldWideNo:Int64 read FWorldWideNo;  
 
property PhysicalPort:Word read FPhysicalPort;  
property ControlPort:Word read FControlPort;  
property IRQ:LongWord read FIRQ;  
 
property PIO:Boolean read FPIO;  
property DMA:Boolean read FDMA;  
property LBA:Boolean read FLBA;  
property Version:LongWord read FVersion;  
 
property MediaType:TMediaType read FMediaType;  
property FloppyType:TFloppyType read FFloppyType;  
property Ready:Boolean read FReady;  
property Locked:Boolean read FLocked;  
property Lockable:Boolean read FLockable;  
property Ejectable:Boolean read FEjectable;  
property Readable:Boolean read FReadable;  
property Writeable:Boolean read FWriteable;  
property Eraseable:Boolean read FEraseable;  
property Removable:Boolean read FRemovable;  
property ChangeLine:Boolean read FChangeLine;  
 
property PhysicalCylinders:LongWord read FPhysicalCylinders;  
property PhysicalHeads:LongWord read FPhysicalHeads;  
property PhysicalSectors:LongWord read FPhysicalSectors;  
 
property LogicalCylinders:LongWord read FLogicalCylinders;  
property LogicalHeads:LongWord read FLogicalHeads;  
property LogicalSectors:LongWord read FLogicalSectors;  
 
property SectorSize:Word read FSectorSize;  
property SectorCount:Int64 read FSectorCount;  
property SectorShiftCount:Word read FSectorShiftCount;  
 
property PageCount:Word read FPageCount write FPageCount;  
property PageShift:Word read FPageShift write FPageShift;  
property PageMask:LongWord read FPageMask write FPageMask;  
 
property FreeSectors:Int64 read GetFreeSectors;  
property AvailableSectors:Int64 read GetAvailableSectors;  
 
property DiskSignature:LongWord read GetDiskSignature write SetDiskSignature;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function DeviceInit:Boolean; virtual;  
 
function LocatePartitions:Boolean; virtual;  
function LocateVolumes:Boolean; virtual;  
 
function CreateVolume:TDiskVolume; virtual;  
function DeleteVolume(AVolume:TDiskVolume):Boolean; virtual;  
 
function CreatePartition(AParent:TDiskPartition; APartitionId:Byte; ACount:LongWord; AActive:Boolean):Boolean; virtual;  
function DeletePartition(APartition:TDiskPartition):Boolean; virtual;  
function ModifyPartition(APartition:TDiskPartition; APartitionId:Byte):Boolean; virtual;  
function ActivatePartition(APartition:TDiskPartition; AActive:Boolean):Boolean; virtual;  
function ShrinkPartition(APartition:TDiskPartition; const AStart,ASize:Int64):Boolean; virtual;  
function ExpandPartition(APartition:TDiskPartition; const AStart,ASize:Int64):Boolean; virtual;  
 
function Reset:Boolean;  
 
function LockMedia:Boolean;  
function UnlockMedia:Boolean;  
function EjectMedia:Boolean;  
 
function MediaReady:Boolean;  
function MediaChanged:Boolean;  
function MediaLocked:Boolean;  
 
function InsertDevice:Boolean; virtual;  
function EjectDevice:Boolean; virtual;  
 
function OpenDevice(AMode:Integer):Integer; virtual;  
procedure CloseDevice(AHandle:Integer); virtual;  
function ReadDevice(AHandle:Integer; var ABuffer; ACount:Integer):Integer; virtual;  
function WriteDevice(AHandle:Integer; const ABuffer; ACount:Integer):Integer; virtual;  
function EraseDevice(AHandle:Integer; ACount:Integer):Integer; virtual;  
function SeekDevice(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64; virtual;  


Function declarations



constructor TDiskDevice.Create(ADriver:TFileSysDriver; AController:TDiskController; AImage:TDiskImage; AStorage:PStorageDevice; ADeviceNo:Integer; const AIdentifier:String);
Description: To be documented
Note None documented


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


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


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


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


function TDiskDevice.GetIdentifier:String;
Description: To be documented
Note None documented


function TDiskDevice.GetInformation:String;
Description: To be documented
Note None documented


function TDiskDevice.GetManufacturer:String;
Description: To be documented
Note None documented


function TDiskDevice.GetProduct:String;
Description: To be documented
Note None documented


function TDiskDevice.GetSerialNumber:String;
Description: To be documented
Note None documented


function TDiskDevice.GetHostBus:String;
Description: To be documented
Note None documented


function TDiskDevice.GetInterfaceType:String;
Description: To be documented
Note None documented


function TDiskDevice.GetFreeSectors:Int64;
Description: Get the total Count of Unused Sectors on the Device
Note None documented


function TDiskDevice.GetAvailableSectors:Int64;
Description: Get the largest Count of Unused Sectors on the Device
Note None documented


function TDiskDevice.GetAvailableBlock(var AStart,ACount:Int64):Boolean;
Description: Get the Start and Count of largest Unused Sectors on the Device
Note None documented


function TDiskDevice.GetDiskSignature:LongWord;
Description: To be documented
Note None documented


procedure TDiskDevice.SetDiskSignature(ADiskSignature:LongWord);
Description: To be documented
Note None documented


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


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


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


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


function TDiskDevice.DeviceInit:Boolean;
Description: To be documented
Note None documented


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


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


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


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


function TDiskDevice.CreatePartition(AParent:TDiskPartition; APartitionId:Byte; ACount:LongWord; AActive:Boolean):Boolean;
Description: To be documented
Note Caller must hold the parent writer lock


function TDiskDevice.DeletePartition(APartition:TDiskPartition):Boolean;
Description: To be documented
Note Caller must hold the partition writer lock


function TDiskDevice.ModifyPartition(APartition:TDiskPartition; APartitionId:Byte):Boolean;
Description: To be documented
Note Caller must hold the partition writer lock


function TDiskDevice.ActivatePartition(APartition:TDiskPartition; AActive:Boolean):Boolean;
Description: To be documented
Note Caller must hold the partition writer lock


function TDiskDevice.ShrinkPartition(APartition:TDiskPartition; const AStart,ASize:Int64):Boolean;
Description: To be documented
Note Caller must hold the partition writer lock


function TDiskDevice.ExpandPartition(APartition:TDiskPartition; const AStart,ASize:Int64):Boolean;
Description: To be documented
Note Caller must hold the partition writer lock


function TDiskDevice.Reset:Boolean;
Description: To be documented
Note None documented


function TDiskDevice.LockMedia:Boolean;
Description: To be documented
Note None documented


function TDiskDevice.UnlockMedia:Boolean;
Description: To be documented
Note None documented


function TDiskDevice.EjectMedia:Boolean;
Description: To be documented
Note None documented


function TDiskDevice.MediaReady:Boolean;
Description: To be documented
Note None documented


function TDiskDevice.MediaChanged:Boolean;
Description: To be documented
Note None documented


function TDiskDevice.MediaLocked:Boolean;
Description: To be documented
Note None documented


function TDiskDevice.InsertDevice:Boolean;
Description: To be documented
Note None documented


function TDiskDevice.EjectDevice:Boolean;
Description: To be documented
Note None documented


function TDiskDevice.OpenDevice(AMode:Integer):Integer;
Description: To be documented
Note None documented


procedure TDiskDevice.CloseDevice(AHandle:Integer);
Description: To be documented
Note None documented


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


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


function TDiskDevice.EraseDevice(AHandle:Integer; ACount:Integer):Integer;
Description: To be documented
Note Raw Erases must be in Sector sized multiples


function TDiskDevice.SeekDevice(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 Device


Return to Unit Reference