FS.FILO: Add access to globals
diff --git a/src/fs-filo.adb b/src/fs-filo.adb
new file mode 100644
index 0000000..f92455e
--- /dev/null
+++ b/src/fs-filo.adb
@@ -0,0 +1,55 @@
+with Interfaces.C;
+
+use Interfaces.C;
+
+package body FS.FILO is
+
+ C_Part_Length : unsigned_long
+ with
+ Import => True,
+ Convention => C,
+ External_Name => "part_length";
+
+ C_File_Max : int
+ with
+ Import => True,
+ Convention => C,
+ External_Name => "filemax";
+
+ C_File_Pos : int
+ with
+ Import => True,
+ Convention => C,
+ External_Name => "filepos";
+
+ function Part_Length return Partition_Length is (Partition_Length (C_Part_Length));
+
+ function File_Max return File_Length is
+ begin
+ if C_File_Max < 0 then
+ return 0;
+ end if;
+
+ return File_Length (C_File_Max);
+ end File_Max;
+
+ procedure Set_File_Max (Len : File_Length) is
+ begin
+ C_File_Max := int (Len);
+ end Set_File_Max;
+
+ function File_Pos return File_Offset is
+ begin
+ if C_File_Pos < 0 then
+ return 0;
+ end if;
+
+ return File_Offset (C_File_Pos);
+ end File_Pos;
+
+ procedure Set_File_Pos (Off : File_Offset) is
+ begin
+ C_File_Pos := int (Off);
+ end Set_File_Pos;
+
+end FS.FILO;
diff --git a/src/fs-filo.ads b/src/fs-filo.ads
index 4171b79..b9e5742 100644
--- a/src/fs-filo.ads
+++ b/src/fs-filo.ads
@@ -1,3 +1,22 @@
+with Interfaces;
+with Interfaces.C;
+
+use Interfaces.C;
+
package FS.FILO is
+private
+ type Partition_Length is range 0 .. Interfaces.Unsigned_64'Last;
+
+ function Part_Length return Partition_Length;
+
+ type File_Length is range 0 .. int'Last; -- Should be higher, fix FILO first
+ subtype File_Offset is File_Length range 0 .. File_Length'Last - 1;
+
+ function File_Max return File_Length;
+ procedure Set_File_Max (Len : File_Length);
+
+ function File_Pos return File_Offset;
+ procedure Set_File_Pos (Off : File_Offset);
+
end FS.FILO;