[PATCH] Make BlockSize * NumberOfBlocks result in the correct number of bytes

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1210266649 25200 # Node ID 7d8223bceaf3206b13443db42e95d9e505ce5ff7 # Parent c2465f3f0a2472a45f90707ce9653ad2c59bb50b Make BlockSize * NumberOfBlocks result in the correct number of bytes Currently it adds up to kilobytes, so shift the size we get from libvirt appropriately before doing the calculation. Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r c2465f3f0a24 -r 7d8223bceaf3 src/Virt_Device.c --- a/src/Virt_Device.c Thu May 08 09:36:30 2008 -0700 +++ b/src/Virt_Device.c Thu May 08 10:10:49 2008 -0700 @@ -141,8 +141,8 @@ static int mem_set_size(CMPIInstance *in { uint64_t consumableblocks, numberofblocks; - consumableblocks = dev->size/XEN_MEM_BLOCKSIZE; - numberofblocks = dev->maxsize/XEN_MEM_BLOCKSIZE; + consumableblocks = (dev->size << 10) / XEN_MEM_BLOCKSIZE; + numberofblocks = (dev->maxsize << 10) / XEN_MEM_BLOCKSIZE; CMSetProperty(instance, "BlockSize", (CMPIValue *)&XEN_MEM_BLOCKSIZE, CMPI_uint64);

Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1210266649 25200 # Node ID 7d8223bceaf3206b13443db42e95d9e505ce5ff7 # Parent c2465f3f0a2472a45f90707ce9653ad2c59bb50b Make BlockSize * NumberOfBlocks result in the correct number of bytes
Currently it adds up to kilobytes, so shift the size we get from libvirt appropriately before doing the calculation.
Signed-off-by: Dan Smith <danms@us.ibm.com>
diff -r c2465f3f0a24 -r 7d8223bceaf3 src/Virt_Device.c
+1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Dan Smith
-
Kaitlin Rupert