From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Michael Roth" <michael.roth@amd.com>
Subject: Re: [PATCH 1/6] qapi: change 'unsigned special_features' to 'uint64_t features'
Date: Mon, 05 Aug 2024 13:53:38 +0200 [thread overview]
Message-ID: <87h6bzp4n1.fsf@pond.sub.org> (raw)
In-Reply-To: <20240801175913.669013-2-berrange@redhat.com> ("Daniel P. Berrangé"'s message of "Thu, 1 Aug 2024 18:59:08 +0100")
Daniel P. Berrangé <berrange@redhat.com> writes:
> The "special_features" field / parameter holds the subset of schema
> features that are for internal code use. Specifically 'DEPRECATED'
> and 'UNSTABLE'.
>
> This special casing of internal features is going to be removed, so
> prepare for that by renaming to 'features'. Using a fixed size type
> is also best practice for bit fields.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
[...]
> static void forward_field_complete(Visitor *v, void *opaque)
> diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
> index 65a7d18437..3d849fe034 100644
> --- a/qapi/qapi-util.c
> +++ b/qapi/qapi-util.c
> @@ -37,19 +37,19 @@ static bool compat_policy_input_ok1(const char *adjective,
> }
> }
>
> -bool compat_policy_input_ok(unsigned special_features,
> +bool compat_policy_input_ok(uint64_t features,
> const CompatPolicy *policy,
> ErrorClass error_class,
> const char *kind, const char *name,
> Error **errp)
> {
> - if ((special_features & 1u << QAPI_DEPRECATED)
> + if ((features & 1u << QAPI_DEPRECATED)
Before the patch, both operands of & are unsigned. The patch changes
one of them to uint64_t. Shouldn't we change the other one, too?
> && !compat_policy_input_ok1("Deprecated",
> policy->deprecated_input,
> error_class, kind, name, errp)) {
> return false;
> }
> - if ((special_features & (1u << QAPI_UNSTABLE))
> + if ((features & (1u << QAPI_UNSTABLE))
Likewise.
> && !compat_policy_input_ok1("Unstable",
> policy->unstable_input,
> error_class, kind, name, errp)) {
[...]
> diff --git a/qapi/qobject-output-visitor.c b/qapi/qobject-output-visitor.c
> index 74770edd73..8902287caa 100644
> --- a/qapi/qobject-output-visitor.c
> +++ b/qapi/qobject-output-visitor.c
> @@ -210,13 +210,13 @@ static bool qobject_output_type_null(Visitor *v, const char *name,
> }
>
> static bool qobject_output_policy_skip(Visitor *v, const char *name,
> - unsigned special_features)
> + uint64_t features)
> {
> CompatPolicy *pol = &v->compat_policy;
>
> - return ((special_features & 1u << QAPI_DEPRECATED)
> + return ((features & 1u << QAPI_DEPRECATED)
Likewise.
> && pol->deprecated_output == COMPAT_POLICY_OUTPUT_HIDE)
> - || ((special_features & 1u << QAPI_UNSTABLE)
> + || ((features & 1u << QAPI_UNSTABLE)
Likewise.
> && pol->unstable_output == COMPAT_POLICY_OUTPUT_HIDE);
> }
>
[...]
next prev parent reply other threads:[~2024-08-05 12:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 17:59 [PATCH 0/6] qapi: generalize special features Daniel P. Berrangé
2024-08-01 17:59 ` [PATCH 1/6] qapi: change 'unsigned special_features' to 'uint64_t features' Daniel P. Berrangé
2024-08-05 11:53 ` Markus Armbruster [this message]
2024-08-01 17:59 ` [PATCH 2/6] scripts/qapi: rename 'special_features' to 'features' Daniel P. Berrangé
2024-08-05 11:59 ` Markus Armbruster
2024-08-01 17:59 ` [PATCH 3/6] qapi: use "QAPI_FEATURE" as namespace for features Daniel P. Berrangé
2024-08-05 12:01 ` Markus Armbruster
2024-08-01 17:59 ` [PATCH 4/6] qapi: cope with feature names containing a '-' Daniel P. Berrangé
2024-08-05 12:10 ` Markus Armbruster
2024-08-01 17:59 ` [PATCH 5/6] qapi: apply schema prefix to QAPI feature enum constants Daniel P. Berrangé
2024-08-05 12:22 ` Markus Armbruster
2024-08-05 12:33 ` Daniel P. Berrangé
2024-08-05 13:11 ` Markus Armbruster
2024-08-05 13:24 ` Daniel P. Berrangé
2024-08-05 13:54 ` Markus Armbruster
2024-08-05 14:59 ` Markus Armbruster
2024-08-06 17:49 ` Complications due to having multiple QAPI schemas (was: [PATCH 5/6] qapi: apply schema prefix to QAPI feature enum constants) Markus Armbruster
2024-08-08 11:48 ` [PATCH 5/6] qapi: apply schema prefix to QAPI feature enum constants Markus Armbruster
2024-08-01 17:59 ` [PATCH 6/6] qapi: expose all schema features to code Daniel P. Berrangé
2024-08-02 13:50 ` Markus Armbruster
2024-08-02 15:43 ` Daniel P. Berrangé
2024-08-08 12:11 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h6bzp4n1.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.