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