Received: from eggs.gnu.org ([2001:4830:134:3::10]:47706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLNen-00070k-NN for qemu-devel@nongnu.org; Sun, 15 Sep 2013 21:31:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLNeh-0005vk-Ny for qemu-devel@nongnu.org; Sun, 15 Sep 2013 21:31:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61117) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLNeh-0005va-G3 for qemu-devel@nongnu.org; Sun, 15 Sep 2013 21:31:11 -0400 Date: Mon, 16 Sep 2013 09:30:53 +0800 From: Fam Zheng Message-ID: <20130916013053.GA2700@T430s.nay.redhat.com> References: <1379066356-14986-1-git-send-email-famz@redhat.com> <1379066356-14986-6-git-send-email-famz@redhat.com> <20130913140700.GD2416@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130913140700.GD2416@redhat.com> Subject: Re: [Qemu-devel] [PATCH v9 5/8] module: implement module loading Reply-To: famz@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: peter.maydell@linaro.org, mjt@tls.msk.ru, qemu-devel@nongnu.org, alex@alex.org.uk, pbonzini@redhat.com, vilanova@ac.upc.edu, rth@twiddle.net On Fri, 09/13 15:07, Daniel P. Berrange wrote: > On Fri, Sep 13, 2013 at 05:59:13PM +0800, Fam Zheng wrote: > > +void module_load(module_load_type type) > > +{ > > +#ifdef CONFIG_MODULES > > + const char *path; > > + char *fname = NULL; > > + const char **mp; > > + const char *module_whitelist[] = { > > + CONFIG_MODULE_WHITELIST > > + }; > > + > > + if (!g_module_supported()) { > > + return; > > + } > > + > > + switch (type) { > > + case MODULE_LOAD_BLOCK: > > + path = CONFIG_MODDIR "/block/"; > > + break; > > + case MODULE_LOAD_UI: > > + path = CONFIG_MODDIR "/ui/"; > > + break; > > + case MODULE_LOAD_NET: > > + path = CONFIG_MODDIR "/net/"; > > + break; > > + default: > > + return; > > + } > > + > > + for (mp = &module_whitelist[0]; *mp; mp++) { > > + fname = g_strdup_printf("%s%s" HOST_DSOSUF, path, *mp); > > + module_load_file(fname); > > + g_free(fname); > > + } > > You need a separate whitelist for block, ui, net, etc. This code just > spews errors to stderr. > > Failed to open module file /home/berrange/usr/qemu-git-mod/lib/qemu/ui/iscsi.so: cannot open shared object file: No such file or directory > Failed to open module file /home/berrange/usr/qemu-git-mod/lib/qemu/ui/curl.so: cannot open shared object file: No such file or directory > Failed to open module file /home/berrange/usr/qemu-git-mod/lib/qemu/ui/rbd.so: cannot open shared object file: No such file or directory > Failed to open module file /home/berrange/usr/qemu-git-mod/lib/qemu/ui/gluster.so: cannot open shared object file: No such file or directory > Failed to open module file /home/berrange/usr/qemu-git-mod/lib/qemu/ui/ssh.so: cannot open shared object file: No such file or directory > Failed to open module file /home/berrange/usr/qemu-git-mod/lib/qemu/net/iscsi.so: cannot open shared object file: No such file or directory > Failed to open module file /home/berrange/usr/qemu-git-mod/lib/qemu/net/curl.so: cannot open shared object file: No such file or directory > Failed to open module file /home/berrange/usr/qemu-git-mod/lib/qemu/net/rbd.so: cannot open shared object file: No such file or directory > Failed to open module file /home/berrange/usr/qemu-git-mod/lib/qemu/net/gluster.so: cannot open shared object file: No such file or directory > Failed to open module file /home/berrange/usr/qemu-git-mod/lib/qemu/net/ssh.so: cannot open shared object file: No such file or directory > Given that we should accept non-existence of a whitelisted module (i.e. user didn't install it), I think it's these -ENOENT error messges are unnecessary. Fam