text
stringlengths 0
234
|
|---|
Size := Size - B_Per_Cluster;
|
end loop;
|
return Ret;
|
end Adjust_Clusters;
|
-------------------------------
|
-- Find_Empty_Entry_Sequence --
|
-------------------------------
|
function Find_Empty_Entry_Sequence
|
(Parent : access FAT_Directory_Handle;
|
Num_Entries : Natural) return Entry_Index
|
is
|
Status : Status_Code;
|
D_Entry : FAT_Directory_Entry;
|
Sequence : Natural := 0;
|
Ret : Entry_Index;
|
Cluster : Cluster_Type := Parent.Start_Cluster;
|
Block : Block_Offset := Cluster_To_Block (Parent.FS.all, Cluster);
|
begin
|
Parent.Current_Index := 0;
|
loop
|
Status := Next_Entry
|
(Parent.FS,
|
Current_Cluster => Cluster,
|
Current_Block => Block,
|
Current_Index => Parent.Current_Index,
|
DEntry => D_Entry);
|
if Status /= OK then
|
return Null_Index;
|
end if;
|
if D_Entry.Attributes = VFAT_Directory_Entry_Attribute then
|
if Sequence = 0 then
|
-- Parent.Current_Index points to the next unread value.
|
-- So the just read entry is at Parent.Current_Index - 1
|
Ret := Parent.Current_Index - 1;
|
end if;
|
Sequence := Sequence + 1;
|
elsif Character'Pos (D_Entry.Filename (1)) = 16#E5# then
|
-- A deleted entry has been found
|
if Sequence >= Num_Entries then
|
return Ret;
|
else
|
Sequence := 0;
|
end if;
|
else
|
Sequence := 0;
|
end if;
|
end loop;
|
end Find_Empty_Entry_Sequence;
|
--------------------
|
-- Allocate_Entry --
|
--------------------
|
function Allocate_Entry
|
(Parent : access FAT_Directory_Handle;
|
Name : FAT_Name;
|
Attributes : FAT_Directory_Entry_Attribute;
|
E : out FAT_Node) return Status_Code
|
is
|
subtype Short_Name is String (1 .. 8);
|
subtype Extension is String (1 .. 3);
|
function Is_Legal_Character (C : Character) return Boolean
|
is (C in 'A' .. 'Z'
|
or else C in '0' .. '9'
|
or else C = '!'
|
or else C = '#'
|
or else C = '$'
|
or else C = '%'
|
or else C = '&'
|
or else C = '''
|
or else C = '('
|
or else C = ')'
|
or else C = '-'
|
or else C = '@'
|
or else C = '^'
|
or else C = '_'
|
or else C = '`'
|
or else C = '{'
|
or else C = '}'
|
or else C = '~');
|
Block_Off : Natural;
|
Status : Status_Code;
|
DEntry : FAT_Node;
|
SName : Short_Name := (others => ' ');
|
SExt : Extension := (others => ' ');
|
Index : Entry_Index;
|
-- Retrieve the number of VFAT entries that are needed, plus one for
|
-- the regular FAT entry.
|
N_Entries : Natural := Get_Num_VFAT_Entries (Name) + 1;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.