blob: 5ae086cb2972367552fab52a75728b2223830c8d [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
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000011 with function Is_Mounted (State : T) return Boolean is <>;
12 with function Is_Open (State : T) return Boolean is <>
Nico Huber51f60412023-12-04 14:48:11 +010013 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)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000022 is <>
Nico Huber51f60412023-12-04 14:48:11 +010023 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 Huberb1cb2d32023-12-17 01:45:47 +010030 File_Type : out FS.File_Type;
31 File_Name : in String;
32 In_Root : in Boolean;
Nico Huber51f60412023-12-04 14:48:11 +010033 Success : out Boolean)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000034 is <>
Nico Huber51f60412023-12-04 14:48:11 +010035 with
Nico Huberb1cb2d32023-12-17 01:45:47 +010036 Pre => Is_Mounted (State),
Nico Huber51f60412023-12-04 14:48:11 +010037 Post => Success = Is_Open (State);
38
39 with procedure Close (State : in out T)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000040 is <>
Nico Huber51f60412023-12-04 14:48:11 +010041 with
42 Pre => Is_Open (State),
43 Post => Is_Mounted (State);
44
45 with procedure Read
46 (State : in out T;
Nico Huber51f60412023-12-04 14:48:11 +010047 File_Pos : in out File_Offset;
48 Buf : out Buffer_Type;
49 Len : out Natural)
Thomas Heijligen2f4d5972023-12-04 15:36:56 +000050 is <>
Nico Huber51f60412023-12-04 14:48:11 +010051 with
52 Pre => Is_Open (State),
53 Post => Is_Open (State);
Nico Huberfdfa2e22023-11-27 16:26:03 +010054
Thomas Heijligen5c43abc2023-12-11 15:24:36 +000055package FILO.FS.VFS
Nico Huber691220d2023-12-04 14:54:01 +010056with
57 Convention => C
58is
Nico Huberfdfa2e22023-11-27 16:26:03 +010059
Nico Huber0a9591e2023-11-27 16:59:11 +010060 function C_Mount return int;
Nico Huberfdfa2e22023-11-27 16:26:03 +010061
Nico Huber0a9591e2023-11-27 16:59:11 +010062 function C_Open (File_Path : Strings.chars_ptr) return int;
Nico Huber51f60412023-12-04 14:48:11 +010063 procedure C_Close;
Nico Huberfdfa2e22023-11-27 16:26:03 +010064
Nico Huber0a9591e2023-11-27 16:59:11 +010065 function C_Read (Buf : System.Address; Len : int) return int;
Nico Huberfdfa2e22023-11-27 16:26:03 +010066
Thomas Heijligen5c43abc2023-12-11 15:24:36 +000067end FILO.FS.VFS;