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;
