diff options
author | Matthias Bolte <matthias.bolte@googlemail.com> | 2011-01-28 22:03:24 +0100 |
---|---|---|
committer | Matthias Bolte <matthias.bolte@googlemail.com> | 2011-01-29 00:42:10 +0100 |
commit | d9ad8ac392635afc4ff9aaa5a15ebf48e96ac34e (patch) | |
tree | 9d8a7de1ccf5cab5cd6880f4e534d481621e8518 /src/internal.h | |
parent | 6fc1159d9499aae870cf285203465555dae6ce42 (diff) | |
download | libvirt-d9ad8ac392635afc4ff9aaa5a15ebf48e96ac34e.tar.gz |
Add VIR_DIV_UP to divide memory or storage request sizes with round up
Use it in all places where a memory or storage request size is converted
to a larger granularity. This avoids requesting too small memory or storage
sizes that could result from the truncation done by a simple division.
This extends the round up fix in 6002e0406c338668ea0ecbfeb6c1ef20a8b67efe
to the whole codebase.
Instead of reporting errors for odd values in the VMX code round them up.
Update the QEMU Argv tests accordingly as the original memory size 219200
isn't a even multiple of 1024 and is rounded up to 215 megabyte now. Change
it to 219100 and 219136. Use two different values intentionally to make
sure that rounding up works.
Update virsh.pod accordingly, as rounding down and rejecting are replaced
by rounding up.
Diffstat (limited to 'src/internal.h')
-rw-r--r-- | src/internal.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/internal.h b/src/internal.h index 038b862cc1..11ba45f899 100644 --- a/src/internal.h +++ b/src/internal.h @@ -231,4 +231,7 @@ } \ } while (0) +/* divide value by size, rounding up */ +# define VIR_DIV_UP(value, size) (((value) + (size) - 1) / (size)) + #endif /* __VIR_INTERNAL_H__ */ |