qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Fam Zheng <famz@redhat.com>
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
Subject: Re: [Qemu-devel] [PATCH v9 5/8] module: implement module loading
Date: Fri, 13 Sep 2013 15:07:01 +0100	[thread overview]
Message-ID: <20130913140700.GD2416@redhat.com> (raw)
In-Reply-To: <1379066356-14986-6-git-send-email-famz@redhat.com>

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

was this even tested before being posted ?

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  reply	other threads:[~2013-09-13 14:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13  9:59 [Qemu-devel] [PATCH v9 0/8] Shared Library Module Support Fam Zheng
2013-09-13  9:59 ` [Qemu-devel] [PATCH v9 1/8] ui/Makefile.objs: delete unnecessary cocoa.o dependency Fam Zheng
2013-09-13  9:59 ` [Qemu-devel] [PATCH v9 2/8] make.rule: fix $(obj) to a real relative path Fam Zheng
2013-09-13  9:59 ` [Qemu-devel] [PATCH v9 3/8] rule.mak: allow per object cflags and libs Fam Zheng
2013-09-13  9:59 ` [Qemu-devel] [PATCH v9 4/8] build-sys: introduce common-obj-m and block-obj-m for DSO Fam Zheng
2013-09-13  9:59 ` [Qemu-devel] [PATCH v9 5/8] module: implement module loading Fam Zheng
2013-09-13 14:07   ` Daniel P. Berrange [this message]
2013-09-16  1:30     ` Fam Zheng
2013-09-13 14:52   ` Richard Henderson
2013-09-13 16:20     ` Michael Tokarev
2013-09-13 19:43       ` Richard Henderson
2013-09-16  1:41     ` Fam Zheng
2013-09-13  9:59 ` [Qemu-devel] [PATCH v9 6/8] Makefile: install modules with "make install" Fam Zheng
2013-09-13  9:59 ` [Qemu-devel] [PATCH v9 7/8] .gitignore: ignore module related files (dll, so, mo) Fam Zheng
2013-09-13  9:59 ` [Qemu-devel] [PATCH v9 8/8] block: convert block drivers linked with libs to modules Fam Zheng
2013-09-13 11:31 ` [Qemu-devel] [PATCH v9 0/8] Shared Library Module Support Peter Maydell
2013-09-16  1:32   ` Fam Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130913140700.GD2416@redhat.com \
    --to=berrange@redhat.com \
    --cc=alex@alex.org.uk \
    --cc=famz@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=vilanova@ac.upc.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).