All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Laurent Vivier <Laurent@vivier.eu>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] Introduce NBD named exports.
Date: Wed, 25 Aug 2010 10:21:38 +0200	[thread overview]
Message-ID: <4C74D292.6060402@redhat.com> (raw)
In-Reply-To: <1282688480.22220.14.camel@Quad>

Am 25.08.2010 00:21, schrieb Laurent Vivier:
> Le mardi 24 août 2010 à 10:59 +0200, Kevin Wolf a écrit :
>> Am 24.08.2010 03:04, schrieb Laurent Vivier:
>>> This patch allows to connect Qemu using NBD protocol to an nbd-server
>>> using named exports.
>>>
>>> For instance, if on the host "isoserver", in /etc/nbd-server/config, you have:
>>>
>>> [generic]
>>> [debian-500-ppc-netinst]
>>>         exportname = /ISO/debian-500-powerpc-netinst.iso
>>> [Fedora-10-ppc-netinst]
>>>         exportname = /ISO/Fedora-10-ppc-netinst.iso
>>>
>>> You can connect to it, using:
>>>
>>>     qemu -cdrom nbd:isoserver:exportname=debian-500-ppc-netinst
>>>     qemu -cdrom nbd:isoserver:exportname=Fedora-10-ppc-netinst
>>>
>>> NOTE: you need at least nbd-server 2.9.18
>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>>> ---
>>>  block/nbd.c   |   57 +++++++++++++++++++--------
>>>  nbd.c         |  119 ++++++++++++++++++++++++++++++++++++++++++++++++++------
>>>  nbd.h         |    5 ++-
>>>  qemu-doc.texi |    7 +++
>>>  qemu-nbd.c    |    2 +-
>>>  5 files changed, 158 insertions(+), 32 deletions(-)
>>>
>>> diff --git a/block/nbd.c b/block/nbd.c
>>> index a1ec123..ee22b47 100644
>>> --- a/block/nbd.c
>>> +++ b/block/nbd.c
>>> @@ -42,55 +42,78 @@ typedef struct BDRVNBDState {
>>>  static int nbd_open(BlockDriverState *bs, const char* filename, int flags)
>>>  {
>>>      BDRVNBDState *s = bs->opaque;
>>> +
>>> +    #define EN_OPTSTR ":exportname="
>>
>> Hm, this makes EN_OPTSTR look like a local variable, but it's actually a
>> macro which is valid after the end of the function. So maybe move it out?
> 
> I agree, but have a look at curl_open().

Seems I should have reviewed the curl patch when it came in. :-)

>> Maybe using strlen(EN_OPTSTR) would be clearer? At first I missed the
>> fact that sizeof includes the null byte, but maybe it's just me.
> 
> I think sizeof() is resolved at compile time whereas strlen() it is at
> runtime. For me, it is better, it like to have a constant.

gcc is smart enough to make strlen of a literal string a constant, too.
Besides, opening a connection isn't really performance critical.

I guess it's a matter of taste, though. So if you like it better as it
is, just leave it.

>> I don't have a new enough ndbserver to test if it actually works (and I
> 
> You can test against an old nbdserver to check it is always working ;-)
> (or qemu-nbd).

Sure, I can test for regressions in the old thing.

>> also haven't checked the spec for the new parts), so I'll have to trust
>> your tests there.
> 
> There is no spec (what is a spec ;-) ?), only a reference implementation
> in nbd-client.c and nbd-server.c from http://nbd.sf.net.

Oh right, I forgot, the world outside qemu is just as bad. :-)

Kevin

  parent reply	other threads:[~2010-08-25  8:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-24  1:04 [Qemu-devel] [PATCH] Introduce NBD named exports Laurent Vivier
2010-08-24  8:59 ` Kevin Wolf
2010-08-24 22:21   ` Laurent Vivier
2010-08-24 22:45     ` [Qemu-devel] [PATCH][v2] " Laurent Vivier
2010-08-25  8:21     ` Kevin Wolf [this message]
2010-08-25 20:48       ` [Qemu-devel] [PATCH][v3] " Laurent Vivier
2010-08-25 21:10         ` Anthony Liguori
2010-08-26 14:07         ` Kevin Wolf
  -- strict thread matches above, loose matches on Subject: below --
2010-08-25  9:35 [Qemu-devel] [PATCH] " Laurent Vivier

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=4C74D292.6060402@redhat.com \
    --to=kwolf@redhat.com \
    --cc=Laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    /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.