• E
    qemu-img: Simplify logic in img_compare() · 7daddc61
    Eric Blake 提交于
    As long as we are querying the status for a chunk smaller than
    the known image size, we are guaranteed that a successful return
    will have set pnum to a non-zero size (pnum is zero only for
    queries beyond the end of the file).  Use that to slightly
    simplify the calculation of the current chunk size being compared.
    Likewise, we don't have to shrink the amount of data operated on
    until we know we have to read the file, and therefore have to fit
    in the bounds of our buffer.  Also, note that 'total_sectors_over'
    is equivalent to 'progress_base'.
    
    With these changes in place, sectors_to_process() is now dead code,
    and can be removed.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    Signed-off-by: NKevin Wolf <kwolf@redhat.com>
    7daddc61
qemu-img.c 139.4 KB