Move fs-filo to filo-fs
Signed-off-by: Thomas Heijligen <src@posteo.de>
diff --git a/src/filo-blockdev.adb b/src/filo-blockdev.adb
new file mode 100644
index 0000000..28747e7
--- /dev/null
+++ b/src/filo-blockdev.adb
@@ -0,0 +1,23 @@
+package body FILO.Blockdev is
+
+ procedure Read
+ (Buffer : in out Buffer_Type;
+ Offset : in Natural;
+ Success : out Boolean)
+ is
+ use Interfaces.C;
+
+ Sector : constant unsigned_long := unsigned_long (Offset) / 512;
+ Byte_Offset : constant unsigned_long := unsigned_long (Offset) rem 512;
+ Byte_Len : constant unsigned_long := unsigned_long (Buffer'Length);
+ Buf : constant System.Address := Buffer'Address;
+
+ -- NOTE: C_devread returns 1 on success
+ function To_Success (Item : Interfaces.C.int) return Boolean is
+ (if Item = 1 then True else False);
+
+ begin
+ Success := To_Success (C_devread (Sector, Byte_Offset, Byte_Len, Buf));
+ end Read;
+
+end FILO.Blockdev;