mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
qapi: change 'unsigned special_features' to 'uint64_t features'
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. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20250205123550.2754387-3-berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
d8a22e69fe
commit
696ae1ac91
13 changed files with 34 additions and 34 deletions
|
@ -246,7 +246,7 @@ static void forward_field_optional(Visitor *v, const char *name, bool *present)
|
|||
}
|
||||
|
||||
static bool forward_field_policy_reject(Visitor *v, const char *name,
|
||||
unsigned special_features,
|
||||
uint64_t features,
|
||||
Error **errp)
|
||||
{
|
||||
ForwardFieldVisitor *ffv = to_ffv(v);
|
||||
|
@ -254,18 +254,18 @@ static bool forward_field_policy_reject(Visitor *v, const char *name,
|
|||
if (!forward_field_translate_name(ffv, &name, errp)) {
|
||||
return true;
|
||||
}
|
||||
return visit_policy_reject(ffv->target, name, special_features, errp);
|
||||
return visit_policy_reject(ffv->target, name, features, errp);
|
||||
}
|
||||
|
||||
static bool forward_field_policy_skip(Visitor *v, const char *name,
|
||||
unsigned special_features)
|
||||
uint64_t features)
|
||||
{
|
||||
ForwardFieldVisitor *ffv = to_ffv(v);
|
||||
|
||||
if (!forward_field_translate_name(ffv, &name, NULL)) {
|
||||
return true;
|
||||
}
|
||||
return visit_policy_skip(ffv->target, name, special_features);
|
||||
return visit_policy_skip(ffv->target, name, features);
|
||||
}
|
||||
|
||||
static void forward_field_complete(Visitor *v, void *opaque)
|
||||
|
|
|
@ -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)
|
||||
&& !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))
|
||||
&& !compat_policy_input_ok1("Unstable",
|
||||
policy->unstable_input,
|
||||
error_class, kind, name, errp)) {
|
||||
|
|
|
@ -141,21 +141,21 @@ bool visit_optional(Visitor *v, const char *name, bool *present)
|
|||
}
|
||||
|
||||
bool visit_policy_reject(Visitor *v, const char *name,
|
||||
unsigned special_features, Error **errp)
|
||||
uint64_t features, Error **errp)
|
||||
{
|
||||
trace_visit_policy_reject(v, name);
|
||||
if (v->policy_reject) {
|
||||
return v->policy_reject(v, name, special_features, errp);
|
||||
return v->policy_reject(v, name, features, errp);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit_policy_skip(Visitor *v, const char *name,
|
||||
unsigned special_features)
|
||||
uint64_t features)
|
||||
{
|
||||
trace_visit_policy_skip(v, name);
|
||||
if (v->policy_skip) {
|
||||
return v->policy_skip(v, name, special_features);
|
||||
return v->policy_skip(v, name, features);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -409,8 +409,8 @@ static bool input_type_enum(Visitor *v, const char *name, int *obj,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (lookup->special_features
|
||||
&& !compat_policy_input_ok(lookup->special_features[value],
|
||||
if (lookup->features
|
||||
&& !compat_policy_input_ok(lookup->features[value],
|
||||
&v->compat_policy,
|
||||
ERROR_CLASS_GENERIC_ERROR,
|
||||
"value", enum_str, errp)) {
|
||||
|
|
|
@ -173,7 +173,7 @@ QDict *coroutine_mixed_fn qmp_dispatch(const QmpCommandList *cmds, QObject *requ
|
|||
"The command %s has not been found", command);
|
||||
goto out;
|
||||
}
|
||||
if (!compat_policy_input_ok(cmd->special_features, &compat_policy,
|
||||
if (!compat_policy_input_ok(cmd->features, &compat_policy,
|
||||
ERROR_CLASS_COMMAND_NOT_FOUND,
|
||||
"command", command, &err)) {
|
||||
goto out;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
void qmp_register_command(QmpCommandList *cmds, const char *name,
|
||||
QmpCommandFunc *fn, QmpCommandOptions options,
|
||||
unsigned special_features)
|
||||
uint64_t features)
|
||||
{
|
||||
QmpCommand *cmd = g_malloc0(sizeof(*cmd));
|
||||
|
||||
|
@ -28,7 +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;
|
||||
cmd->features = features;
|
||||
QTAILQ_INSERT_TAIL(cmds, cmd, node);
|
||||
}
|
||||
|
||||
|
|
|
@ -664,10 +664,10 @@ static void qobject_input_optional(Visitor *v, const char *name, bool *present)
|
|||
}
|
||||
|
||||
static bool qobject_input_policy_reject(Visitor *v, const char *name,
|
||||
unsigned special_features,
|
||||
uint64_t features,
|
||||
Error **errp)
|
||||
{
|
||||
return !compat_policy_input_ok(special_features, &v->compat_policy,
|
||||
return !compat_policy_input_ok(features, &v->compat_policy,
|
||||
ERROR_CLASS_GENERIC_ERROR,
|
||||
"parameter", name, errp);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
&& pol->deprecated_output == COMPAT_POLICY_OUTPUT_HIDE)
|
||||
|| ((special_features & 1u << QAPI_UNSTABLE)
|
||||
|| ((features & 1u << QAPI_UNSTABLE)
|
||||
&& pol->unstable_output == COMPAT_POLICY_OUTPUT_HIDE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue