From: Fam Zheng <famz@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>, clord@redhat.com
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org,
mreitz@redhat.com, Marc Mari <markmb@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 3/3] blockdev: Add dynamic module loading for block drivers
Date: Mon, 27 Jun 2016 17:31:09 +0800 [thread overview]
Message-ID: <20160627093109.GA4461@ad.usersys.redhat.com> (raw)
In-Reply-To: <20160624103755.GN25240@redhat.com>
On Fri, 06/24 11:37, Daniel P. Berrange wrote:
> On Fri, Jun 24, 2016 at 11:04:43AM +0100, Stefan Hajnoczi wrote:
> > On Wed, Jun 22, 2016 at 05:35:54PM -0400, Colin Lord wrote:
> >
> > >
> > > @@ -447,8 +466,15 @@ int get_tmp_filename(char *filename, int size)
> > > static BlockDriver *find_hdev_driver(const char *filename)
> > > {
> > > int score_max = 0, score;
> > > + size_t i;
> > > BlockDriver *drv = NULL, *d;
> > >
> > > + for (i = 0; i < ARRAY_SIZE(block_driver_modules); ++i) {
> > > + if (block_driver_modules[i].has_probe_device) {
> > > + block_module_load_one(block_driver_modules[i].library_name);
> > > + }
> > > + }
> >
> > This patch series needs to solve probing so that we don't end up loading
> > all block drivers. Fam's suggestion for a built-in probe.c sounds good
> > to me.
>
> Do we really care if probing loads all drivers ? Last time we discussed
> this I thought we decided that because probing almost always leads to
> security vulnerabilities, no one should use it by default and so we
> don't really need to worry about optimizing it.
Does this mean we can drop "has_probe" and "has_probe_device" from the
generated header and load all modules for probe? If so, I'd like to again
stress my preference for a "simplified" code "parser":
All of current block_init() calls except quorum can be converted with this:
#define BLOCK_DRIVER_EXPORT(fmt_name, prot_name, drv) \
static void bdrv_ ## fmt_name ## _ ## prot_name(void) \
{ \
if (strlen(#fmt_name)) { \
drv->format_name = #fmt_name; \
} \
if (strlen(#prot_name)) { \
drv->protocol_name = #prot_name; \
} \
bdrv_register(&(drv)); \
} \
block_init(bdrv_ ## fmt_name ## prot_name)
curl.c:
BLOCK_DRIVER_EXPORT(http, http, bdrv_http);
BLOCK_DRIVER_EXPORT(https, https, bdrv_https);
BLOCK_DRIVER_EXPORT(ftp, ftp, bdrv_ftp);
...
iscsi.c (on top of patch 1):
BLOCK_DRIVER_EXPORT(iscsi, iscsi, bdrv_iscsi);
vmdk.c:
BLOCK_DRIVER_EXPORT(vmdk,, bdrv_vmdk);
Then the python generator greps for BLOCK_DRIVER_EXPORT, instead of 'static
BlockDriver', which is much more reliable (in the sense of whitespace subtlety,
field name changing, etc).
Fam
next prev parent reply other threads:[~2016-06-27 9:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-22 21:35 [Qemu-devel] [PATCH 0/3] Dynamic module loading for block drivers Colin Lord
2016-06-22 21:35 ` [Qemu-devel] [PATCH 1/3] blockdev: prepare iSCSI block driver for dynamic loading Colin Lord
2016-06-23 1:22 ` Fam Zheng
2016-06-23 20:44 ` Colin Lord
2016-06-22 21:35 ` [Qemu-devel] [PATCH 2/3] blockdev: Add dynamic generation of module_block.h Colin Lord
2016-06-23 1:48 ` Fam Zheng
2016-06-24 9:54 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-22 21:35 ` [Qemu-devel] [PATCH 3/3] blockdev: Add dynamic module loading for block drivers Colin Lord
2016-06-23 2:00 ` Fam Zheng
2016-06-23 2:47 ` Fam Zheng
2016-06-24 10:04 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-24 10:37 ` Daniel P. Berrange
2016-06-27 9:31 ` Fam Zheng [this message]
2016-06-27 12:44 ` Stefan Hajnoczi
2016-06-22 21:41 ` [Qemu-devel] [PATCH 0/3] Dynamic " Colin Lord
2016-06-23 1:53 ` 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=20160627093109.GA4461@ad.usersys.redhat.com \
--to=famz@redhat.com \
--cc=berrange@redhat.com \
--cc=clord@redhat.com \
--cc=kwolf@redhat.com \
--cc=markmb@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.