From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQCUw-0003lP-Vf for qemu-devel@nongnu.org; Thu, 11 Apr 2013 04:04:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQCUs-0005if-PL for qemu-devel@nongnu.org; Thu, 11 Apr 2013 04:04:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQCUs-0005iY-Fz for qemu-devel@nongnu.org; Thu, 11 Apr 2013 04:04:42 -0400 Date: Thu, 11 Apr 2013 10:04:37 +0200 From: Stefan Hajnoczi Message-ID: <20130411080437.GC5253@stefanha-thinkpad.redhat.com> References: <20130405093124.GA2351@dhcp-200-207.str.redhat.com> <1365552342-22840-1-git-send-email-josh.durgin@inktank.com> <87ip3uctjv.fsf@codemonkey.ws> <5165D747.8010901@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5165D747.8010901@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 2/2] rbd: link and load librbd dynamically List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel , Anthony Liguori , Josh Durgin On Wed, Apr 10, 2013 at 11:19:03PM +0200, Paolo Bonzini wrote: > Il 10/04/2013 17:08, Anthony Liguori ha scritto: > > /* This should not be used directly. Use block_init etc. instead. */ > > #ifdef CONFIG_MODULE > > #define module_init(function, type) \ > > const gchar *g_module_check_init(GModule *module) \ > > { \ > > register_module_init(function, type); \ > > return NULL; \ > > } > > #else > > #define module_init(function, type) \ > > static void __attribute__((constructor)) do_qemu_init_ ## function(void) { \ > > register_module_init(function, type); \ > > } > > #endif > > Not even that is needed. Modules can have constructor functions that > use symbols in the main executable. > > Basically, modules would be opened with G_MODULE_BIND_LOCAL and > communicate with QEMU via constructor functions only (registering driver > modules or QOM types). > > It is really more of a build-system hacking project than anything else. Great. So it seems like we just need a function early in QEMU startup that enumerates all shared libraries in QEMU_MODULE_PATH and opens them with G_MODULE_BIND_LOCAL. Perhaps in the future we'll load modules on-demand to avoid reduce footprint, but for now we can just load all of them just like you get when you build a QEMU binary with everything included. Stefan