qemu: driver: Stop using QEMU_ADD_BLOCK_PARAM_ULL in qemuDomainGetStatsOneBlockFallback

The open-coded version does not take much more space and additionally we
get rid of the hidden goto.

This also requires us to remove the 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-09-19 11:01:48 +02:00
parent 2ccb5335dc
commit bb722855ca

View File

@ -21362,8 +21362,6 @@ qemuDomainGetStatsOneBlockFallback(virQEMUDriverPtr driver,
virStorageSourcePtr src, virStorageSourcePtr src,
size_t block_idx) size_t block_idx)
{ {
int ret = -1;
if (virStorageSourceIsEmpty(src)) if (virStorageSourceIsEmpty(src))
return 0; return 0;
@ -21372,18 +21370,22 @@ qemuDomainGetStatsOneBlockFallback(virQEMUDriverPtr driver,
return 0; return 0;
} }
if (src->allocation) if (src->allocation &&
QEMU_ADD_BLOCK_PARAM_ULL(params, block_idx, virTypedParamListAddULLong(params, src->allocation,
"allocation", src->allocation); "block.%zu.allocation", block_idx) < 0)
if (src->capacity) return -1;
QEMU_ADD_BLOCK_PARAM_ULL(params, block_idx,
"capacity", src->capacity); if (src->capacity &&
if (src->physical) virTypedParamListAddULLong(params, src->capacity,
QEMU_ADD_BLOCK_PARAM_ULL(params, block_idx, "block.%zu.capacity", block_idx) < 0)
"physical", src->physical); return -1;
ret = 0;
cleanup: if (src->physical &&
return ret; virTypedParamListAddULLong(params, src->physical,
"block.%zu.physical", block_idx) < 0)
return -1;
return 0;
} }