From 63b6e59fd00a871d825d1c6f5c6c78e5e0c2a38c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Mon, 7 Oct 2013 15:57:22 +0200 Subject: [PATCH] storage: Use bool instead of int Commit 532fef3 added two-state 'need_alloc' and exposed 'want_sparse' which also only has two states. Change their type from int to bool. --- src/storage/storage_backend.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 662af3266f..4eec0f3c6c 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -129,7 +129,7 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol, virStorageVolDefPtr inputvol, int fd, unsigned long long *total, - int want_sparse) + bool want_sparse) { int inputfd = -1; int amtread = -1; @@ -270,7 +270,7 @@ virStorageBackendCreateBlockFrom(virConnectPtr conn ATTRIBUTE_UNUSED, if (inputvol) { int res = virStorageBackendCopyToFD(vol, inputvol, - fd, &remain, 0); + fd, &remain, false); if (res < 0) goto cleanup; } @@ -315,7 +315,7 @@ static int createRawFile(int fd, virStorageVolDefPtr vol, virStorageVolDefPtr inputvol) { - int need_alloc = 1; + bool need_alloc = true; int ret = 0; unsigned long long remain; @@ -338,7 +338,7 @@ createRawFile(int fd, virStorageVolDefPtr vol, * available, and since we're going to copy data from another * file it doesn't make sense to write the file twice. */ if (fallocate(fd, 0, 0, vol->allocation) == 0) { - need_alloc = 0; + need_alloc = false; } else if (errno != ENOSYS && errno != EOPNOTSUPP) { ret = -errno; virReportSystemError(errno, @@ -354,8 +354,8 @@ createRawFile(int fd, virStorageVolDefPtr vol, /* allow zero blocks to be skipped if we've requested sparse * allocation (allocation < capacity) or we have already * been able to allocate the required space. */ - int want_sparse = (need_alloc == 0) || - (vol->allocation < inputvol->capacity); + bool want_sparse = !need_alloc || + (vol->allocation < inputvol->capacity); ret = virStorageBackendCopyToFD(vol, inputvol, fd, &remain, want_sparse); if (ret < 0) {