blob: ba7bc6d484078e3eaff7fd5d4a76f980dd8d9577 [file] [log] [blame]
package body FILO.Blockdev is
procedure Read
(Buffer : in out Buffer_Type;
Offset : in Blockdev_Offset;
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;