testutilsqemuschema: Rename and document 'testQEMUSchemaValidateDeprecated'

Upcoming patch will add more features we care to check. Rename the
function to 'testQEMUSchemaValidateFeatures'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Peter Krempa 2024-09-24 15:36:12 +02:00
parent f05488f78c
commit 7203b7df6b

View File

@ -29,8 +29,12 @@ struct testQEMUSchemaValidateCtxt {
};
/**
* Validate that the schema member doesn't have some significant features:
* - 'deprecated' - schema member is deprecated
*/
static int
testQEMUSchemaValidateDeprecated(virJSONValue *root,
testQEMUSchemaValidateFeatures(virJSONValue *root,
const char *name,
struct testQEMUSchemaValidateCtxt *ctxt)
{
@ -187,8 +191,8 @@ testQEMUSchemaValidateObjectMember(const char *key,
return -1;
}
/* validate that the member is not deprecated */
if ((rc = testQEMUSchemaValidateDeprecated(keymember, key, data->ctxt)) < 0)
/* validate that the member doesn't have some of the significant features */
if ((rc = testQEMUSchemaValidateFeatures(keymember, key, data->ctxt)) < 0)
return rc;
/* lookup schema entry for keytype */
@ -387,8 +391,8 @@ testQEMUSchemaValidateEnum(virJSONValue *obj,
if (STREQ_NULLABLE(objstr, virJSONValueObjectGetString(member, "name"))) {
int rc;
/* the new 'members' array allows us to check deprecations */
if ((rc = testQEMUSchemaValidateDeprecated(member, objstr, ctxt)) < 0)
/* the new 'members' array allows us to check features */
if ((rc = testQEMUSchemaValidateFeatures(member, objstr, ctxt)) < 0)
return rc;
virBufferAsprintf(ctxt->debug, "'%s' OK", NULLSTR(objstr));
@ -526,7 +530,7 @@ testQEMUSchemaValidateRecurse(virJSONValue *obj,
const char *t = virJSONValueObjectGetString(root, "meta-type");
int rc;
if ((rc = testQEMUSchemaValidateDeprecated(root, n, ctxt)) < 0)
if ((rc = testQEMUSchemaValidateFeatures(root, n, ctxt)) < 0)
return rc;
if (STREQ_NULLABLE(t, "builtin")) {
@ -626,7 +630,7 @@ testQEMUSchemaValidateCommand(const char *command,
return -1;
}
if ((rc = testQEMUSchemaValidateDeprecated(schemarootcommand, command, &ctxt)) < 0)
if ((rc = testQEMUSchemaValidateFeatures(schemarootcommand, command, &ctxt)) < 0)
return rc;
if (!arguments)