[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/6] block-helpers: switch to int64_t block size values
From: |
Stefan Hajnoczi |
Subject: |
[PATCH 2/6] block-helpers: switch to int64_t block size values |
Date: |
Fri, 19 Jun 2020 13:01:53 +0100 |
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(-)
diff --git a/util/block-helpers.h b/util/block-helpers.h
index 46975ca7af..ec6421560c 100644
--- a/util/block-helpers.h
+++ b/util/block-helpers.h
@@ -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 */
diff --git a/util/block-helpers.c b/util/block-helpers.c
index 089fe3401d..9e68954c46 100644
--- a/util/block-helpers.c
+++ b/util/block-helpers.c
@@ -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;
}
}
--
2.26.2
- [PATCH 1/6] vhost-user-server: fix VHOST_MEMORY_MAX_REGIONS compiler error, (continued)
- [PATCH 1/6] vhost-user-server: fix VHOST_MEMORY_MAX_REGIONS compiler error, Stefan Hajnoczi, 2020/06/19
- [PATCH 3/6] vhost-user-server: adjust vhost_user_server_set_aio_context() arguments, Stefan Hajnoczi, 2020/06/19
- [PATCH 2/6] vhost-user-server: drop unused #include <eventfd.h>, Stefan Hajnoczi, 2020/06/19
- [PATCH 5/6] vhost-user-server: fix s/initialized/initialize/ typo, Stefan Hajnoczi, 2020/06/19
- [PATCH 6/6] vhost-user-server: use DevicePanicNotifierFn everywhere, Stefan Hajnoczi, 2020/06/19
- [PATCH 4/6] vhost-user-server: mark fd handlers "external", Stefan Hajnoczi, 2020/06/19
- Re: [PATCH v9 2/5] generic vhost user server, Stefan Hajnoczi, 2020/06/19
- [PATCH v9 3/5] move logical block size check function to a common utility function, Coiby Xu, 2020/06/14
- [PATCH v9 4/5] vhost-user block device backend server, Coiby Xu, 2020/06/14
- [PATCH v9 5/5] new qTest case to test the vhost-user-blk-server, Coiby Xu, 2020/06/14