Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 1 | with System; |
2 | with Interfaces.C; | ||||
3 | with Interfaces.C.Strings; | ||||
4 | |||||
5 | use Interfaces.C; | ||||
6 | |||||
7 | generic | ||||
8 | |||||
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame] | 9 | type T (<>) is private; |
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 10 | |
Thomas Heijligen | 2f4d597 | 2023-12-04 15:36:56 +0000 | [diff] [blame] | 11 | with function Is_Mounted (State : T) return Boolean is <>; |
12 | with function Is_Open (State : T) return Boolean is <> | ||||
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame] | 13 | with |
14 | Post => (if Is_Open'Result then Is_Mounted (State)); | ||||
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 15 | |
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame] | 16 | Initial : T; |
17 | |||||
18 | with procedure Mount | ||||
19 | (State : in out T; | ||||
20 | Part_Len : in Partition_Length; | ||||
21 | Success : out Boolean) | ||||
Thomas Heijligen | 2f4d597 | 2023-12-04 15:36:56 +0000 | [diff] [blame] | 22 | is <> |
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame] | 23 | 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; | ||||
Nico Huber | b1cb2d3 | 2023-12-17 01:45:47 +0100 | [diff] [blame] | 30 | File_Type : out FS.File_Type; |
31 | File_Name : in String; | ||||
32 | In_Root : in Boolean; | ||||
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame] | 33 | Success : out Boolean) |
Thomas Heijligen | 2f4d597 | 2023-12-04 15:36:56 +0000 | [diff] [blame] | 34 | is <> |
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame] | 35 | with |
Nico Huber | b1cb2d3 | 2023-12-17 01:45:47 +0100 | [diff] [blame] | 36 | Pre => Is_Mounted (State), |
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame] | 37 | Post => Success = Is_Open (State); |
38 | |||||
39 | with procedure Close (State : in out T) | ||||
Thomas Heijligen | 2f4d597 | 2023-12-04 15:36:56 +0000 | [diff] [blame] | 40 | is <> |
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame] | 41 | with |
42 | Pre => Is_Open (State), | ||||
43 | Post => Is_Mounted (State); | ||||
44 | |||||
45 | with procedure Read | ||||
46 | (State : in out T; | ||||
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame] | 47 | File_Pos : in out File_Offset; |
48 | Buf : out Buffer_Type; | ||||
49 | Len : out Natural) | ||||
Thomas Heijligen | 2f4d597 | 2023-12-04 15:36:56 +0000 | [diff] [blame] | 50 | is <> |
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame] | 51 | with |
52 | Pre => Is_Open (State), | ||||
53 | Post => Is_Open (State); | ||||
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 54 | |
Thomas Heijligen | 5c43abc | 2023-12-11 15:24:36 +0000 | [diff] [blame] | 55 | package FILO.FS.VFS |
Nico Huber | 691220d | 2023-12-04 14:54:01 +0100 | [diff] [blame] | 56 | with |
57 | Convention => C | ||||
58 | is | ||||
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 59 | |
Nico Huber | 0a9591e | 2023-11-27 16:59:11 +0100 | [diff] [blame] | 60 | function C_Mount return int; |
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 61 | |
Nico Huber | 3da2147 | 2023-12-18 15:43:35 +0100 | [diff] [blame^] | 62 | function C_Open (File_Path : System.Address) return int; |
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame] | 63 | procedure C_Close; |
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 64 | |
Nico Huber | 0a9591e | 2023-11-27 16:59:11 +0100 | [diff] [blame] | 65 | function C_Read (Buf : System.Address; Len : int) return int; |
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 66 | |
Thomas Heijligen | 5c43abc | 2023-12-11 15:24:36 +0000 | [diff] [blame] | 67 | end FILO.FS.VFS; |