@@ -14,6 +14,8 @@
typedef enum {
QAPI_FEATURE_DEPRECATED,
QAPI_FEATURE_UNSTABLE,
+
+ QAPI_FEATURE_BUILT_IN_LAST,
} QapiSpecialFeature;
typedef struct QEnumLookup {
@@ -347,7 +347,27 @@ def visit_begin(self, schema: QAPISchema) -> None:
self._add_module('./init', ' * QAPI Commands initialization')
self._genh.add(mcgen('''
#include "qapi/qmp/dispatch.h"
+'''))
+
+ features = schema._custom_special_features['command']
+ if len(features) > 0:
+ self._genh.add(mcgen('''
+
+typedef enum {
+'''))
+ suffix = " = QAPI_FEATURE_BUILT_IN_LAST"
+ for f in features:
+ self._genh.add(mcgen('''
+ QAPI_FEATURE_%(name)s%(suffix)s,
+''', suffix=suffix, name=f.upper().replace('-', '_')))
+ suffix = ""
+ self._genh.add(mcgen('''
+} QapiSpecialFeatureCustom;
+
+'''))
+
+ self._genh.add(mcgen('''
void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds);
''',
c_prefix=c_name(self._prefix, protect=False)))
In order to register custom special features against a command, they have to have enum constants defined. The defined constant values start where the last built-in special feature stops. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- include/qapi/util.h | 2 ++ scripts/qapi/commands.py | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+)