text
stringlengths
0
234
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,
Archive => False),
Reserved => (others => ASCII.NUL),
Cluster_H =>
Unsigned_16
(Shift_Right
(Unsigned_32
(New_Dir.Start_Cluster) and 16#FFFF_0000#, 16)),
Time => 0,
Date => 0,
Cluster_L => Unsigned_16 (New_Dir.Start_Cluster and 16#FFFF#),
Size => 0);
Dot_Dot :=
(Filename => (1 .. 2 => '.', others => ' '),
Extension => (others => ' '),
Attributes => (Read_Only => False,
Hidden => False,
System_File => False,
Volume_Label => False,
Subdirectory => True,
Archive => False),
Reserved => (others => ASCII.NUL),
Cluster_H =>
Unsigned_16
(Shift_Right