]> git.proxmox.com Git - mirror_qemu.git/commit - qemu-img.c
qemu-img: Change compare_sectors() to be byte-based
authorEric Blake <eblake@redhat.com>
Thu, 12 Oct 2017 03:47:14 +0000 (22:47 -0500)
committerKevin Wolf <kwolf@redhat.com>
Thu, 26 Oct 2017 12:45:57 +0000 (14:45 +0200)
commitdc61cd3b144151024a247a109f360d2e2cab0f81
tree15e9090999c2de05a34c87ad2c0b00fbb4be46d5
parentc41508edc68aefb784c3b750bbbff472eca1a3c5
qemu-img: Change compare_sectors() to be byte-based

In the continuing quest to make more things byte-based, change
compare_sectors(), renaming it to compare_buffers() in the
process.  Note that one caller (qemu-img compare) only cares
about the first difference, while the other (qemu-img rebase)
cares about how many consecutive sectors have the same
equal/different status; however, this patch does not bother to
micro-optimize the compare case to avoid the comparisons of
sectors beyond the first mismatch.  Both callers are always
passing valid buffers in, so the initial check for buffer size
can be turned into an assertion.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-img.c