blob: 500c77bdaa5c9452390b1ae4ff590f1687773bfb [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;
45 File_Len : in File_Length;
46 File_Pos : in out File_Offset;
47 Buf : out Buffer_Type;
48 Len : out Natural)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000049 is <>
Nico Huber51f60412023-12-04 14:48:11 +010050 with
51 Pre => Is_Open (State),
52 Post => Is_Open (State);
Nico Huberfdfa2e22023-11-27 16:26:03 +010053
Thomas Heijligen5c43abc2023-12-11 15:24:36 +000054package FILO.FS.VFS
Nico Huber691220d2023-12-04 14:54:01 +010055with
56 Convention => C
57is
Nico Huberfdfa2e22023-11-27 16:26:03 +010058
Nico Huber0a9591e2023-11-27 16:59:11 +010059 function C_Mount return int;
Nico Huberfdfa2e22023-11-27 16:26:03 +010060
Nico Huber0a9591e2023-11-27 16:59:11 +010061 function C_Open (File_Path : Strings.chars_ptr) return int;
Nico Huber51f60412023-12-04 14:48:11 +010062 procedure C_Close;
Nico Huberfdfa2e22023-11-27 16:26:03 +010063
Nico Huber0a9591e2023-11-27 16:59:11 +010064 function C_Read (Buf : System.Address; Len : int) return int;
Nico Huberfdfa2e22023-11-27 16:26:03 +010065
Thomas Heijligen5c43abc2023-12-11 15:24:36 +000066end FILO.FS.VFS;