Nico Huber | 0a9591e | 2023-11-27 16:59:11 +0100 | [diff] [blame] | 1 | with Interfaces.C; |
| 2 | with Interfaces.C.Strings; |
| 3 | |
| 4 | use Interfaces.C; |
| 5 | |
Thomas Heijligen | d49cb12 | 2023-11-29 10:03:02 +0000 | [diff] [blame^] | 6 | package body FS.FILO.VFS |
| 7 | with |
| 8 | SPARK_Mode => Off, |
| 9 | Convention => C |
| 10 | is |
Nico Huber | 0a9591e | 2023-11-27 16:59:11 +0100 | [diff] [blame] | 11 | |
| 12 | function C_Mount return int |
| 13 | is |
| 14 | Success : Boolean; |
| 15 | begin |
| 16 | Mount (Success); |
| 17 | return (if Success then 1 else 0); |
| 18 | end C_Mount; |
| 19 | |
| 20 | function C_Open (File_Path : Strings.chars_ptr) return int |
| 21 | is |
| 22 | Success : Boolean; |
| 23 | begin |
| 24 | Open (Strings.Value (File_Path), Success); |
| 25 | return (if Success then 1 else 0); |
| 26 | end C_Open; |
| 27 | |
| 28 | function C_Read (Buf : System.Address; Len : int) return int |
| 29 | is |
| 30 | subtype Buffer_Range is Natural range 0 .. Integer (Len) - 1; |
| 31 | Buffer : Buffer_Type (Buffer_Range) |
| 32 | with |
| 33 | Convention => C, |
| 34 | Address => Buf; |
| 35 | |
| 36 | Read_Len : Natural; |
| 37 | begin |
| 38 | Read (Buffer, Read_Len); |
| 39 | return int (Read_Len); |
| 40 | end C_Read; |
| 41 | |
| 42 | end FS.FILO.VFS; |