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 | |
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame^] | 11 | with function Is_Mounted (State : T) return Boolean; |
| 12 | with function Is_Open (State : T) return Boolean |
| 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) |
| 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; |
| 29 | File_Path : in String; |
| 30 | Success : out Boolean) |
| 31 | with |
| 32 | Pre => Is_Mounted (State) and not Is_Open (State), |
| 33 | Post => Success = Is_Open (State); |
| 34 | |
| 35 | with procedure Close (State : in out T) |
| 36 | with |
| 37 | Pre => Is_Open (State), |
| 38 | Post => Is_Mounted (State); |
| 39 | |
| 40 | with procedure Read |
| 41 | (State : in out T; |
| 42 | File_Len : in File_Length; |
| 43 | File_Pos : in out File_Offset; |
| 44 | Buf : out Buffer_Type; |
| 45 | Len : out Natural) |
| 46 | with |
| 47 | Pre => Is_Open (State), |
| 48 | Post => Is_Open (State); |
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 49 | |
Thomas Heijligen | d49cb12 | 2023-11-29 10:03:02 +0000 | [diff] [blame] | 50 | package FS.FILO.VFS is |
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 51 | |
Nico Huber | 0a9591e | 2023-11-27 16:59:11 +0100 | [diff] [blame] | 52 | function C_Mount return int; |
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 53 | |
Nico Huber | 0a9591e | 2023-11-27 16:59:11 +0100 | [diff] [blame] | 54 | function C_Open (File_Path : Strings.chars_ptr) return int; |
Nico Huber | 51f6041 | 2023-12-04 14:48:11 +0100 | [diff] [blame^] | 55 | procedure C_Close; |
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 56 | |
Nico Huber | 0a9591e | 2023-11-27 16:59:11 +0100 | [diff] [blame] | 57 | function C_Read (Buf : System.Address; Len : int) return int; |
Nico Huber | fdfa2e2 | 2023-11-27 16:26:03 +0100 | [diff] [blame] | 58 | |
| 59 | end FS.FILO.VFS; |