Received: from eggs.gnu.org ([2001:4830:134:3::10]:34285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv1PL-0000Ii-C6 for qemu-devel@nongnu.org; Fri, 14 Oct 2016 08:16:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bv1PG-0004Uz-7U for qemu-devel@nongnu.org; Fri, 14 Oct 2016 08:16:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv1PF-0004Ur-Tf for qemu-devel@nongnu.org; Fri, 14 Oct 2016 08:16:10 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E30C83F42 for ; Fri, 14 Oct 2016 12:16:09 +0000 (UTC) Date: Fri, 14 Oct 2016 14:16:07 +0200 From: Igor Mammedov Message-ID: <20161014141607.53316d4e@nial.brq.redhat.com> In-Reply-To: <1476394002-8392-5-git-send-email-ehabkost@redhat.com> References: <1476394002-8392-1-git-send-email-ehabkost@redhat.com> <1476394002-8392-5-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/4] hostmem-file: Register TYPE_MEMORY_BACKEND_FILE properties as class properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: qemu-devel@nongnu.org, Markus Armbruster , Paolo Bonzini , "Michael S. Tsirkin" , Marcel Apfelbaum On Thu, 13 Oct 2016 18:26:42 -0300 Eduardo Habkost wrote: > To do the conversion, the file_backend_class_init() was moved > after the getter/setter functions. The old > file_backend_instance_init() function was removed because it is > not needed anymore. > > The NULL errp arguments on the property registration calls were > changed to &error_abort. > > Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov > --- > backends/hostmem-file.c | 26 +++++++++++--------------- > 1 file changed, 11 insertions(+), 15 deletions(-) > > diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c > index 5c4b808..42efb2f 100644 > --- a/backends/hostmem-file.c > +++ b/backends/hostmem-file.c > @@ -64,14 +64,6 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) > #endif > } > > -static void > -file_backend_class_init(ObjectClass *oc, void *data) > -{ > - HostMemoryBackendClass *bc = MEMORY_BACKEND_CLASS(oc); > - > - bc->alloc = file_backend_memory_alloc; > -} > - > static char *get_mem_path(Object *o, Error **errp) > { > HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o); > @@ -112,13 +104,18 @@ static void file_memory_backend_set_share(Object *o, bool value, Error **errp) > } > > static void > -file_backend_instance_init(Object *o) > +file_backend_class_init(ObjectClass *oc, void *data) > { > - object_property_add_bool(o, "share", > - file_memory_backend_get_share, > - file_memory_backend_set_share, NULL); > - object_property_add_str(o, "mem-path", get_mem_path, > - set_mem_path, NULL); > + HostMemoryBackendClass *bc = MEMORY_BACKEND_CLASS(oc); > + > + bc->alloc = file_backend_memory_alloc; > + > + object_class_property_add_bool(oc, "share", > + file_memory_backend_get_share, file_memory_backend_set_share, > + &error_abort); > + object_class_property_add_str(oc, "mem-path", > + get_mem_path, set_mem_path, > + &error_abort); > } > > static void file_backend_instance_finalize(Object *o) > @@ -132,7 +129,6 @@ static const TypeInfo file_backend_info = { > .name = TYPE_MEMORY_BACKEND_FILE, > .parent = TYPE_MEMORY_BACKEND, > .class_init = file_backend_class_init, > - .instance_init = file_backend_instance_init, > .instance_finalize = file_backend_instance_finalize, > .instance_size = sizeof(HostMemoryBackendFile), > };