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 | |
| 6 | package body FS.FILO.VFS is |
| 7 | |
| 8 | function C_Mount return int |
| 9 | is |
| 10 | Success : Boolean; |
| 11 | begin |
| 12 | Mount (Success); |
| 13 | return (if Success then 1 else 0); |
| 14 | end C_Mount; |
| 15 | |
| 16 | function C_Open (File_Path : Strings.chars_ptr) return int |
| 17 | is |
| 18 | Success : Boolean; |
| 19 | begin |
| 20 | Open (Strings.Value (File_Path), Success); |
| 21 | return (if Success then 1 else 0); |
| 22 | end C_Open; |
| 23 | |
| 24 | function C_Read (Buf : System.Address; Len : int) return int |
| 25 | is |
| 26 | subtype Buffer_Range is Natural range 0 .. Integer (Len) - 1; |
| 27 | Buffer : Buffer_Type (Buffer_Range) |
| 28 | with |
| 29 | Convention => C, |
| 30 | Address => Buf; |
| 31 | |
| 32 | Read_Len : Natural; |
| 33 | begin |
| 34 | Read (Buffer, Read_Len); |
| 35 | return int (Read_Len); |
| 36 | end C_Read; |
| 37 | |
| 38 | end FS.FILO.VFS; |