text
stringlengths 0
234
|
|---|
Status := No_Filesystem;
|
return;
|
end if;
|
FS.Disk_Parameters :=
|
To_Disk_Parameter (FS.Window (0 .. 91));
|
if FS.Version = FAT32 then
|
Status :=
|
FS.Ensure_Block (Block_Offset (FS.FSInfo_Block_Number));
|
if Status /= OK then
|
return;
|
end if;
|
-- Check the generic FAT block signature
|
if FS.Window (510 .. 511) /= (16#55#, 16#AA#) then
|
Status := No_Filesystem;
|
return;
|
end if;
|
FS.FSInfo :=
|
To_FSInfo (FS.Window (16#1E4# .. 16#1EF#));
|
FS.FSInfo_Changed := False;
|
end if;
|
declare
|
FAT_Size_In_Block : constant Unsigned_32 :=
|
FS.FAT_Table_Size_In_Blocks *
|
Unsigned_32 (FS.Number_Of_FATs);
|
Root_Dir_Size : Block_Offset;
|
begin
|
FS.FAT_Addr := Block_Offset (FS.Reserved_Blocks);
|
FS.Data_Area := FS.FAT_Addr + Block_Offset (FAT_Size_In_Block);
|
if FS.Version = FAT16 then
|
-- Add space for the root directory
|
FS.Root_Dir_Area := FS.Data_Area;
|
Root_Dir_Size :=
|
(Block_Offset (FS.FAT16_Root_Dir_Num_Entries) * 32 +
|
Block_Offset (FS.Block_Size) - 1) /
|
Block_Offset (FS.Block_Size);
|
-- Align on clusters
|
Root_Dir_Size :=
|
((Root_Dir_Size + FS.Blocks_Per_Cluster - 1) /
|
FS.Blocks_Per_Cluster) *
|
FS.Blocks_Per_Cluster;
|
FS.Data_Area := FS.Data_Area + Root_Dir_Size;
|
end if;
|
FS.Num_Clusters :=
|
Cluster_Type
|
((FS.Total_Number_Of_Blocks - Unsigned_32 (FS.Data_Area)) /
|
Unsigned_32 (FS.Blocks_Per_Cluster));
|
Function Definition: procedure List (Path : String);
|
Function Body: ----------
|
-- List --
|
----------
|
procedure List (Path : String) is
|
DD : Directory_Descriptor;
|
Status : Status_Code;
|
First : Boolean := True;
|
begin
|
Status := Open (DD, Path);
|
if Status /= OK then
|
Put ("Cannot open directory '" & Path & "': " & Status'Img);
|
return;
|
end if;
|
if Recursive then
|
Put_Line (Path & ":");
|
end if;
|
loop
|
declare
|
Ent : constant Directory_Entry := Read (DD);
|
begin
|
exit when Ent = Invalid_Dir_Entry;
|
if not Ent.Hidden or else Show_All then
|
if First then
|
Put (Ent.Name);
|
First := False;
|
else
|
Put (" " & Ent.Name);
|
end if;
|
end if;
|
Function Definition: procedure Display_File (Path : String);
|
Function Body: ------------------
|
-- Display_File --
|
------------------
|
procedure Display_File (Path : String) is
|
FD : File_Descriptor;
|
Status : Status_Code;
|
Data : String (1 .. 512);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.