From 6604e4757a1fc5832f87b5f9244efccabb49be8e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 28 Oct 2021 12:25:17 +0200 Subject: qapi: Generalize command policy checking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code to check command policy can see special feature flag 'deprecated' as command flag QCO_DEPRECATED. I want to make feature flag 'unstable' visible there as well, so I can add policy for it. To let me make it visible, add member @special_features (a bitset of QapiSpecialFeature) to QmpCommand, and adjust the generator to pass it through qmp_register_command(). Then replace "QCO_DEPRECATED in @flags" by QAPI_DEPRECATED in @special_features", and drop QCO_DEPRECATED. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé Acked-by: John Snow Message-Id: <20211028102520.747396-7-armbru@redhat.com> Reviewed-by: Juan Quintela Reviewed-by: Eric Blake --- qapi/qmp-registry.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'qapi/qmp-registry.c') diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index f78c064aae..485bc5e6fc 100644 --- a/qapi/qmp-registry.c +++ b/qapi/qmp-registry.c @@ -16,7 +16,8 @@ #include "qapi/qmp/dispatch.h" void qmp_register_command(QmpCommandList *cmds, const char *name, - QmpCommandFunc *fn, QmpCommandOptions options) + QmpCommandFunc *fn, QmpCommandOptions options, + unsigned special_features) { QmpCommand *cmd = g_malloc0(sizeof(*cmd)); @@ -27,6 +28,7 @@ void qmp_register_command(QmpCommandList *cmds, const char *name, cmd->fn = fn; cmd->enabled = true; cmd->options = options; + cmd->special_features = special_features; QTAILQ_INSERT_TAIL(cmds, cmd, node); } -- cgit v1.2.3