From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ2QE-0001oF-FT for qemu-devel@nongnu.org; Wed, 10 Apr 2013 17:19:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQ2QD-0006u0-Iz for qemu-devel@nongnu.org; Wed, 10 Apr 2013 17:19:14 -0400 Received: from mail-qe0-f46.google.com ([209.85.128.46]:56799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ2QD-0006tw-ES for qemu-devel@nongnu.org; Wed, 10 Apr 2013 17:19:13 -0400 Received: by mail-qe0-f46.google.com with SMTP id nd7so542207qeb.33 for ; Wed, 10 Apr 2013 14:19:13 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5165D747.8010901@redhat.com> Date: Wed, 10 Apr 2013 23:19:03 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20130405093124.GA2351@dhcp-200-207.str.redhat.com> <1365552342-22840-1-git-send-email-josh.durgin@inktank.com> <87ip3uctjv.fsf@codemonkey.ws> In-Reply-To: <87ip3uctjv.fsf@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: Anthony Liguori Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel , Stefan Hajnoczi , Josh Durgin 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. Paolo > We then also need a way to load modules prior to calling init using the > GModule interfaces. Easiest thing to do is just load all .so's in a > single directory (/usr/lib/qemu/modules/*.so?) prior to calling any > module init functions.