git-svn-id: https://spexeah.com:8443/svn/Asuro@594 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
db57eb7cd8
commit
2d902a1380
@ -247,6 +247,7 @@ begin
|
|||||||
storagemanagement.register_device(@storageDevice1);
|
storagemanagement.register_device(@storageDevice1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
pop_trace();
|
pop_trace();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ type
|
|||||||
|
|
||||||
byteArray8 = array[0..7] of char;
|
byteArray8 = array[0..7] of char;
|
||||||
|
|
||||||
TDirectory = bitpacked record
|
TDirectory = packed record
|
||||||
fileName : array[0..7] of char;
|
fileName : array[0..7] of char;
|
||||||
fileExtension : array[0..2] of char;
|
fileExtension : array[0..2] of char;
|
||||||
attributes : uint8;
|
attributes : uint8;
|
||||||
@ -100,6 +100,9 @@ var
|
|||||||
procedure init;
|
procedure init;
|
||||||
procedure create_volume(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
|
procedure create_volume(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
|
||||||
procedure detect_volumes(disk : PStorage_Device);
|
procedure detect_volumes(disk : PStorage_Device);
|
||||||
|
//function writeDirectory(volume : PStorage_volume; directory : pchar; attributes : uint32) : uint8; // need to handle parent table cluster overflow, need to take attributes
|
||||||
|
//function readDirectory(volume : PStorage_volume; directory : pchar; listPtr : PLinkedListBase) : uint8; //returns: 0 = success, 1 = dir not exsist, 2 = not directory, 3 = error
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -124,12 +127,14 @@ var
|
|||||||
bootRecord : TBootRecord;
|
bootRecord : TBootRecord;
|
||||||
fatSize : uint32;
|
fatSize : uint32;
|
||||||
begin
|
begin
|
||||||
|
push_trace('fat32.readFat');
|
||||||
bootRecord := readBootRecord(volume);
|
bootRecord := readBootRecord(volume);
|
||||||
fatSize:= bootrecord.fatSize;
|
fatSize:= bootrecord.fatSize;
|
||||||
buffer:= puint32(kalloc(fatSize));
|
buffer:= puint32(kalloc(fatSize));
|
||||||
volume^.device^.readcallback(volume^.device, volume^.sectorStart + 2 + (cluster * 32 div volume^.sectorSize), 1, buffer);
|
volume^.device^.readcallback(volume^.device, volume^.sectorStart + 2 + (cluster * 32 div volume^.sectorSize), 1, buffer);
|
||||||
readFat:= buffer[cluster];
|
readFat:= buffer[cluster];
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
|
pop_trace();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure writeFat(volume : PStorage_volume; cluster : uint32; value : uint32); // untested, but should work
|
procedure writeFat(volume : PStorage_volume; cluster : uint32; value : uint32); // untested, but should work
|
||||||
@ -138,6 +143,7 @@ var
|
|||||||
bootRecord : TBootRecord;
|
bootRecord : TBootRecord;
|
||||||
fatSize : uint32;
|
fatSize : uint32;
|
||||||
begin
|
begin
|
||||||
|
push_trace('writefat');
|
||||||
bootRecord := readBootRecord(volume);
|
bootRecord := readBootRecord(volume);
|
||||||
fatSize:= bootrecord.fatSize;
|
fatSize:= bootrecord.fatSize;
|
||||||
buffer:= puint32(kalloc(fatSize));
|
buffer:= puint32(kalloc(fatSize));
|
||||||
@ -145,6 +151,7 @@ begin
|
|||||||
buffer[cluster]:= value;
|
buffer[cluster]:= value;
|
||||||
volume^.device^.writeCallback(volume^.device, volume^.sectorStart + 2 + (cluster * 32 div volume^.sectorSize), 1, buffer);
|
volume^.device^.writeCallback(volume^.device, volume^.sectorStart + 2 + (cluster * 32 div volume^.sectorSize), 1, buffer);
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
|
pop_trace();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -155,7 +162,7 @@ var
|
|||||||
clusters : PLinkedListBase;
|
clusters : PLinkedListBase;
|
||||||
dirElm : void;
|
dirElm : void;
|
||||||
buffer : puint32;
|
buffer : puint32;
|
||||||
bufferI : puint32;
|
//buffer : puint32;
|
||||||
bootRecord : TBootRecord;
|
bootRecord : TBootRecord;
|
||||||
clusterInfo : uint32;
|
clusterInfo : uint32;
|
||||||
cc : uint32;
|
cc : uint32;
|
||||||
@ -167,6 +174,7 @@ var
|
|||||||
str : pchar;
|
str : pchar;
|
||||||
targetStr : pchar;
|
targetStr : pchar;
|
||||||
dir : PDirectory;
|
dir : PDirectory;
|
||||||
|
clusterAllocSize : uint32;
|
||||||
begin
|
begin
|
||||||
push_trace('fat32.readDirectory');
|
push_trace('fat32.readDirectory');
|
||||||
|
|
||||||
@ -195,11 +203,7 @@ begin
|
|||||||
|
|
||||||
//build list of clusters for current directory table
|
//build list of clusters for current directory table
|
||||||
while true do begin
|
while true do begin
|
||||||
console.writestring('cluster: ');
|
|
||||||
console.writeintln(cc);
|
|
||||||
clusterInfo:= readFat(volume, cc);
|
clusterInfo:= readFat(volume, cc);
|
||||||
console.writestring('info: ');
|
|
||||||
console.writehexln(clusterInfo);
|
|
||||||
if clusterInfo = $FFFFFFF7 then begin
|
if clusterInfo = $FFFFFFF7 then begin
|
||||||
readDirectory:= 3; //ERROR
|
readDirectory:= 3; //ERROR
|
||||||
break;
|
break;
|
||||||
@ -219,47 +223,55 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
//load clusters into buffer
|
//load clusters into buffer
|
||||||
buffer:= puint32(kalloc( (clusterByteSize * (LL_size(clusters) - 1)) + 1));
|
clusterAllocSize:= (clusterByteSize * (LL_size(clusters))) + 1;
|
||||||
bufferI := buffer;
|
buffer:= puint32(kalloc(clusterAllocSize));
|
||||||
|
//buffer := buffer;
|
||||||
for i:= 0 to LL_size(clusters) - 1 do begin
|
for i:= 0 to LL_size(clusters) - 1 do begin
|
||||||
cc:= uint32(LL_Get(clusters, i)^);
|
cc:= uint32(LL_Get(clusters, i)^);
|
||||||
device^.readcallback(device, volume^.sectorStart + 1 + fatSectorSize + (bootRecord.spc * cc), bootrecord.spc, puint32(buffer + (i * clusterByteSize)) );
|
device^.readcallback(device, volume^.sectorStart + 1 + fatSectorSize + (bootRecord.spc * cc), bootrecord.spc, @buffer[i * (clusterByteSize div 4)] );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if dirI = LL_size(directories) - 1 then break;
|
if dirI = LL_size(directories) - 1 then break;
|
||||||
|
if LL_size(directories) = 0 then break;
|
||||||
|
|
||||||
//get elements in the directory table
|
//get elements in the directory table
|
||||||
|
i:=0;
|
||||||
while true do begin
|
while true do begin
|
||||||
dir:= PDirectory(bufferI);
|
dir:= PDirectory(buffer);
|
||||||
if dir^.fileName[0] = char(0) then break; //need to check if I have found the right directoy and set cc if not last
|
console.writestringln(dir[i].fileName);
|
||||||
if (dir^.attributes and $10) = $10 then begin // is a directory;
|
|
||||||
str:= dir^.fileName;
|
if dir[i].fileName[0] = char(0) then break; //need to check if I have found the right directoy and set cc if not last
|
||||||
|
if (dir[i].attributes and $10) = $10 then begin // is a directory;
|
||||||
|
str:= dir[i].fileName;
|
||||||
str[9]:= char(0);
|
str[9]:= char(0);
|
||||||
if stringEquals(str, targetStr) then begin //need to get current folder searching for
|
if stringEquals(str, targetStr) then begin //need to get current folder searching for
|
||||||
cc:= dir^.clusterLow;
|
cc:= dir[i].clusterLow;
|
||||||
cc:= cc or (dir^.clusterHigh shl 16);
|
cc:= cc or (dir[i].clusterHigh shl 16);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
dirElm:= LL_Add(rootTable);
|
//dirElm:= LL_Add(rootTable);
|
||||||
PDirectory(dirElm)^:= PDirectory(bufferI)^;
|
//PDirectory(dirElm)^:= dir[i];
|
||||||
bufferI:= puint32(bufferI + 8);
|
i+=1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//set CC
|
//set CC
|
||||||
dirI += 1;
|
dirI += 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
i:=0;
|
||||||
while true do begin
|
while true do begin
|
||||||
dir:= PDirectory(bufferI);
|
dir:= PDirectory(buffer);
|
||||||
if dir^.fileName[0] = char(0) then break;
|
if dir[i].fileName[0] = char(0) then break;
|
||||||
dirElm:= LL_Add(rootTable);
|
|
||||||
PDirectory(dirElm)^:= PDirectory(bufferI)^;
|
dirElm:= LL_Add(listPtr);
|
||||||
bufferI:= puint32(bufferI + 8);
|
PDirectory(dirElm)^:= dir[i];
|
||||||
|
i+=1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
listPtr := rootTable;
|
//listPtr := rootTable;
|
||||||
|
//console.writeintln(uint32(listPtr));
|
||||||
|
|
||||||
// while true do begin // I need to be inside another loop
|
// while true do begin // I need to be inside another loop
|
||||||
// if PDirectory(buffer)^.fileName[0] = char(0) then break;
|
// if PDirectory(buffer)^.fileName[0] = char(0) then break;
|
||||||
@ -275,7 +287,7 @@ begin
|
|||||||
pop_trace();
|
pop_trace();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function writeDirectory(volume : PStorage_volume; directory : pchar; attributes : uint32) : uint8; // need to handle parent table cluster overflow, need to take attributes
|
function writeDirectory(volume : PStorage_volume; directory : pchar; dirName : pchar; attributes : uint32) : uint8; // need to handle parent table cluster overflow, need to take attributes
|
||||||
var
|
var
|
||||||
dirAddr : PLinkedListBase;
|
dirAddr : PLinkedListBase;
|
||||||
dirList : PLinkedListBase;
|
dirList : PLinkedListBase;
|
||||||
@ -295,6 +307,7 @@ var
|
|||||||
meArray : byteArray8 = ('.', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
|
meArray : byteArray8 = ('.', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
|
||||||
parentArray : byteArray8 = ('.', '.', ' ', ' ', ' ', ' ', ' ', ' ');
|
parentArray : byteArray8 = ('.', '.', ' ', ' ', ' ', ' ', ' ', ' ');
|
||||||
begin
|
begin
|
||||||
|
push_trace('fat32.writeDirectory');
|
||||||
dirAddr := stringToLL(directory, '/');
|
dirAddr := stringToLL(directory, '/');
|
||||||
//dirList := LL_New(sizeof(TDirectory));
|
//dirList := LL_New(sizeof(TDirectory));
|
||||||
bootRecord := readBootRecord(volume);
|
bootRecord := readBootRecord(volume);
|
||||||
@ -302,31 +315,45 @@ begin
|
|||||||
buffer := puint32(kalloc(sizeof(volume^.sectorSize)));
|
buffer := puint32(kalloc(sizeof(volume^.sectorSize)));
|
||||||
dataStart:= (bootrecord.fatSize) + 1 + volume^.sectorStart;
|
dataStart:= (bootrecord.fatSize) + 1 + volume^.sectorStart;
|
||||||
|
|
||||||
|
console.writestringln('1');
|
||||||
|
|
||||||
//find un allocated cluster
|
//find un allocated cluster
|
||||||
while not foundCluster do begin
|
while not foundCluster do begin
|
||||||
volume^.device^.readcallback(volume^.device, volume^.sectorStart + 2 + (i * 32 div volume^.sectorSize), 1, buffer);
|
volume^.device^.readcallback(volume^.device, volume^.sectorStart + 2 + (i * 32 div volume^.sectorSize), 1, buffer);
|
||||||
for ii:=0 to 127 do begin
|
for ii:=0 to 127 do begin
|
||||||
if puint32(buffer + ii)^ = 0 then begin //found unallocated cluster
|
if puint32(buffer + ii)^ = 0 then begin //found unallocated cluster
|
||||||
emptyCluster:= (i * 16) + ii;
|
emptyCluster:= (i * 32) + ii;
|
||||||
foundCluster:= true;
|
foundCluster:= true;
|
||||||
|
break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
i+= 1;
|
i+= 1;
|
||||||
end;
|
end;
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
|
|
||||||
|
console.writestring('Writtifng new dir to: '); /////////////////////////////////////////////////////////////
|
||||||
|
console.writehexln(emptyCluster);
|
||||||
|
|
||||||
//write fat
|
//write fat
|
||||||
writeFat(volume, emptyCluster, $FFFFFFF8);
|
writeFat(volume, emptyCluster, $FFFFFFF8);
|
||||||
|
console.writestringln('1.1');
|
||||||
//find directory table
|
// //find directory table
|
||||||
for i:=0 to LL_size(dirAddr) - 2 do begin //construct address for parent directory
|
// for i:=0 to LL_size(dirAddr) - 2 do begin //construct address for parent directory
|
||||||
str2:= pchar( puint32(LL_Get(dirAddr, i))^ );
|
// console.writestringln('1.2');
|
||||||
str:= stringConcat(str, str2);
|
// str2:= pchar( puint32(LL_Get(dirAddr, i))^ );
|
||||||
end;
|
// console.writestringln('1.3');
|
||||||
|
// str:= stringConcat(str, str2);
|
||||||
|
// end;
|
||||||
|
str:= directory;
|
||||||
|
dirList:= LL_New(sizeof(TDirectory));
|
||||||
|
console.writestringln(str);
|
||||||
writeDirectory:= readDirectory(volume, str, dirList); //hope str is correct, maybe need /
|
writeDirectory:= readDirectory(volume, str, dirList); //hope str is correct, maybe need /
|
||||||
|
console.writestringln('1.4');
|
||||||
|
console.writeintln(LL_size(dirlist));
|
||||||
targetDirectory:= PDirectory(LL_Get(dirList, 0));
|
targetDirectory:= PDirectory(LL_Get(dirList, 0));
|
||||||
prevDirCluster:= targetDirectory^.clusterLow or (targetDirectory^.clusterHigh shl 16);
|
console.writestringln('1.5');
|
||||||
|
prevDirCluster:= targetDirectory^.clusterLow or uint32(targetDirectory^.clusterHigh shl 16);
|
||||||
|
console.writestringln('2');
|
||||||
|
|
||||||
buffer:= puint32(kalloc(volume^.sectorSize)); //nope, need write one sector, the right sector
|
buffer:= puint32(kalloc(volume^.sectorSize)); //nope, need write one sector, the right sector
|
||||||
//size of dirlist TDIRECTORY (byte size of cluster) / 32 = max no of directories per cluster
|
//size of dirlist TDIRECTORY (byte size of cluster) / 32 = max no of directories per cluster
|
||||||
@ -355,7 +382,7 @@ begin
|
|||||||
if buffer^ = 0 then begin //found empty slot
|
if buffer^ = 0 then begin //found empty slot
|
||||||
str:= pchar(LL_Get(dirAddr, LL_size(dirAddr) - 1));
|
str:= pchar(LL_Get(dirAddr, LL_size(dirAddr) - 1));
|
||||||
|
|
||||||
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.fileName:= byteArray8(str);
|
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.fileName:= byteArray8(dirName);
|
||||||
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.attributes:= attributes;
|
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.attributes:= attributes;
|
||||||
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.clusterLow:= emptyCluster;
|
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.clusterLow:= emptyCluster;
|
||||||
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.clusterHigh:= emptyCluster shl 16;
|
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.clusterHigh:= emptyCluster shl 16;
|
||||||
@ -371,7 +398,7 @@ begin
|
|||||||
//if directory
|
//if directory
|
||||||
if attributes = $10 then begin
|
if attributes = $10 then begin
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
buffer:= puint32(kalloc(sizeof(TDirectory)));
|
buffer:= puint32(kalloc(sizeof(TDirectory) * 2)); // should never be less than one sector
|
||||||
i:=0;
|
i:=0;
|
||||||
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.fileName:= meArray;
|
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.fileName:= meArray;
|
||||||
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.attributes:= attributes;
|
PDirectory(buffer + ((sizeof(TDirectory) * i) DIV 4) )^.attributes:= attributes;
|
||||||
@ -387,6 +414,7 @@ begin
|
|||||||
device^.writecallback(device, datastart + emptyCluster, 1, buffer);
|
device^.writecallback(device, datastart + emptyCluster, 1, buffer);
|
||||||
end;
|
end;
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
|
pop_trace();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure readFile(volume : PStorage_volume; directory : pchar; byteCount : uint32; buffer : puint32);
|
procedure readFile(volume : PStorage_volume; directory : pchar; byteCount : uint32; buffer : puint32);
|
||||||
@ -406,6 +434,8 @@ begin
|
|||||||
filesystem.readcallback:= @readFile;
|
filesystem.readcallback:= @readFile;
|
||||||
filesystem.createcallback:= @create_volume;
|
filesystem.createcallback:= @create_volume;
|
||||||
filesystem.detectcallback:= @detect_volumes;
|
filesystem.detectcallback:= @detect_volumes;
|
||||||
|
filesystem.createDirCallback:= @writeDirectory;
|
||||||
|
filesystem.readDirCallback:= @readDirectory;
|
||||||
storagemanagement.register_filesystem(@filesystem);
|
storagemanagement.register_filesystem(@filesystem);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -514,6 +544,9 @@ var
|
|||||||
buffer : puint32;
|
buffer : puint32;
|
||||||
i : uint8;
|
i : uint8;
|
||||||
volume : PStorage_volume;
|
volume : PStorage_volume;
|
||||||
|
|
||||||
|
dir : PDirectory;
|
||||||
|
dirs : PLinkedListBase;
|
||||||
begin
|
begin
|
||||||
push_trace('detect volume');
|
push_trace('detect volume');
|
||||||
volume:= PStorage_volume(kalloc(sizeof(TStorage_Volume)));
|
volume:= PStorage_volume(kalloc(sizeof(TStorage_Volume)));
|
||||||
@ -533,7 +566,19 @@ begin
|
|||||||
storagemanagement.register_volume(disk, volume);
|
storagemanagement.register_volume(disk, volume);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//readDirectory(volume, 'hello/word', nil);
|
|
||||||
|
// dirs:= LL_New(sizeof(TDirectory));
|
||||||
|
// readDirectory(volume, '', dirs);
|
||||||
|
|
||||||
|
// for i:=0 to LL_size(dirs) - 1 do begin
|
||||||
|
// dir:= PDirectory(LL_Get(dirs, i));
|
||||||
|
// console.writestringln(pchar(dir^.fileName));
|
||||||
|
// end;
|
||||||
|
|
||||||
|
//writeDirectory(volume, '', 'hello', $10);
|
||||||
|
//writeDirectory(volume, '', 'poo', $10);
|
||||||
|
//readDirectory(volume, '.', dirs);
|
||||||
|
|
||||||
pop_trace();
|
pop_trace();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@ type
|
|||||||
PPHIOHook = procedure(volume : PStorage_device; addr : uint32; sectors : uint32; buffer : puint32);
|
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; sectors : uint32; start : uint32; config : puint32);
|
||||||
PPDetectHook = procedure(disk : PStorage_Device);
|
PPDetectHook = procedure(disk : PStorage_Device);
|
||||||
|
PPCreateDirHook = function(volume : PStorage_volume; directory : pchar; dirname : pchar; attributes : uint32) : uint8;
|
||||||
|
PPReadDirHook = function(volume : PStorage_volume; directory : pchar; listPtr : PLinkedListBase) : uint8; //returns: 0 = success, 1 = dir not exsist, 2 = not directory, 3 = error
|
||||||
|
|
||||||
|
|
||||||
PPHIOHook_ = procedure;
|
PPHIOHook_ = procedure;
|
||||||
|
|
||||||
@ -42,6 +45,8 @@ type
|
|||||||
readCallback : PPIOHook;
|
readCallback : PPIOHook;
|
||||||
createCallback : PPCreateHook;
|
createCallback : PPCreateHook;
|
||||||
detectCallback : PPDetectHook;
|
detectCallback : PPDetectHook;
|
||||||
|
createDirCallback : PPCreateDirHook;
|
||||||
|
readDirCallback : PPReadDirHook;
|
||||||
end;
|
end;
|
||||||
PFileSystem = ^TFilesystem;
|
PFileSystem = ^TFilesystem;
|
||||||
|
|
||||||
@ -134,7 +139,7 @@ begin
|
|||||||
drive := stringToInt(getParam(1, params));
|
drive := stringToInt(getParam(1, params));
|
||||||
console.writeintln(drive); // works
|
console.writeintln(drive); // works
|
||||||
if stringEquals(getParam(2, params), 'fat32') then begin
|
if stringEquals(getParam(2, params), 'fat32') then begin
|
||||||
PFilesystem(LL_Get(filesystems, 0))^.createCallback((PStorage_Device(LL_Get(storageDevices, drive))), 1000000, 1, spc); //todo check fs
|
PFilesystem(LL_Get(filesystems, 0))^.createCallback((PStorage_Device(LL_Get(storageDevices, drive))), 10000, 1, spc); //todo check fs
|
||||||
console.writestring('Drive ');
|
console.writestring('Drive ');
|
||||||
//console.writeint(drive); // page faults
|
//console.writeint(drive); // page faults
|
||||||
console.writestringln(' formatted.');
|
console.writestringln(' formatted.');
|
||||||
@ -149,6 +154,65 @@ begin
|
|||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure mkdir_command(params : PParamList);
|
||||||
|
var
|
||||||
|
dir : pchar;
|
||||||
|
device : PStorage_Device;
|
||||||
|
volume : PStorage_Volume;
|
||||||
|
error : uint32;
|
||||||
|
begin
|
||||||
|
if paramCount(params) > 0 then begin
|
||||||
|
dir := getParam(0, params);
|
||||||
|
device:= PStorage_Device(LL_Get(storageDevices, 0));
|
||||||
|
volume:= PStorage_Volume(LL_Get(device^.volumes, 0));
|
||||||
|
|
||||||
|
//error:= volume^.filesystem^.createDirCallback(volume, dir, $10);
|
||||||
|
if error <> 1 then console.writestringln('ERROR');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ls_command(params : PParamList);
|
||||||
|
type
|
||||||
|
TDirectory = bitpacked record
|
||||||
|
fileName : array[0..7] of char;
|
||||||
|
fileExtension : array[0..2] of char;
|
||||||
|
attributes : uint8;
|
||||||
|
reserved0 : uint8;
|
||||||
|
timeFine : uint8;
|
||||||
|
time : uint16;
|
||||||
|
date : uint16;
|
||||||
|
accessTime : uint16;
|
||||||
|
clusterHigh : uint16;
|
||||||
|
modifiedTime : uint16;
|
||||||
|
modifiedDate : uint16;
|
||||||
|
clusterLow : uint16;
|
||||||
|
byteSize : uint32;
|
||||||
|
end;
|
||||||
|
PDirectory = ^TDirectory;
|
||||||
|
var
|
||||||
|
dirs : PLinkedListBase;
|
||||||
|
dir : pchar;
|
||||||
|
device : PStorage_Device;
|
||||||
|
volume : PStorage_Volume;
|
||||||
|
error : uint32;
|
||||||
|
i : uint32;
|
||||||
|
begin
|
||||||
|
if paramCount(params) > 0 then begin
|
||||||
|
dir := getParam(0, params);
|
||||||
|
device:= PStorage_Device(LL_Get(storageDevices, 0));
|
||||||
|
volume:= PStorage_Volume(LL_Get(device^.volumes, 0));
|
||||||
|
|
||||||
|
error:= volume^.filesystem^.readDirCallback(volume, dir, dirs);
|
||||||
|
|
||||||
|
if error <> 1 then console.writestringln('ERROR');
|
||||||
|
|
||||||
|
for i:=0 to LL_Size(dirs) - 1 do begin
|
||||||
|
console.writestring(' ');
|
||||||
|
console.writestringln(pchar( PDirectory(LL_Get(dirs, 0))^.filename ));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure volume_command(params : PParamList);
|
procedure volume_command(params : PParamList);
|
||||||
var
|
var
|
||||||
i : uint32;
|
i : uint32;
|
||||||
@ -183,7 +247,8 @@ begin
|
|||||||
fileSystems:= ll_New(sizeof(TFilesystem));
|
fileSystems:= ll_New(sizeof(TFilesystem));
|
||||||
terminal.registerCommand('DISK', @disk_command, 'Disk utility');
|
terminal.registerCommand('DISK', @disk_command, 'Disk utility');
|
||||||
terminal.registerCommand('VOLUME', @volume_command, 'Volume utility');
|
terminal.registerCommand('VOLUME', @volume_command, 'Volume utility');
|
||||||
terminal.registerCommand('POO', @test_command, 'Volume utility');
|
terminal.registerCommand('mkdir', @mkdir_command, 'Volume utility');
|
||||||
|
terminal.registerCommand('ls', @ls_command, 'Volume utility');
|
||||||
pop_trace();
|
pop_trace();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ interface
|
|||||||
const
|
const
|
||||||
KERNEL_VIRTUAL_BASE = $C0000000;
|
KERNEL_VIRTUAL_BASE = $C0000000;
|
||||||
KERNEL_PAGE_NUMBER = KERNEL_VIRTUAL_BASE SHR 22;
|
KERNEL_PAGE_NUMBER = KERNEL_VIRTUAL_BASE SHR 22;
|
||||||
BSOD_ENABLE = true;
|
BSOD_ENABLE = false;
|
||||||
TRACER_ENABLE = true;
|
TRACER_ENABLE = true;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -118,18 +118,17 @@ var
|
|||||||
i : uint32;
|
i : uint32;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('util.printmemory');
|
|
||||||
buf:= puint8(source);
|
buf:= puint8(source);
|
||||||
for i:=0 to length do begin
|
for i:=0 to length-1 do begin
|
||||||
if offset_row and (i = 0) then begin
|
if offset_row and (i = 0) then begin
|
||||||
console.writehex(source + (i * col));
|
console.writehex(source + (i));
|
||||||
console.writestring(': ');
|
console.writestring(': ');
|
||||||
end;
|
end;
|
||||||
console.writehexpair(buf[i]);
|
console.writehexpair(buf[i]);
|
||||||
if ((i+1) MOD col) = 0 then begin
|
if ((i+1) MOD col) = 0 then begin
|
||||||
console.writestringln(' ');
|
console.writestringln(' ');
|
||||||
if offset_row then begin
|
if offset_row then begin
|
||||||
console.writehex(source + (i * col));
|
console.writehex(source + (i + 1));
|
||||||
console.writestring(': ');
|
console.writestring(': ');
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
@ -137,7 +136,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
console.writestringln(' ');
|
console.writestringln(' ');
|
||||||
pop_trace;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function hi(b : uint8) : uint8; [public, alias: 'util_hi'];
|
function hi(b : uint8) : uint8; [public, alias: 'util_hi'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user