From 5551449bb8e58d0dacb43b3d436b201b28324ee9 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 10 Oct 2024 17:01:40 +0200 Subject: block: Adjust check_block_size() signature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Message-ID: <20241010150144.986655-4-armbru@redhat.com> Reviewed-by: Daniel P. Berrangé Reviewed-by: Philippe Mathieu-Daudé --- util/block-helpers.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'util/block-helpers.c') diff --git a/util/block-helpers.c b/util/block-helpers.c index fb5de348e2..052b4e1476 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; } -- cgit 1.4.1