From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W43ZS-0008IC-Ae for qemu-devel@nongnu.org; Fri, 17 Jan 2014 02:10:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W43ZN-0000bf-Kp for qemu-devel@nongnu.org; Fri, 17 Jan 2014 02:10:26 -0500 Received: from mail-ea0-x22a.google.com ([2a00:1450:4013:c01::22a]:43130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W43ZN-0000bb-DW for qemu-devel@nongnu.org; Fri, 17 Jan 2014 02:10:21 -0500 Received: by mail-ea0-f170.google.com with SMTP id k10so1557119eaj.1 for ; Thu, 16 Jan 2014 23:10:20 -0800 (PST) Date: Fri, 17 Jan 2014 15:10:10 +0800 From: Stefan Hajnoczi Message-ID: <20140117071010.GA19441@stefanha-thinkpad.redhat.com> References: <1389890079-21853-1-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1389890079-21853-1-git-send-email-imammedo@redhat.com> Subject: Re: [Qemu-devel] [PATCH v1 0/4] -object/object-add add 2nd stage initialization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: sw@weilnetz.de, mjt@tls.msk.ru, qemu-devel@nongnu.org, lcapitulino@redhat.com, blauwirbel@gmail.com, aliguori@amazon.com, pbonzini@redhat.com, rth@twiddle.net On Thu, Jan 16, 2014 at 05:34:35PM +0100, Igor Mammedov wrote: > Adds UserCreatable interface that objects must inherit from > If they need to be created with help of -object/object-add > commands. > > Interface also provides an optional complete() callback, > that is called after object properties are set. Which allows > * replace custom backend APIs to initialize them with generic > object_new(); set object properties; object.complete(); > sequence. > * bail out/report error early (at backend creation time) > instead of failing later when adding device that uses > that backend. > > Reference to RFC: > https://lists.gnu.org/archive/html/qemu-devel/2014-01/msg00877.html > > Changes since RFC: > * rename object_realize interface to UserCreatable > * make UserCreatable interface mandatory for -object/object-add > * drop custom location patch > > Git tree for testing: > https://github.com/imammedo/qemu/commits/extend-object-add-v1 > > Igor Mammedov (4): > object_add: consolidate error handling > vl.c: -object: don't ingnore duplicate 'id' > add optional 2nd stage initialization to -object/object-add commands > virtio_rng: replace custom backend API with UserCreatable.complete() > callback > > backends/rng.c | 17 +++++++++- > hw/virtio/virtio-rng.c | 15 +++++---- > include/qom/object_interfaces.h | 62 +++++++++++++++++++++++++++++++++++++++ > include/sysemu/rng.h | 11 ------- > qmp.c | 22 +++++++++++-- > qom/Makefile.objs | 1 + > qom/object_interfaces.c | 32 ++++++++++++++++++++ > vl.c | 22 +++++++++++++- > 8 files changed, 158 insertions(+), 24 deletions(-) > create mode 100644 include/qom/object_interfaces.h > create mode 100644 qom/object_interfaces.c Reviewed-by: Stefan Hajnoczi Rebased my IOThread series onto this and tested successfully.