aboutsummaryrefslogtreecommitdiff
path: root/util/block-helpers.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2024-10-10 17:01:40 +0200
committerMarkus Armbruster <armbru@redhat.com>2024-10-18 15:03:35 +0200
commit5551449bb8e58d0dacb43b3d436b201b28324ee9 (patch)
treecfbfce465a07ee0ea4821fd0034cce7cb578175c /util/block-helpers.c
parent0f799b83bd44b8ce6e2c577db9f6eb74770c14b8 (diff)
downloadqemu-5551449bb8e58d0dacb43b3d436b201b28324ee9.zip
qemu-5551449bb8e58d0dacb43b3d436b201b28324ee9.tar.gz
qemu-5551449bb8e58d0dacb43b3d436b201b28324ee9.tar.bz2
block: Adjust check_block_size() signature
Parameter @id is no longer used, drop. Return a bool to indicate success / failure, as recommended by qapi/error.h. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20241010150144.986655-4-armbru@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'util/block-helpers.c')
-rw-r--r--util/block-helpers.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/util/block-helpers.c b/util/block-helpers.c
index fb5de34..052b4e1 100644
--- a/util/block-helpers.c
+++ b/util/block-helpers.c
@@ -14,7 +14,6 @@
/**
* check_block_size:
- * @id: The unique ID of the object
* @name: The name of the property being validated
* @value: The block size in bytes
* @errp: A pointer to an area to store an error
@@ -23,13 +22,14 @@
* 1. At least MIN_BLOCK_SIZE
* 2. No larger than MAX_BLOCK_SIZE
* 3. A power of 2
+ *
+ * Returns: true on success, false on failure
*/
-void check_block_size(const char *id, const char *name, int64_t value,
- Error **errp)
+bool check_block_size(const char *name, int64_t value, Error **errp)
{
if (!value) {
/* unset */
- return;
+ return true;
}
if (value < MIN_BLOCK_SIZE || value > MAX_BLOCK_SIZE
@@ -38,5 +38,7 @@ void check_block_size(const char *id, const char *name, int64_t value,
"parameter %s must be a power of 2 between %" PRId64
" and %" PRId64,
name, MIN_BLOCK_SIZE, MAX_BLOCK_SIZE);
+ return false;
}
+ return true;
}