More progress and fixes
This commit is contained in:
@ -44,11 +44,10 @@ type
|
||||
PPWriteHook = procedure(volume : PStorage_volume; directory : pchar; entry : PDirectory_Entry; byteCount : uint32; buffer : puint32; statusOut : puint32);
|
||||
PPReadHook = function(volume : PStorage_Volume; directory : pchar; fileName : pchar; fileExtension : pchar; buffer : puint32; bytecount : puint32) : uint32;
|
||||
PPHIOHook = procedure(volume : PStorage_device; addr : uint32; sectors : uint32; buffer : puint32);
|
||||
PPCreateHook = procedure(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
|
||||
PPCreateHook = procedure(disk : PStorage_Device; start : uint32; size : uint32; config : puint32);
|
||||
PPDetectHook = procedure(disk : PStorage_Device);
|
||||
PPCreateDirHook = procedure(volume : PStorage_volume; directory : pchar; dirname : pchar; attributes : uint32; status : puint32);
|
||||
PPReadDirHook = function(volume : PStorage_volume; directory : pchar; status : puint32) : PLinkedListBase; //returns: 0 = success, 1 = dir not exsist, 2 = not directory, 3 = error //returns: 0 = success, 1 = dir not exsist, 2 = not directory, 3 = error
|
||||
PPFormatVolumeHook = procedure(disk : PStorage_device; sectorCount : uint32; start : uint32; config : puint32);
|
||||
|
||||
PPHIOHook_ = procedure;
|
||||
|
||||
@ -57,11 +56,10 @@ type
|
||||
system_id : uint8;
|
||||
writeCallback : PPWriteHook;
|
||||
readCallback : PPReadHook;
|
||||
createCallback : PPCreateHook;
|
||||
detectCallback : PPDetectHook;
|
||||
createCallback : PPCreateHook; //create volume
|
||||
detectCallback : PPDetectHook; //detect volume
|
||||
createDirCallback : PPCreateDirHook;
|
||||
readDirCallback : PPReadDirHook;
|
||||
formatVolumeCallback : PPFormatVolumeHook;
|
||||
end;
|
||||
|
||||
TStorage_Volume = record
|
||||
@ -93,6 +91,7 @@ var
|
||||
|
||||
procedure register_filesystem(filesystem : PFilesystem);
|
||||
procedure check_for_volumes(drive : PStorage_device);
|
||||
procedure create_volume(disk : PStorage_device; filesystem : PChar; sectorStart : uint32; sectorCount : uint32);
|
||||
|
||||
//IO functions
|
||||
|
||||
@ -105,7 +104,9 @@ var
|
||||
config : puint32;
|
||||
begin
|
||||
push_trace('VolumeManager.format_volume_command');
|
||||
|
||||
console.writestringlnWND('Not implimented, use disk format', getTerminalHWND());
|
||||
exit;
|
||||
|
||||
if paramCount(params) < 3 then begin
|
||||
console.writestringlnWND('Invalid arguments', getTerminalHWND());
|
||||
end;
|
||||
@ -122,7 +123,7 @@ begin
|
||||
//TODO check things exsist
|
||||
|
||||
console.writestringlnWND('Staring volume formatting...', getTerminalHWND());
|
||||
filesystem^.formatVolumeCallback(volume^.device, volume^.sectorSize, volume^.sectorStart, config);
|
||||
// filesystem^.formatVolumeCallback(volume^.device, volume^.sectorSize, volume^.sectorStart, config);
|
||||
console.writestringlnWND('Volume format finished.', getTerminalHWND());
|
||||
end;
|
||||
|
||||
@ -253,12 +254,12 @@ begin
|
||||
drive^.readCallback(drive, 0, 1, puint32(bootrecord));
|
||||
|
||||
//TODO multipe partition entries
|
||||
if bootrecord^.partition_0.LBA_start <> 0 then
|
||||
if bootrecord^.partition[0].LBA_start <> 0 then
|
||||
begin
|
||||
//set volume information
|
||||
storageVolume.device := drive;
|
||||
storageVolume.sectorStart := bootrecord^.partition_0.LBA_start;
|
||||
storageVolume.sectorCount := bootrecord^.partition_0.sector_count;
|
||||
storageVolume.sectorStart := bootrecord^.partition[0].LBA_start;
|
||||
storageVolume.sectorCount := bootrecord^.partition[0].sector_count;
|
||||
storageVolume.sectorSize := drive^.sectorSize;
|
||||
storageVolume.freeSectors := 0; //TODO impliment
|
||||
storageVolume.filesystem := nil;
|
||||
@ -270,7 +271,7 @@ begin
|
||||
|
||||
//check for filesystem type
|
||||
for i:=0 to LL_Size(filesystems) - 1 do begin
|
||||
if bootrecord^.partition_0.system_id = PFilesystem(LL_Get(filesystems, i))^.system_id then
|
||||
if bootrecord^.partition[0].system_id = PFilesystem(LL_Get(filesystems, i))^.system_id then
|
||||
begin
|
||||
storageVolume.filesystem := PFilesystem(LL_Get(filesystems, i));
|
||||
end;
|
||||
@ -293,14 +294,16 @@ procedure create_volume(disk : PStorage_device; filesystem : PChar; sectorStart
|
||||
var
|
||||
volume : PStorage_Volume;
|
||||
elm : void;
|
||||
i : uint16;
|
||||
config : PuInt32;
|
||||
begin
|
||||
|
||||
volume := PStorage_Volume(kalloc(SizeOf(TStorage_Volume)));
|
||||
volume^.device := disk;
|
||||
volume^.sectorStart := sectorStart;
|
||||
volume^.sectorCount := sectorCount;
|
||||
volume^.sectorCount := sectorCount - 10; //-10 is temp also in storagemanager
|
||||
volume^.sectorSize := disk^.sectorSize;
|
||||
volume^.freeSectors := 0; //TODO impliment
|
||||
volume^.freeSectors := 0; //setup by filesystem
|
||||
|
||||
//find filesystem
|
||||
for i:=0 to LL_Size(filesystems) - 1 do begin
|
||||
@ -310,7 +313,7 @@ begin
|
||||
end;
|
||||
|
||||
//format volume
|
||||
volume^.filesystem^.formatVolumeCallback(disk, sectorStart, sectorCount, 0);
|
||||
volume^.filesystem^.createCallback(disk, sectorStart, sectorCount, config);
|
||||
|
||||
//add volume to list
|
||||
elm := LL_Add(storageVolumes);
|
||||
@ -330,7 +333,7 @@ begin
|
||||
elm := LL_Add(device^.volumes);
|
||||
PStorage_volume(elm)^:= volume^;
|
||||
|
||||
if rootVolume = PStorage_Volume(0) then rootVolume:= volume;
|
||||
// if rootVolume = PStorage_Volume(0) then rootVolume:= volume;
|
||||
end;
|
||||
|
||||
end.
|
Reference in New Issue
Block a user