From: Richard W.M. Jones <"Richard W.M. Jones "> Date: Tue, 13 May 2008 20:04:23 +0000 (+0100) Subject: Fixes for 32 bit X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=55367debbc746759d3536e163d46b104cb58f323;p=virt-df.git Fixes for 32 bit --- diff --git a/diskzip/.depend b/diskzip/.depend index e54de33..2bb5a71 100644 --- a/diskzip/.depend +++ b/diskzip/.depend @@ -1,4 +1,4 @@ diskzip.cmo: ../lib/int63.cmi diskzip_gettext.cmo ../lib/diskimage.cmi \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskzip.cmx: ../lib/int63.cmx diskzip_gettext.cmx ../lib/diskimage.cmx \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diff --git a/lib/.depend b/lib/.depend index f0db824..98898a6 100644 --- a/lib/.depend +++ b/lib/.depend @@ -1,39 +1,39 @@ -diskimage_impl.cmi: int63.cmi /usr/lib64/ocaml/bitmatch/bitmatch.cmi +diskimage_impl.cmi: int63.cmi /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_lvm2_metadata.cmi: int63.cmi diskimage_lvm2_parser.cmi: int63.cmi diskimage_lvm2_metadata.cmi -diskimage.cmi: int63.cmi /usr/lib64/ocaml/bitmatch/bitmatch.cmi +diskimage.cmi: int63.cmi /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_ext2.cmo: int63.cmi diskimage_impl.cmi \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_ext2.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_ext2.cmi diskimage_ext2.cmx: int63.cmx diskimage_impl.cmx \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_ext2.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_ext2.cmi diskimage_fat.cmo: int63.cmi diskimage_impl.cmi \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_fat.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_fat.cmi diskimage_fat.cmx: int63.cmx diskimage_impl.cmx \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_fat.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_fat.cmi diskimage_impl.cmo: int63.cmi diskimage_impl.cmi diskimage_impl.cmx: int63.cmx diskimage_impl.cmi diskimage_linux_swap.cmo: int63.cmi diskimage_impl.cmi \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_linux_swap.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_linux_swap.cmi diskimage_linux_swap.cmx: int63.cmx diskimage_impl.cmx \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_linux_swap.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_linux_swap.cmi diskimage_linux_swsuspend.cmo: int63.cmi diskimage_impl.cmi \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_linux_swsuspend.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_linux_swsuspend.cmi diskimage_linux_swsuspend.cmx: int63.cmx diskimage_impl.cmx \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_linux_swsuspend.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_linux_swsuspend.cmi diskimage_lvm2_metadata.cmo: int63.cmi diskimage_lvm2_metadata.cmi diskimage_lvm2_metadata.cmx: int63.cmx diskimage_lvm2_metadata.cmi diskimage_lvm2.cmo: int63.cmi diskimage_lvm2_metadata.cmi diskimage_impl.cmi \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_lvm2.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_lvm2.cmi diskimage_lvm2.cmx: int63.cmx diskimage_lvm2_metadata.cmx diskimage_impl.cmx \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_lvm2.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_lvm2.cmi diskimage_lvm2_parser.cmo: int63.cmi diskimage_lvm2_metadata.cmi \ diskimage_lvm2_parser.cmi diskimage_lvm2_parser.cmx: int63.cmx diskimage_lvm2_metadata.cmx \ diskimage_lvm2_parser.cmi diskimage_mbr.cmo: int63.cmi diskimage_impl.cmi \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_mbr.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_mbr.cmi diskimage_mbr.cmx: int63.cmx diskimage_impl.cmx \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_mbr.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_mbr.cmi diskimage.cmo: diskimage_ntfs.cmi diskimage_mbr.cmi diskimage_lvm2.cmi \ diskimage_linux_swsuspend.cmi diskimage_linux_swap.cmi diskimage_impl.cmi \ diskimage_fat.cmi diskimage_ext2.cmi diskimage.cmi @@ -41,9 +41,9 @@ diskimage.cmx: diskimage_ntfs.cmx diskimage_mbr.cmx diskimage_lvm2.cmx \ diskimage_linux_swsuspend.cmx diskimage_linux_swap.cmx diskimage_impl.cmx \ diskimage_fat.cmx diskimage_ext2.cmx diskimage.cmi diskimage_ntfs.cmo: int63.cmi diskimage_impl.cmi \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_ntfs.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_ntfs.cmi diskimage_ntfs.cmx: int63.cmx diskimage_impl.cmx \ - /usr/lib64/ocaml/bitmatch/bitmatch.cmi diskimage_ntfs.cmi + /usr/lib/ocaml/bitmatch/bitmatch.cmi diskimage_ntfs.cmi int63.cmo: int63.cmi int63.cmx: int63.cmi int63_on_32.cmo: int63_on_32.cmi diff --git a/lib/diskimage_fat.ml b/lib/diskimage_fat.ml index d428b95..7c2108e 100644 --- a/lib/diskimage_fat.ml +++ b/lib/diskimage_fat.ml @@ -142,7 +142,7 @@ and probe_superblock dev = fs_cb = callbacks (); fs_dev = fs_dev; fs_blocksize = blocksize; - fs_blocks_total = number_of_sectors *^ bytes_per_sector /^ blocksize; + fs_blocks_total = number_of_sectors *^ sectorsize /^ blocksize; fs_is_swap = false; fs_blocks_reserved = blocks_reserved; fs_blocks_avail = blocks_avail; @@ -175,7 +175,7 @@ and iter_fat_entries { fat_dev = dev; fat_sectorsize = sectorsize; fat_sectors_per_fat = size } f = let cn = ref ~^0 in - for i = 0 to size-1 do + for i = 0 to (Int63.to_int size)-1 do let sector = dev#read_bitstring ((start +^ Int63.of_int i) *^ sectorsize) sectorsize in let rec loop bits = @@ -186,12 +186,13 @@ and iter_fat_entries { fat_dev = dev; fat_sectorsize = sectorsize; | 0 -> Free | 1 -> Reserved1 | (0xffffff0|0xffffff1|0xffffff2|0xffffff3| - 0xffffff4|0xffffff5|0xffffff6) as r -> Reserved r + 0xffffff4|0xffffff5|0xffffff6) as r -> + Reserved (Int63.of_int r) | 0xffffff7 -> Bad | (0xffffff8|0xffffff9|0xffffffa|0xffffffb| 0xffffffc|0xffffffd|0xffffffe| - 0xfffffff) as r -> Last r - | _ -> Used e in + 0xfffffff) as r -> Last (Int63.of_int r) + | _ -> Used (Int63.of_int e) in if !cn >= ~^2 then f !cn e; cn := !cn +^ ~^1; diff --git a/lib/diskimage_mbr.ml b/lib/diskimage_mbr.ml index 6839380..4acbaf3 100644 --- a/lib/diskimage_mbr.ml +++ b/lib/diskimage_mbr.ml @@ -185,14 +185,14 @@ and probe_extended_partition max dev start = * to the current sector. *) let ppriv = - { ppriv with mbr_part_start = ppriv.mbr_part_start + start } in + { ppriv with mbr_part_start = ppriv.mbr_part_start +^ start } in let (next, npriv) = parse_mbr_entry next in if next.part_status = NullEntry then [ part, ppriv ] (* End of list. *) else ( - let start_of_next = start + npriv.mbr_part_start in + let start_of_next = start +^ npriv.mbr_part_start in (part, ppriv) :: probe_extended_partition (max-1) dev start_of_next ) diff --git a/lib/diskimage_ntfs.ml b/lib/diskimage_ntfs.ml index d0f2f49..50ae581 100644 --- a/lib/diskimage_ntfs.ml +++ b/lib/diskimage_ntfs.ml @@ -112,6 +112,7 @@ and probe_superblock dev = let blocksize = Int63.of_int blocksize in let number_of_sectors = Int63.of_int64 number_of_sectors in + let bytes_per_sector = Int63.of_int bytes_per_sector in (* The blocksize of the filesystem is likely to be quite different * from that of the underlying device, so create an overlay device @@ -530,7 +531,7 @@ and iter_blocks { ntfs_blocksize = blocksize; ntfs_dev = dev } let vcnsize = ref vcnsize in while !vcnsize > ~^0 && !data_size > ~^0 do let size = min blocksize !data_size in - let data = String.make size '\000' in + let data = String.make (Int63.to_int size) '\000' in f None !vcn data; vcn := !vcn +^ ~^1; vcnsize := !vcnsize -^ ~^1; @@ -572,7 +573,7 @@ and read_file { ntfs_blocksize = blocksize; ntfs_dev = dev } let data = match lcn with | Some lcn -> dev#read (lcn *^ blocksize +^ vcnoffset) size - | None -> String.make size '\000' (* sparse hole *) in + | None -> String.make (Int63.to_int size) '\000' (* sparse hole *) in data (* This is easy: just look at the bitmap. *) @@ -590,7 +591,7 @@ and offset_is_free fs offset = let byteoffset = lcn >^> 3 and bitoffset = lcn &^ ~^7 in let byte = read_file ntfs file byteoffset ~^1 in let byte = Char.code byte.[0] in - let bit = byte >^> (~^0x80 >^> (Int63.to_int bitoffset)) in + let bit = Int63.of_int byte >^> (0x80 lsr Int63.to_int bitoffset) in bit <> ~^0 with