[PATCH 3/6] qapi: use "QAPI_FEATURE" as namespace for features

Daniel P. Berrangé posted 6 patches 3 months, 3 weeks ago
There is a newer version of this series
[PATCH 3/6] qapi: use "QAPI_FEATURE" as namespace for features
Posted by Daniel P. Berrangé 3 months, 3 weeks ago
This more clearly distinguishes the feature constants from other
QAPI constants.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 include/qapi/util.h           | 4 ++--
 qapi/qapi-util.c              | 4 ++--
 qapi/qobject-output-visitor.c | 4 ++--
 scripts/qapi/gen.py           | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/qapi/util.h b/include/qapi/util.h
index b377cb9c70..a693cac9ea 100644
--- a/include/qapi/util.h
+++ b/include/qapi/util.h
@@ -12,8 +12,8 @@
 #define QAPI_UTIL_H
 
 typedef enum {
-    QAPI_DEPRECATED,
-    QAPI_UNSTABLE,
+    QAPI_FEATURE_DEPRECATED,
+    QAPI_FEATURE_UNSTABLE,
 } QapiFeature;
 
 typedef struct QEnumLookup {
diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
index 3d849fe034..48c8c867d3 100644
--- a/qapi/qapi-util.c
+++ b/qapi/qapi-util.c
@@ -43,13 +43,13 @@ bool compat_policy_input_ok(uint64_t features,
                             const char *kind, const char *name,
                             Error **errp)
 {
-    if ((features & 1u << QAPI_DEPRECATED)
+    if ((features & 1u << QAPI_FEATURE_DEPRECATED)
         && !compat_policy_input_ok1("Deprecated",
                                     policy->deprecated_input,
                                     error_class, kind, name, errp)) {
         return false;
     }
-    if ((features & (1u << QAPI_UNSTABLE))
+    if ((features & (1u << QAPI_FEATURE_UNSTABLE))
         && !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 8902287caa..b13c94d913 100644
--- a/qapi/qobject-output-visitor.c
+++ b/qapi/qobject-output-visitor.c
@@ -214,9 +214,9 @@ static bool qobject_output_policy_skip(Visitor *v, const char *name,
 {
     CompatPolicy *pol = &v->compat_policy;
 
-    return ((features & 1u << QAPI_DEPRECATED)
+    return ((features & 1u << QAPI_FEATURE_DEPRECATED)
             && pol->deprecated_output == COMPAT_POLICY_OUTPUT_HIDE)
-        || ((features & 1u << QAPI_UNSTABLE)
+        || ((features & 1u << QAPI_FEATURE_UNSTABLE)
             && pol->unstable_output == COMPAT_POLICY_OUTPUT_HIDE);
 }
 
diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py
index e6c80cce23..0ff29dc776 100644
--- a/scripts/qapi/gen.py
+++ b/scripts/qapi/gen.py
@@ -41,7 +41,7 @@
 
 
 def gen_features(features: Sequence[QAPISchemaFeature]) -> str:
-    features = [f"1u << QAPI_{feat.name.upper()}"
+    features = [f"1u << QAPI_FEATURE_{feat.name.upper()}"
                 for feat in features if feat.is_special()]
     return ' | '.join(features) or '0'
 
-- 
2.45.2


Re: [PATCH 3/6] qapi: use "QAPI_FEATURE" as namespace for features
Posted by Markus Armbruster 3 months, 3 weeks ago
Daniel P. Berrangé <berrange@redhat.com> writes:

> This more clearly distinguishes the feature constants from other
> QAPI constants.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Reviewed-by: Markus Armbruster <armbru@redhat.com>