Work on storage and flat file system
This commit is contained in:
@ -44,7 +44,7 @@ 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; start : uint32; size : uint32; config : puint32);
|
||||
PPCreateHook = procedure(volume : PStorage_volume; 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
|
||||
@ -290,6 +290,22 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
procedure remove_volume(list : PLinkedListBase; volume : PStorage_Volume);
|
||||
var
|
||||
i : uint32;
|
||||
elm : void;
|
||||
begin
|
||||
|
||||
for i:=0 to LL_Size(list) - 1 do begin
|
||||
elm := LL_Get(list, i);
|
||||
if (PStorage_Volume(elm)^.device = volume^.device)
|
||||
and (PStorage_Volume(elm)^.sectorStart = volume^.sectorStart) then begin
|
||||
LL_Delete(list, i);
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure create_volume(disk : PStorage_device; filesystem : PChar; sectorStart : uint32; sectorCount : uint32);
|
||||
var
|
||||
volume : PStorage_Volume;
|
||||
@ -298,10 +314,12 @@ var
|
||||
config : PuInt32;
|
||||
begin
|
||||
|
||||
push_trace('VolumeManager.create_volume');
|
||||
|
||||
volume := PStorage_Volume(kalloc(SizeOf(TStorage_Volume)));
|
||||
volume^.device := disk;
|
||||
volume^.sectorStart := sectorStart;
|
||||
volume^.sectorCount := sectorCount - 10; //-10 is temp also in storagemanager
|
||||
volume^.sectorCount := sectorCount - 10;
|
||||
volume^.sectorSize := disk^.sectorSize;
|
||||
volume^.freeSectors := 0; //setup by filesystem
|
||||
|
||||
@ -312,17 +330,30 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
//format volume
|
||||
volume^.filesystem^.createCallback(disk, sectorStart, sectorCount, config);
|
||||
volume^.filesystem^.createCallback(volume, sectorCount, sectorStart, config);
|
||||
|
||||
push_trace('VolumeManager.create_volume.2');
|
||||
|
||||
//remove volume from list of volumes
|
||||
remove_volume(storageVolumes, volume);
|
||||
|
||||
//add volume to list
|
||||
elm := LL_Add(storageVolumes);
|
||||
memcpy(uint32(volume), uint32(elm), SizeOf(TStorage_Volume));
|
||||
|
||||
push_trace('VolumeManager.create_volume.3');
|
||||
|
||||
//remove volume from list of volumes on device
|
||||
remove_volume(disk^.volumes, volume);
|
||||
|
||||
//add volume to device
|
||||
elm := LL_Add(disk^.volumes);
|
||||
memcpy(uint32(volume), uint32(elm), SizeOf(TStorage_Volume));
|
||||
|
||||
//free memory
|
||||
kfree(puint32(volume));
|
||||
end;
|
||||
|
||||
procedure register_volume(device : PStorage_Device; volume : PStorage_Volume);
|
||||
|
Reference in New Issue
Block a user