qapi: make 'CompatPolicy' the first arg in compat_policy_input_ok
The typical API design pattern is for a method to be named after the type of the first arg passed into the method. For the compat_policy_input_ok method, this points towards 'CompatPolicy' being the first arg, matching compat_policy_check_security. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20261030141713.2841710-2-berrange@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
1 parent
a74eb6f723
commit
da41d3ccc7
5 files changed
+14
-14
No files matched your search
@@ -18,8 +18,8 @@
|
||||
|
||||
extern CompatPolicy compat_policy;
|
||||
|
||||
bool compat_policy_input_ok(uint64_t features,
|
||||
const CompatPolicy *policy,
|
||||
bool compat_policy_input_ok(const CompatPolicy *policy,
|
||||
uint64_t features,
|
||||
ErrorClass error_class,
|
||||
const char *kind, const char *name,
|
||||
Error **errp);
|
||||
|
||||
+8
-8
@@ -19,8 +19,8 @@
|
||||
|
||||
CompatPolicy compat_policy;
|
||||
|
||||
static bool compat_policy_input_ok1(const char *adjective,
|
||||
CompatPolicyInput policy,
|
||||
static bool compat_policy_input_ok1(CompatPolicyInput policy,
|
||||
const char *adjective,
|
||||
ErrorClass error_class,
|
||||
const char *kind, const char *name,
|
||||
Error **errp)
|
||||
@@ -38,21 +38,21 @@ static bool compat_policy_input_ok1(const char *adjective,
|
||||
}
|
||||
}
|
||||
|
||||
bool compat_policy_input_ok(uint64_t features,
|
||||
const CompatPolicy *policy,
|
||||
bool compat_policy_input_ok(const CompatPolicy *policy,
|
||||
uint64_t features,
|
||||
ErrorClass error_class,
|
||||
const char *kind, const char *name,
|
||||
Error **errp)
|
||||
{
|
||||
if ((features & 1u << QAPI_DEPRECATED)
|
||||
&& !compat_policy_input_ok1("Deprecated",
|
||||
policy->deprecated_input,
|
||||
&& !compat_policy_input_ok1(policy->deprecated_input,
|
||||
"Deprecated",
|
||||
error_class, kind, name, errp)) {
|
||||
return false;
|
||||
}
|
||||
if ((features & (1u << QAPI_UNSTABLE))
|
||||
&& !compat_policy_input_ok1("Unstable",
|
||||
policy->unstable_input,
|
||||
&& !compat_policy_input_ok1(policy->unstable_input,
|
||||
"Unstable",
|
||||
error_class, kind, name, errp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -410,8 +410,8 @@ static bool input_type_enum(Visitor *v, const char *name, int *obj,
|
||||
}
|
||||
|
||||
if (lookup->features
|
||||
&& !compat_policy_input_ok(lookup->features[value],
|
||||
&v->compat_policy,
|
||||
&& !compat_policy_input_ok(&v->compat_policy,
|
||||
lookup->features[value],
|
||||
ERROR_CLASS_GENERIC_ERROR,
|
||||
"value", enum_str, errp)) {
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -185,7 +185,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->features, &compat_policy,
|
||||
if (!compat_policy_input_ok(&compat_policy, cmd->features,
|
||||
ERROR_CLASS_COMMAND_NOT_FOUND,
|
||||
"command", command, &err)) {
|
||||
goto out;
|
||||
|
||||
@@ -667,7 +667,7 @@ static bool qobject_input_policy_reject(Visitor *v, const char *name,
|
||||
uint64_t features,
|
||||
Error **errp)
|
||||
{
|
||||
return !compat_policy_input_ok(features, &v->compat_policy,
|
||||
return !compat_policy_input_ok(&v->compat_policy, features,
|
||||
ERROR_CLASS_GENERIC_ERROR,
|
||||
"parameter", name, errp);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user