@@ -13,7 +13,7 @@
#define MAX_BLOCK_SIZE (2 * MiB)
#define MAX_BLOCK_SIZE_STR "2 MiB"
-void check_logical_block_size(const char *id, const char *name, uint16_t value,
+void check_logical_block_size(const char *id, const char *name, int64_t value,
Error **errp);
#endif /* BLOCK_HELPERS_H */
@@ -22,7 +22,7 @@
*
* Moved from hw/core/qdev-properties.c:set_blocksize()
*/
-void check_logical_block_size(const char *id, const char *name, uint16_t value,
+void check_logical_block_size(const char *id, const char *name, int64_t value,
Error **errp)
{
/* value of 0 means "unset" */
@@ -37,7 +37,7 @@ void check_logical_block_size(const char *id, const char *name, uint16_t value,
error_setg(errp,
"Property %s.%s doesn't take value '%" PRId64
"', it's not a power of 2",
- id, name, (int64_t)value);
+ id, name, value);
return;
}
}
The uint16_t type is too small for MAX_BLOCK_SIZE (2 MiB). The int64_t type is widely used in QEMU as a type for disk offsets and sizes, so it's an appropriate type to use here. It will work for all callers. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> --- util/block-helpers.h | 2 +- util/block-helpers.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)