From a130728554d0cc19ef0ed4c1c824305c1682e64b Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 28 Oct 2021 12:25:16 +0200 Subject: qapi: Generalize struct member policy checking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The generated visitor functions call visit_deprecated_accept() and visit_deprecated() when visiting a struct member with special feature flag 'deprecated'. This makes the feature flag visible to the actual visitors. I want to make feature flag 'unstable' visible there as well, so I can add policy for it. To let me make it visible, replace these functions by visit_policy_reject() and visit_policy_skip(), which take the member's special features as an argument. Note that the new functions have the opposite sense, i.e. the return value flips. Signed-off-by: Markus Armbruster Message-Id: <20211028102520.747396-6-armbru@redhat.com> Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daudé [Unbreak forward visitor] --- include/qapi/visitor-impl.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/qapi/visitor-impl.h') diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h index 72b6537bef..2badec5ba4 100644 --- a/include/qapi/visitor-impl.h +++ b/include/qapi/visitor-impl.h @@ -114,10 +114,12 @@ struct Visitor void (*optional)(Visitor *v, const char *name, bool *present); /* Optional */ - bool (*deprecated_accept)(Visitor *v, const char *name, Error **errp); + bool (*policy_reject)(Visitor *v, const char *name, + unsigned special_features, Error **errp); /* Optional */ - bool (*deprecated)(Visitor *v, const char *name); + bool (*policy_skip)(Visitor *v, const char *name, + unsigned special_features); /* Must be set */ VisitorType type; -- cgit 1.4.1