text
stringlengths
0
234
Matches := Current_CRC = CRC;
end if;
DEntry :=
(FS => FAT_Filesystem_Access (FS),
L_Name => <>,
S_Name => D_Entry.Filename,
S_Name_Ext => D_Entry.Extension,
Attributes => D_Entry.Attributes,
Start_Cluster => (if FS.Version = FAT16
then Cluster_Type (D_Entry.Cluster_L)
else Cluster_Type (D_Entry.Cluster_L) or
Shift_Left
(Cluster_Type (D_Entry.Cluster_H), 16)),
Size => D_Entry.Size,
Index => Current_Index - 1,
Is_Root => False,
Is_Dirty => False);
if Matches then
DEntry.L_Name := -L_Name (L_Name_First .. L_Name'Last);
else
DEntry.L_Name.Len := 0;
end if;
return OK;
end if;
end loop;
end Next_Entry;
----------
-- Read --
----------
function Read
(Dir : in out FAT_Directory_Handle;
DEntry : out FAT_Node) return Status_Code
is
begin
return Next_Entry
(Dir.FS,
Current_Cluster => Dir.Current_Cluster,
Current_Block => Dir.Current_Block,
Current_Index => Dir.Current_Index,
DEntry => DEntry);
end Read;
-------------------
-- Create_Subdir --
-------------------
function Create_Subdir
(Dir : FAT_Node;
Name : FAT_Name;
New_Dir : out FAT_Node) return Status_Code
is
Handle : FAT_Directory_Handle_Access;
Ret : Status_Code;
Block : Block_Offset;
Dot : FAT_Directory_Entry;
Dot_Dot : FAT_Directory_Entry;
begin
Ret := Dir.FAT_Open (Handle);
if Ret /= OK then
return Ret;
end if;
Ret := Allocate_Entry
(Parent => Handle,
Name => Name,
Attributes => (Read_Only => False,
Hidden => False,
System_File => False,
Volume_Label => False,
Subdirectory => True,
Archive => False),
E => New_Dir);
if Ret /= OK then
return Ret;
end if;
Block := Dir.FS.Cluster_To_Block (New_Dir.Start_Cluster);
Ret := Handle.FS.Ensure_Block (Block);
if Ret /= OK then
return Ret;
end if;
-- Allocate '.', '..' and the directory entry terminator
Dot :=
(Filename => (1 => '.', others => ' '),
Extension => (others => ' '),
Attributes => (Read_Only => False,
Hidden => False,
System_File => False,
Volume_Label => False,
Subdirectory => True,