blob: 9e47f6f433ac4f2bdd22df333abe52f8733dad54 [file] [log] [blame]
Nico Huberfdfa2e22023-11-27 16:26:03 +01001with System;
2with Interfaces.C;
3with Interfaces.C.Strings;
4
5use Interfaces.C;
6
7generic
8
Nico Huber51f60412023-12-04 14:48:11 +01009 type T (<>) is private;
Nico Huberfdfa2e22023-11-27 16:26:03 +010010
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000011 with function Is_Mounted (State : T) return Boolean is <>;
12 with function Is_Open (State : T) return Boolean is <>
Nico Huber51f60412023-12-04 14:48:11 +010013 with
14 Post => (if Is_Open'Result then Is_Mounted (State));
Nico Huberfdfa2e22023-11-27 16:26:03 +010015
Nico Huber51f60412023-12-04 14:48:11 +010016 Initial : T;
17
18 with procedure Mount
19 (State : in out T;
20 Part_Len : in Partition_Length;
21 Success : out Boolean)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000022 is <>
Nico Huber51f60412023-12-04 14:48:11 +010023 with
24 Pre => not Is_Mounted (State),
25 Post => Success = Is_Mounted (State);
26
27 with procedure Open
28 (State : in out T;
29 File_Len : out File_Length;
30 File_Path : in String;
31 Success : out Boolean)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000032 is <>
Nico Huber51f60412023-12-04 14:48:11 +010033 with
34 Pre => Is_Mounted (State) and not Is_Open (State),
35 Post => Success = Is_Open (State);
36
37 with procedure Close (State : in out T)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000038 is <>
Nico Huber51f60412023-12-04 14:48:11 +010039 with
40 Pre => Is_Open (State),
41 Post => Is_Mounted (State);
42
43 with procedure Read
44 (State : in out T;
Nico Huber51f60412023-12-04 14:48:11 +010045 File_Pos : in out File_Offset;
46 Buf : out Buffer_Type;
47 Len : out Natural)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000048 is <>
Nico Huber51f60412023-12-04 14:48:11 +010049 with
50 Pre => Is_Open (State),
51 Post => Is_Open (State);
Nico Huberfdfa2e22023-11-27 16:26:03 +010052
Thomas Heijligen5c43abc2023-12-11 15:24:36 +000053package FILO.FS.VFS
Nico Huber691220d2023-12-04 14:54:01 +010054with
55 Convention => C
56is
Nico Huberfdfa2e22023-11-27 16:26:03 +010057
Nico Huber0a9591e2023-11-27 16:59:11 +010058 function C_Mount return int;
Nico Huberfdfa2e22023-11-27 16:26:03 +010059
Nico Huber0a9591e2023-11-27 16:59:11 +010060 function C_Open (File_Path : Strings.chars_ptr) return int;
Nico Huber51f60412023-12-04 14:48:11 +010061 procedure C_Close;
Nico Huberfdfa2e22023-11-27 16:26:03 +010062
Nico Huber0a9591e2023-11-27 16:59:11 +010063 function C_Read (Buf : System.Address; Len : int) return int;
Nico Huberfdfa2e22023-11-27 16:26:03 +010064
Thomas Heijligen5c43abc2023-12-11 15:24:36 +000065end FILO.FS.VFS;