blob: 3291bc8fb4c02ad49d6882cc632fab533fc3a3ee [file] [log] [blame]
Nico Huberfdfa2e22023-11-27 16:26:03 +01001with System;
2with Interfaces.C;
Nico Huberfdfa2e22023-11-27 16:26:03 +01003
4use Interfaces.C;
5
6generic
7
Nico Huber51f60412023-12-04 14:48:11 +01008 type T (<>) is private;
Nico Huberfdfa2e22023-11-27 16:26:03 +01009
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000010 with function Is_Mounted (State : T) return Boolean is <>;
11 with function Is_Open (State : T) return Boolean is <>
Nico Huber51f60412023-12-04 14:48:11 +010012 with
13 Post => (if Is_Open'Result then Is_Mounted (State));
Nico Huberfdfa2e22023-11-27 16:26:03 +010014
Nico Huber51f60412023-12-04 14:48:11 +010015 Initial : T;
16
17 with procedure Mount
18 (State : in out T;
19 Part_Len : in Partition_Length;
20 Success : out Boolean)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000021 is <>
Nico Huber51f60412023-12-04 14:48:11 +010022 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 Huberb1cb2d32023-12-17 01:45:47 +010029 File_Type : out FS.File_Type;
30 File_Name : in String;
31 In_Root : in Boolean;
Nico Huber51f60412023-12-04 14:48:11 +010032 Success : out Boolean)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000033 is <>
Nico Huber51f60412023-12-04 14:48:11 +010034 with
Nico Huberb1cb2d32023-12-17 01:45:47 +010035 Pre => Is_Mounted (State),
Nico Huber51f60412023-12-04 14:48:11 +010036 Post => Success = Is_Open (State);
37
38 with procedure Close (State : in out T)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000039 is <>
Nico Huber51f60412023-12-04 14:48:11 +010040 with
41 Pre => Is_Open (State),
42 Post => Is_Mounted (State);
43
44 with procedure Read
45 (State : in out T;
Nico Huber51f60412023-12-04 14:48:11 +010046 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 Huber3da21472023-12-18 15:43:35 +010061 function C_Open (File_Path : System.Address) 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;