text stringlengths 0 234 |
|---|
end Set_Size; |
---------- |
-- Find -- |
---------- |
function Find |
(Parent : FAT_Node; |
Filename : FAT_Name; |
DEntry : out FAT_Node) return Status_Code |
is |
-- We use a copy of the handle, so as not to touch the state of initial |
-- handle |
Status : Status_Code; |
Cluster : Cluster_Type := Parent.Start_Cluster; |
Block : Block_Offset := Parent.FS.Cluster_To_Block (Cluster); |
Index : Entry_Index := 0; |
begin |
loop |
Status := Next_Entry |
(FS => Parent.FS, |
Current_Cluster => Cluster, |
Current_Block => Block, |
Current_Index => Index, |
DEntry => DEntry); |
if Status /= OK then |
return No_Such_File; |
end if; |
if Long_Name (DEntry) = Filename or else |
(DEntry.L_Name.Len = 0 and then Short_Name (DEntry) = Filename) |
then |
return OK; |
end if; |
end loop; |
end Find; |
---------- |
-- Find -- |
---------- |
function Find |
(FS : in out FAT_Filesystem; |
Path : String; |
DEntry : out FAT_Node) return Status_Code |
is |
Status : Status_Code; |
Idx : Natural; -- Idx is used to walk through the Path |
Token : FAT_Name; |
begin |
DEntry := Root_Entry (FS); |
-- Looping through the Path. We start at 2 as we ignore the initial '/' |
Idx := Path'First + 1; |
while Idx <= Path'Last loop |
Token.Len := 0; |
for J in Idx .. Path'Last loop |
if Path (J) = '/' then |
exit; |
end if; |
Token.Len := Token.Len + 1; |
Token.Name (Token.Len) := Path (J); |
end loop; |
Idx := Idx + Token.Len + 1; |
Status := Find (DEntry, Token, DEntry); |
if Status /= OK then |
return No_Such_File; |
end if; |
if Idx < Path'Last then |
-- Intermediate entry: needs to be a directory |
if not Is_Subdirectory (DEntry) then |
return No_Such_Path; |
end if; |
end if; |
end loop; |
return OK; |
end Find; |
------------------ |
-- Update_Entry -- |
------------------ |
function Update_Entry |
(Parent : FAT_Node; |
Value : in out FAT_Node) return Status_Code |
is |
subtype Entry_Block is Block (1 .. 32); |
function To_Block is new |
Ada.Unchecked_Conversion (FAT_Directory_Entry, Entry_Block); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.