X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=diskzip%2Fdiskzip.ml;h=7e2969a7a4ebca27c9fdfaad41ab8063cc54f156;hb=264faa6f381b1972327f830e3fca5ddd5881ff92;hp=3de7f6383862383113ed96c24b30b4add5d60a71;hpb=21643d806233bbc2462795bb5901d44f3cdf4ecf;p=virt-df.git diff --git a/diskzip/diskzip.ml b/diskzip/diskzip.ml index 3de7f63..7e2969a 100644 --- a/diskzip/diskzip.ml +++ b/diskzip/diskzip.ml @@ -20,7 +20,9 @@ open Unix open Printf +open Int63.Operators open Diskzip_gettext.Gettext +module Bitmap = Diskzip_bitmap type output = File of string | Dir of string type extcompress = BZip2 | GZip | External of string @@ -151,7 +153,29 @@ and go_compress extcompress images = let ownership = Diskimage.create_ownership machine in (* Create ownership bitmap for each disk. *) - + List.iter ( + fun { Diskimage.d_name = name; d_dev = disk } -> + let blocksize = disk#blocksize in + let size = disk#size in (* Size in bytes. *) + let nr_blocks = size /^ blocksize in (* Number of disk sectors. *) + + if !Diskimage.debug then + eprintf "Creating bitmap for %s (%s sectors) ...\n%!" + disk#name (Int63.to_string nr_blocks); + + (* Create an empty bitmap, one bit per sector. *) + let bitmap = Bitmap.create nr_blocks in + + (* Get the lookup function for this disk. *) + let lookup = Diskimage.get_owners_lookup machine ownership disk in + + (* Lookup each sector. *) + Bitmap.iter_set ( + fun blk _ -> + let owners = lookup blk in + false + ) bitmap + ) machine.Diskimage.m_disks; (* Redirect output through external pipe if asked. *) (match extcompress with