Markus Armbruster <arm...@redhat.com> writes: > Markus Armbruster <arm...@redhat.com> writes: > >> Markus Armbruster <arm...@redhat.com> writes: >> >>> Kevin Wolf <kw...@redhat.com> writes: >>> >>>> auto-read-only=on changed its behaviour in file-posix for the 4.0 >>>> release. >>> >>> Commit hash, please. >> >> I guess it's commit 23dece19da4 "file-posix: Make auto-read-only >> dynamic". >> >>>> This change cannot be detected through the usual mechanisms >>>> like schema introspection. Add a new feature to query-qemu-features to >>>> allow libvirt to detect the presence of the new behaviour. >>>> >>>> Signed-off-by: Kevin Wolf <kw...@redhat.com> > [...] >> The "posix" in @file-posix-dynamic-auto-read-only feels weird. To make >> sense of it, you need to know on what kind of host QEMU runs. If we >> ever implement it for Windows hosts, we'd get do add >> @file-windows-posix-dynamic-auto-read-only. >> >> What about instead adding @file-dynamic-auto-read-only with a suitable >> compile-time conditional? >> >> [...] > > Incremental patch:
Too fast, use this one. diff --git a/qapi/misc.json b/qapi/misc.json index df23c54a65..36b5ceb595 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -3058,7 +3058,7 @@ # Information about support for QEMU features that isn't available through # schema introspection. # -# @file-posix-dynamic-auto-read-only: +# @file-dynamic-auto-read-only: # true if auto-read-only=on means that the image file is dynamically reopened # read-only or read-write depending on whether any writers are attached to # the node. @@ -3066,7 +3066,9 @@ # Since: 4.0 ## { 'struct': 'QemuFeatures', - 'data': { 'file-posix-dynamic-auto-read-only': 'bool' } } + 'data': { + 'file-dynamic-auto-read-only': { 'type': 'bool', + 'if': 'defined(CONFIG_POSIX)' } } } ## # @query-qemu-features: diff --git a/qmp.c b/qmp.c index 2a887c1e7d..2f5a7d7a2e 100644 --- a/qmp.c +++ b/qmp.c @@ -723,7 +723,9 @@ QemuFeatures *qmp_query_qemu_features(Error **errp) QemuFeatures *caps = g_new(QemuFeatures, 1); *caps = (QemuFeatures) { - .file_posix_dynamic_auto_read_only = true, +#ifdef CONFIG_POSIX + .file_dynamic_auto_read_only = true, +#endif }; return caps; diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 826b8066e1..ad14fadf54 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -110,14 +110,9 @@ void visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp) } ''') - # 'goto out' produced for base, for each member, and if variants were - # present - if base or members or variants: - ret += mcgen(''' - -out: -''') ret += mcgen(''' + goto out; /* suppress unused label warning */ +out: error_propagate(errp, err); } ''')