aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-10-29 19:42:36 -0700
committerRichard Henderson <richard.henderson@linaro.org>2021-10-29 19:42:36 -0700
commitdd61b91c080cdfba1360a5ea1e4693fffb3445b0 (patch)
treef5b3cec0b0af415826cdf979ba49fe7e6fc0f8dc /include
parenta856cce31b48ef1b04ea80893458766ec16e7194 (diff)
parent57df0dff1a1f4c846aa74a082bfd595a8a990015 (diff)
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-10-29' into staging
QAPI patches patches for 2021-10-29 # gpg: Signature made Fri 29 Oct 2021 12:28:53 PM PDT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] * remotes/armbru/tags/pull-qapi-2021-10-29: qapi: Extend -compat to set policy for unstable interfaces qapi: Factor out compat_policy_input_ok() qapi: Generalize enum member policy checking qapi: Generalize command policy checking qapi: Generalize struct member policy checking qapi: Tools for sets of special feature flags in generated code qapi: Eliminate QCO_NO_OPTIONS for a slight simplification qapi: Mark unstable QMP parts with feature 'unstable' qapi: New special feature flag "unstable" Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/qapi/compat-policy.h7
-rw-r--r--include/qapi/qmp/dispatch.h6
-rw-r--r--include/qapi/util.h8
-rw-r--r--include/qapi/visitor-impl.h6
-rw-r--r--include/qapi/visitor.h17
5 files changed, 32 insertions, 12 deletions
diff --git a/include/qapi/compat-policy.h b/include/qapi/compat-policy.h
index 1083f95122..8b7b25c0b5 100644
--- a/include/qapi/compat-policy.h
+++ b/include/qapi/compat-policy.h
@@ -13,10 +13,17 @@
#ifndef QAPI_COMPAT_POLICY_H
#define QAPI_COMPAT_POLICY_H
+#include "qapi/error.h"
#include "qapi/qapi-types-compat.h"
extern CompatPolicy compat_policy;
+bool compat_policy_input_ok(unsigned special_features,
+ const CompatPolicy *policy,
+ ErrorClass error_class,
+ const char *kind, const char *name,
+ Error **errp);
+
/*
* Create a QObject input visitor for @obj for use with QMP
*
diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h
index 075203dc67..1e4240fd0d 100644
--- a/include/qapi/qmp/dispatch.h
+++ b/include/qapi/qmp/dispatch.h
@@ -21,12 +21,10 @@ typedef void (QmpCommandFunc)(QDict *, QObject **, Error **);
typedef enum QmpCommandOptions
{
- QCO_NO_OPTIONS = 0x0,
QCO_NO_SUCCESS_RESP = (1U << 0),
QCO_ALLOW_OOB = (1U << 1),
QCO_ALLOW_PRECONFIG = (1U << 2),
QCO_COROUTINE = (1U << 3),
- QCO_DEPRECATED = (1U << 4),
} QmpCommandOptions;
typedef struct QmpCommand
@@ -35,6 +33,7 @@ typedef struct QmpCommand
/* Runs in coroutine context if QCO_COROUTINE is set */
QmpCommandFunc *fn;
QmpCommandOptions options;
+ unsigned special_features;
QTAILQ_ENTRY(QmpCommand) node;
bool enabled;
const char *disable_reason;
@@ -43,7 +42,8 @@ typedef struct QmpCommand
typedef QTAILQ_HEAD(QmpCommandList, QmpCommand) QmpCommandList;
void qmp_register_command(QmpCommandList *cmds, const char *name,
- QmpCommandFunc *fn, QmpCommandOptions options);
+ QmpCommandFunc *fn, QmpCommandOptions options,
+ unsigned special_features);
const QmpCommand *qmp_find_command(const QmpCommandList *cmds,
const char *name);
void qmp_disable_command(QmpCommandList *cmds, const char *name,
diff --git a/include/qapi/util.h b/include/qapi/util.h
index 257c600f99..81a2b13a33 100644
--- a/include/qapi/util.h
+++ b/include/qapi/util.h
@@ -11,12 +11,14 @@
#ifndef QAPI_UTIL_H
#define QAPI_UTIL_H
-/* QEnumLookup flags */
-#define QAPI_ENUM_DEPRECATED 1
+typedef enum {
+ QAPI_DEPRECATED,
+ QAPI_UNSTABLE,
+} QapiSpecialFeature;
typedef struct QEnumLookup {
const char *const *array;
- const unsigned char *const flags;
+ const unsigned char *const special_features;
const int size;
} QEnumLookup;
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h
index 72b6537bef..2badec5ba4 100644
--- a/include/qapi/visitor-impl.h
+++ b/include/qapi/visitor-impl.h
@@ -114,10 +114,12 @@ struct Visitor
void (*optional)(Visitor *v, const char *name, bool *present);
/* Optional */
- bool (*deprecated_accept)(Visitor *v, const char *name, Error **errp);
+ bool (*policy_reject)(Visitor *v, const char *name,
+ unsigned special_features, Error **errp);
/* Optional */
- bool (*deprecated)(Visitor *v, const char *name);
+ bool (*policy_skip)(Visitor *v, const char *name,
+ unsigned special_features);
/* Must be set */
VisitorType type;
diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
index dcb96018a9..d53a84c9ba 100644
--- a/include/qapi/visitor.h
+++ b/include/qapi/visitor.h
@@ -461,22 +461,31 @@ void visit_end_alternate(Visitor *v, void **obj);
bool visit_optional(Visitor *v, const char *name, bool *present);
/*
- * Should we reject deprecated member @name?
+ * Should we reject member @name due to policy?
+ *
+ * @special_features is the member's special features encoded as a
+ * bitset of QapiSpecialFeature.
*
* @name must not be NULL. This function is only useful between
* visit_start_struct() and visit_end_struct(), since only objects
* have deprecated members.
*/
-bool visit_deprecated_accept(Visitor *v, const char *name, Error **errp);
+bool visit_policy_reject(Visitor *v, const char *name,
+ unsigned special_features, Error **errp);
/*
- * Should we visit deprecated member @name?
+ *
+ * Should we skip member @name due to policy?
+ *
+ * @special_features is the member's special features encoded as a
+ * bitset of QapiSpecialFeature.
*
* @name must not be NULL. This function is only useful between
* visit_start_struct() and visit_end_struct(), since only objects
* have deprecated members.
*/
-bool visit_deprecated(Visitor *v, const char *name);
+bool visit_policy_skip(Visitor *v, const char *name,
+ unsigned special_features);
/*
* Set policy for handling deprecated management interfaces.