blob: 413a04931ac1bdd3cc4691d4db92fff845f7fc23 [file] [log] [blame]
Nico Huber3a5cd8c2023-11-27 17:38:06 +01001with Interfaces.C;
2
3use Interfaces.C;
4
Thomas Heijligen5c43abc2023-12-11 15:24:36 +00005package body FILO.FS is
Nico Huber3a5cd8c2023-11-27 17:38:06 +01006
7 C_Part_Length : unsigned_long
8 with
9 Import => True,
10 Convention => C,
11 External_Name => "part_length";
12
13 C_File_Max : int
14 with
15 Import => True,
16 Convention => C,
17 External_Name => "filemax";
18
19 C_File_Pos : int
20 with
21 Import => True,
22 Convention => C,
23 External_Name => "filepos";
24
Nico Huber51f60412023-12-04 14:48:11 +010025 function Part_Len return Partition_Length is (Partition_Length (C_Part_Length));
Nico Huber3a5cd8c2023-11-27 17:38:06 +010026
27 function File_Max return File_Length is
28 begin
29 if C_File_Max < 0 then
30 return 0;
31 end if;
32
33 return File_Length (C_File_Max);
34 end File_Max;
35
36 procedure Set_File_Max (Len : File_Length) is
37 begin
38 C_File_Max := int (Len);
39 end Set_File_Max;
40
41 function File_Pos return File_Offset is
42 begin
43 if C_File_Pos < 0 then
44 return 0;
45 end if;
46
47 return File_Offset (C_File_Pos);
48 end File_Pos;
49
50 procedure Set_File_Pos (Off : File_Offset) is
51 begin
52 C_File_Pos := int (Off);
53 end Set_File_Pos;
54
Thomas Heijligen5c43abc2023-12-11 15:24:36 +000055end FILO.FS;