From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQBv0-0002EH-Rv for qemu-devel@nongnu.org; Mon, 01 Feb 2016 05:41:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQBux-0005yZ-HR for qemu-devel@nongnu.org; Mon, 01 Feb 2016 05:41:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQBux-0005yD-Bv for qemu-devel@nongnu.org; Mon, 01 Feb 2016 05:41:11 -0500 Date: Mon, 1 Feb 2016 10:41:05 +0000 From: "Daniel P. Berrange" Message-ID: <20160201104105.GC1622@redhat.com> References: <1453883380-10532-1-git-send-email-zhang.zhanghailiang@huawei.com> <1453883380-10532-3-git-send-email-zhang.zhanghailiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1453883380-10532-3-git-send-email-zhang.zhanghailiang@huawei.com> Subject: Re: [Qemu-devel] [PATCH RFC v2 2/5] vl: Make object_create() public Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang Cc: Paolo Bonzini , jasowang@redhat.com, qemu-devel@nongnu.org, zhangchen.fnst@cn.fujitsu.com, hongyang.yang@easystack.cn On Wed, Jan 27, 2016 at 04:29:37PM +0800, zhanghailiang wrote: > Make the helper object_create() public and fix its first > parameter to accept NULL value. > > Signed-off-by: zhanghailiang > Cc: Paolo Bonzini > --- > v2: > - New patch > --- > include/qemu-common.h | 2 ++ > vl.c | 4 ++-- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/include/qemu-common.h b/include/qemu-common.h > index 22b010c..52cf4fd 100644 > --- a/include/qemu-common.h > +++ b/include/qemu-common.h > @@ -500,4 +500,6 @@ int parse_debug_env(const char *name, int max, int initial); > const char *qemu_ether_ntoa(const MACAddr *mac); > void page_size_init(void); > > +int object_create(void *opaque, QemuOpts *opts, Error **errp); > + > #endif > diff --git a/vl.c b/vl.c > index f043009..b21335e 100644 > --- a/vl.c > +++ b/vl.c > @@ -2819,7 +2819,7 @@ static bool object_create_delayed(const char *type) > } > > > -static int object_create(void *opaque, QemuOpts *opts, Error **errp) > +int object_create(void *opaque, QemuOpts *opts, Error **errp) > { > Error *err = NULL; > char *type = NULL; > @@ -2842,7 +2842,7 @@ static int object_create(void *opaque, QemuOpts *opts, Error **errp) > if (err) { > goto out; > } > - if (!type_predicate(type)) { > + if (type_predicate && !type_predicate(type)) { > goto out; > } No, please don't do this - your later patch should *not* be using object_create, it should use object_new_with_props. 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 :|