blob: 69ed2adc724191b094fd6d38a0fb229e8aa3165b [file] [log] [blame]
Thomas Heijligen5c43abc2023-12-11 15:24:36 +00001package body FILO.FS is
Nico Huber3a5cd8c2023-11-27 17:38:06 +01002
3 C_Part_Length : unsigned_long
4 with
5 Import => True,
6 Convention => C,
7 External_Name => "part_length";
8
9 C_File_Max : int
10 with
11 Import => True,
12 Convention => C,
13 External_Name => "filemax";
14
15 C_File_Pos : int
16 with
17 Import => True,
18 Convention => C,
19 External_Name => "filepos";
20
Nico Huberf9ab8682024-01-29 16:32:02 +010021 function Part_Len return Partition_Length
22 is
23 (Partition_Length (unsigned_long'Min (
24 C_Part_Length, unsigned_long (Partition_Length'Last))));
Nico Huber3a5cd8c2023-11-27 17:38:06 +010025
26 function File_Max return File_Length is
27 begin
28 if C_File_Max < 0 then
29 return 0;
30 end if;
31
32 return File_Length (C_File_Max);
33 end File_Max;
34
35 procedure Set_File_Max (Len : File_Length) is
36 begin
37 C_File_Max := int (Len);
38 end Set_File_Max;
39
40 function File_Pos return File_Offset is
41 begin
42 if C_File_Pos < 0 then
43 return 0;
44 end if;
45
46 return File_Offset (C_File_Pos);
47 end File_Pos;
48
49 procedure Set_File_Pos (Off : File_Offset) is
50 begin
51 C_File_Pos := int (Off);
52 end Set_File_Pos;
53
Thomas Heijligen5c43abc2023-12-11 15:24:36 +000054end FILO.FS;