unit Device;
interface
const SECTOR_SIZE = 512;
type
PDevice = ^TDevice;
readFunc = function(dev:PDevice; ptr:pointer; offset:int64; length:dword):integer;
writeFunc = function(dev:PDevice; ptr:pointer; offset:int64; length:dword):integer;
resetFunc = function:integer;
initFunc = function(dev:PDevice):integer;
ioctlFunc = procedure;
stopFunc = procedure;
startFunc = procedure;
standbyFunc = procedure;
TDevice = object
public
major : integer;
info : pointer;
sectors : dword;
constructor init;
function read(ptr:pointer; offset:int64; length:dword):integer; virtual;
function write(ptr:pointer; offset:int64; length:dword):integer; virtual;
destructor done; virtual;
end; // TDevice;
{ TDevice = packed record
major : integer;
info : pointer;
sectors : dword;
read : readFunc;
write : writeFunc;
reset : resetFunc;
init : initFunc;
ioctl : ioctlFunc;
stop : stopFunc;
standby : standbyFunc;
end; }
implementation
constructor TDevice.init;
begin
major := 0;
info := NIL;
sectors := 0;
end; // TDevice.init
function TDevice.read;
begin
result := -1;
end; // TDevice.read
function TDevice.write;
begin
result := -1;
end; // TDevice.write
destructor TDevice.done;
begin
major := 0;
info := NIL;
sectors := 0;
end; // TDevice.done
end.