Prepare Blockdev for 32-bit longs
diff --git a/src/filo-blockdev.adb b/src/filo-blockdev.adb
index ba7bc6d..e0c4ebb 100644
--- a/src/filo-blockdev.adb
+++ b/src/filo-blockdev.adb
@@ -7,8 +7,8 @@
    is
       use Interfaces.C;
 
-      Sector      : constant unsigned_long  := unsigned_long (Offset) / 512;
-      Byte_Offset : constant unsigned_long  := unsigned_long (Offset) rem 512;
+      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;
 
@@ -17,6 +17,12 @@
          (if Item = 1 then True else False);
 
    begin
+      -- With 32-bit longs, the current C interface
+      -- can't access more than 512 * 2 ** 32:
+      if Offset / 512 > Blockdev_Length (unsigned_long'last) then
+         Success := False;
+         return;
+      end if;
       Success := To_Success (C_devread (Sector, Byte_Offset, Byte_Len, Buf));
    end Read;