with Interfaces.C;
with Interfaces.C.Strings;

use Interfaces.C;

package body FS.FILO.VFS
with
   SPARK_Mode => Off,
   Convention => C
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;
