diff options
author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2012-02-07 13:27:24 +0000 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-02-09 16:17:50 +0100 |
commit | 1a6d39fd71ddf90c5b76026cac4d5ff51fbaf8d8 (patch) | |
tree | 9b15c86f85e8141f3a20cbf9f52ea21a0719e598 /qemu-common.h | |
parent | 7a65c8cc315c76bde6d692845c12e7ba06f44f89 (diff) |
cutils: extract buffer_is_zero() from qemu-img.c
The qemu-img.c:is_not_zero() function checks if a buffer contains all
zeroes. This function will come in handy for zero-detection in the
block layer, so clean it up and move it to cutils.c.
Note that the function now returns true if the buffer is all zeroes.
This avoids the double-negatives (i.e. !is_not_zero()) that the old
function can cause in callers.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-common.h')
-rw-r--r-- | qemu-common.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/qemu-common.h b/qemu-common.h index 9b997f8838..c5e9cad35e 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -335,6 +335,8 @@ void qemu_iovec_memset(QEMUIOVector *qiov, int c, size_t count); void qemu_iovec_memset_skip(QEMUIOVector *qiov, int c, size_t count, size_t skip); +bool buffer_is_zero(const void *buf, size_t len); + void qemu_progress_init(int enabled, float min_skip); void qemu_progress_end(void); void qemu_progress_print(float delta, int max); |