blob: 2b6dd52f94cd461da5ff7d39bb727fcbb505d6a2 [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
Nico Huber51f60412023-12-04 14:48:11 +010011 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 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)
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 Huberfdfa2e22023-11-27 16:26:03 +010049
Thomas Heijligend49cb122023-11-29 10:03:02 +000050package FS.FILO.VFS is
Nico Huberfdfa2e22023-11-27 16:26:03 +010051
Nico Huber0a9591e2023-11-27 16:59:11 +010052 function C_Mount return int;
Nico Huberfdfa2e22023-11-27 16:26:03 +010053
Nico Huber0a9591e2023-11-27 16:59:11 +010054 function C_Open (File_Path : Strings.chars_ptr) return int;
Nico Huber51f60412023-12-04 14:48:11 +010055 procedure C_Close;
Nico Huberfdfa2e22023-11-27 16:26:03 +010056
Nico Huber0a9591e2023-11-27 16:59:11 +010057 function C_Read (Buf : System.Address; Len : int) return int;
Nico Huberfdfa2e22023-11-27 16:26:03 +010058
59end FS.FILO.VFS;