From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbYEp-0002Xi-G7 for qemu-devel@nongnu.org; Fri, 16 Dec 2011 08:54:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RbYEj-0001id-Cn for qemu-devel@nongnu.org; Fri, 16 Dec 2011 08:54:15 -0500 Received: from mail-gy0-f173.google.com ([209.85.160.173]:40519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbYEj-0001iS-9Q for qemu-devel@nongnu.org; Fri, 16 Dec 2011 08:54:09 -0500 Received: by ghbg19 with SMTP id g19so2760740ghb.4 for ; Fri, 16 Dec 2011 05:54:08 -0800 (PST) Message-ID: <4EEB4D7A.2010203@codemonkey.ws> Date: Fri, 16 Dec 2011 07:54:02 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1324036918-2405-1-git-send-email-pbonzini@redhat.com> In-Reply-To: <1324036918-2405-1-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/8] qom: introduce non-legacy static properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, qemu-devel@nongnu.org On 12/16/2011 06:01 AM, Paolo Bonzini wrote: > QOM right now does not have a way to communicate values for qdev > properties except as strings. This is bad. > > This patch improves the Property implementation so that properties > export a visitor-based interface in addition to the string-based > interface. The new interface can then be registered as a "static" > property. It's called static because it uses a struct field for > storage and, as such, should be present in all objects of a given > class. Excellent! See the patches for individual comments but this is definitely a good thing to have. Regards, Anthony Liguori > > Patches 1-3 are bugfixes and patch 4 is a cleanup, so please apply > those at least. > > Example using qmp-shell: > > x86_64-softmmu/qemu-system-x86_64 \ > -hda ~/test.img -snapshot -S \ > -qmp unix:/tmp/server.sock,server,nowait \ > -netdev type=user,id=net -device virtio-net-pci,netdev=net,id=net \ > -net user,vlan=1 -device virtio-net-pci,id=net2,vlan=1 \ > -chardev id=stdio,backend=stdio -device isa-serial,chardev=stdio,id=serial > > Boolean properties: > > (QEMU) qom-get path=/i440fx/piix3 property=command_serr_enable > {u'return': True} > (QEMU) qom-get path=/i440fx/piix3 property=legacy > {u'return': u'on'} > > PCI address properties (perhaps will disappear later, but not yet): > > (QEMU) qom-get path=/i440fx/piix3 property=addr > {u'return': u'01.0'} > (QEMU) qom-get path=/i440fx/piix3 property=legacy > {u'return': u'01.0'} > > String properties (QObject does not have NULL): > > (QEMU) qom-get path=/vga property=romfile > {u'return': u'vgabios-cirrus.bin'} > (QEMU) qom-get path=/vga property=legacy > {u'return': u'"vgabios-cirrus.bin"'} > (QEMU) qom-get path=/i440fx/piix3 property=romfile > {u'return': {}} > (QEMU) qom-get path=/i440fx/piix3 property=legacy > {u'return': u''} > > MAC properties: > > (QEMU) qom-get path=/peripheral/net property=mac > {u'return': u'52:54:00:12:34:56'} > (QEMU) qom-get path=/peripheral/net property=legacy > {u'return': u'52:54:00:12:34:56'} > (QEMU) qom-set path=/peripheral/net property=mac value=52-54-00-12-34-57 > {u'error': {u'data': {}, u'class': u'PermissionDenied', u'desc': u'Insufficient permission to perform this operation'}} > > Network properties: > > (QEMU) qom-get path=/peripheral/net property=netdev > {u'return': u'net'} > (QEMU) qom-get path=/peripheral/net property=legacy > {u'return': u'net'} > > VLAN properties: > > (QEMU) qom-get path=/peripheral/net property=vlan > {u'return': {}} > (QEMU) qom-get path=/peripheral/net property=legacy > {u'return': u''} > (QEMU) qom-get path=/peripheral/net2 property=vlan > {u'return': 1} > (QEMU) qom-get path=/peripheral/net2 property=legacy > {u'return': u'1'} > > Chardev properties: > > (QEMU) qom-get path=/peripheral/serial property=chardev > {u'return': u'stdio'} > (QEMU) qom-get path=/peripheral/serial property=legacy > {u'return': u'stdio'} > > Legacy hex32 properties: > > (QEMU) qom-get path=/peripheral/serial property=iobase > {u'return': 1016} > (QEMU) qom-get path=/peripheral/serial property=legacy > {u'return': u'0x3f8'} > > Examples of setting properties (after disabling the DEV_STATE_CREATED > check for testing only): > > (QEMU) qom-set path=/peripheral/net2 property=vlan value=-1 > {u'return': {}} > (QEMU) qom-get path=/peripheral/net2 property=vlan > {u'return': {}} > (QEMU) qom-get path=/peripheral/net2 property=legacy > {u'return': u''} > > (QEMU) qom-set path=/peripheral/serial property=iobase value=760 > {u'return': {}} > (QEMU) qom-get path=/peripheral/serial property=iobase > {u'return': 760} > (QEMU) qom-get path=/peripheral/serial property=legacy > {u'return': u'0x2f8'} > > Paolo Bonzini (8): > qapi: fix NULL pointer dereference > qapi: protect against NULL QObject in qmp_input_get_object > qom: fix swapped parameters > qom: push permission checks up into qdev_property_add_legacy > qom: introduce QERR_PROPERTY_VALUE_OUT_OF_RANGE > qom: introduce get/set methods for Property > qom: distinguish "legacy" property type name from QOM type name > qom: register qdev properties also as non-legacy properties > > hw/qdev-addr.c | 41 +++++ > hw/qdev-properties.c | 360 ++++++++++++++++++++++++++++++++++++++++++++- > hw/qdev.c | 85 +++++++----- > hw/qdev.h | 12 +- > qapi/qmp-input-visitor.c | 10 +- > qapi/qmp-output-visitor.c | 4 +- > qerror.c | 5 + > qerror.h | 3 + > 8 files changed, 472 insertions(+), 48 deletions(-) >