From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkvgQ-0006D5-2A for qemu-devel@nongnu.org; Mon, 25 Nov 2013 07:54:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VkvgK-0003lz-21 for qemu-devel@nongnu.org; Mon, 25 Nov 2013 07:54:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:17264) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkvgJ-0003lt-QG for qemu-devel@nongnu.org; Mon, 25 Nov 2013 07:54:27 -0500 Message-ID: <52934872.60904@redhat.com> Date: Mon, 25 Nov 2013 13:54:10 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1385001528-12003-1-git-send-email-imammedo@redhat.com> <1385001528-12003-8-git-send-email-imammedo@redhat.com> In-Reply-To: <1385001528-12003-8-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 07/27] add memdev backend infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: peter.maydell@linaro.org, mdroth@linux.vnet.ibm.com, mst@redhat.com, mjt@tls.msk.ru, stefanb@linux.vnet.ibm.com, stefanha@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, vasilis.liaskovitis@profitbricks.com, quintela@redhat.com, chegu_vinod@hp.com, kraxel@redhat.com, aliguori@amazon.com, hutao@cn.fujitsu.com, marcel.a@redhat.com, lcapitulino@redhat.com, afaerber@suse.de Il 21/11/2013 03:38, Igor Mammedov ha scritto: > + > + /* verify properties correctnes and initialize backend */ > + bc = MEMORY_BACKEND_GET_CLASS(obj); > + if (bc->get_memory) { > + HostMemoryBackend *backend = MEMORY_BACKEND(obj); > + if (!bc->get_memory(backend, &local_err)) { > + goto out; > + } > + } So this is why you need a new command-line option. I think we need a generic mechanism for post-initialization of whatever is given on the command line. Perhaps you can do that with an interface, and get rid of -memdev and memdev_add altogether? MemoryBackend's implementation of the interface's sole method would call get_memory, of course. Paolo > + /* make backend available to the world via QOM tree */ > + object_property_add_child(container_get(qemu_get_backend(), "/memdev"), > + qemu_opts_id(opts), obj, &local_err);