Fill FS.FILO.VFS wrapper
diff --git a/src/fs-filo-vfs.adb b/src/fs-filo-vfs.adb
new file mode 100644
index 0000000..75df52b
--- /dev/null
+++ b/src/fs-filo-vfs.adb
@@ -0,0 +1,38 @@
+with Interfaces.C;
+with Interfaces.C.Strings;
+
+use Interfaces.C;
+
+package body FS.FILO.VFS is
+
+ function C_Mount return int
+ is
+ Success : Boolean;
+ begin
+ Mount (Success);
+ return (if Success then 1 else 0);
+ end C_Mount;
+
+ function C_Open (File_Path : Strings.chars_ptr) return int
+ is
+ Success : Boolean;
+ begin
+ Open (Strings.Value (File_Path), Success);
+ return (if Success then 1 else 0);
+ end C_Open;
+
+ function C_Read (Buf : System.Address; Len : int) return int
+ is
+ subtype Buffer_Range is Natural range 0 .. Integer (Len) - 1;
+ Buffer : Buffer_Type (Buffer_Range)
+ with
+ Convention => C,
+ Address => Buf;
+
+ Read_Len : Natural;
+ begin
+ Read (Buffer, Read_Len);
+ return int (Read_Len);
+ end C_Read;
+
+end FS.FILO.VFS;
diff --git a/src/fs-filo-vfs.ads b/src/fs-filo-vfs.ads
index ce5da18..95fa71d 100644
--- a/src/fs-filo-vfs.ads
+++ b/src/fs-filo-vfs.ads
@@ -9,20 +9,21 @@
with procedure Mount (Success : out Boolean);
with procedure Open (File_Path : String; Success : out Boolean);
- with procedure Close;
+ with procedure Close with Convention => C;
- with procedure Read (Buf : out Buffer_Type; Success : out Boolean);
+ with procedure Read (Buf : out Buffer_Type; Len : out Natural);
package FS.FILO.VFS
with
- SPARK_Mode => Off
+ SPARK_Mode => Off,
+ Convention => C
is
- function C_Mount return int is (0);
+ function C_Mount return int;
- function C_Open (File_Path : Strings.chars_ptr) return int is (0);
- procedure C_Close is null;
+ function C_Open (File_Path : Strings.chars_ptr) return int;
+ procedure C_Close renames Close;
- function C_Read (Buf : System.Address; Len : int) return int is (0);
+ function C_Read (Buf : System.Address; Len : int) return int;
end FS.FILO.VFS;