[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v11 5/6] qapi: add a QmpInputVisitor that does s
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-devel] [PATCH v11 5/6] qapi: add a QmpInputVisitor that does string conversion |
Date: |
Tue, 13 Sep 2016 10:33:21 +0100 |
User-agent: |
Mutt/1.7.0 (2016-08-17) |
On Tue, Sep 13, 2016 at 11:05:08AM +0200, Markus Armbruster wrote:
> "Daniel P. Berrange" <address@hidden> writes:
>
> > Currently the QmpInputVisitor assumes that all scalar
> > values are directly represented as their final types.
> > ie it assumes an 'int' is using QInt, and a 'bool' is
> > using QBool.
> >
> > This adds an alternative constructor for QmpInputVisitor
> > that will set it up such that it expects a QString for
> > all scalar types instead.
> >
> > This makes it possible to use QmpInputVisitor with a
> > QDict produced from QemuOpts, where everything is in
> > string format.
>
> Can you explain how this is related to the Options visitor?
The intention is that this can replace the existing OptsVisitor,
for cases that don't rely on the magic "List of scalars" semantics
of OptsVisitor - eg where 'foo=3,foo=5,foo=533' gets turned into
a QList.
When using QemuOpts w/ qdict_crumple + QmpInputVisitor, you would
do list of scalars in different manner 'foo.1=3,foo.2=5,foo.3=533'
since this syntax is extendable to deal with arbitrary nesting of
dicts + lists, where as the OptsVisitor syntax cannot be extended
in a back-compatible manner.
This series converts -object to use QmpInputVisitor and this is
safe todo right now, since no currently created QOM object has
a property which is a list of scalars and this the changed syntax
is not going to affect any existing usage.
The -drive arg can be converted to QmpInputVisitor too, since
the qdict_crumple/QmpInputVisitor combination was explicitly
designed to be 100% compatible with -drive syntax for blockdevs
nested options.
Other args would have to be considered on a case-by-case basis
to see if they rely on the magic list of scalars syntax used
by OptsVisitor. Probably only a few of them need this.
> > ---
> > include/qapi/qobject-input-visitor.h | 41 +++++++++-
> > qapi/qobject-input-visitor.c | 115 +++++++++++++++++++++++++-
> > tests/test-qobject-input-visitor.c | 152
> > ++++++++++++++++++++++++++++++++++-
> > 3 files changed, 298 insertions(+), 10 deletions(-)
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
- [Qemu-devel] [PATCH v11 1/6] qdict: implement a qdict_crumple method for un-flattening a dict, (continued)
Re: [Qemu-devel] [PATCH v11 5/6] qapi: add a QmpInputVisitor that does string conversion, Kevin Wolf, 2016/09/14
[Qemu-devel] [PATCH v11 3/6] qapi: rename QmpInputVisitor to QObjectInputVisitor, Daniel P. Berrange, 2016/09/05
[Qemu-devel] [PATCH v11 4/6] qapi: rename QmpOutputVisitor to QObjectOutputVisitor, Daniel P. Berrange, 2016/09/05