qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Egger <Christoph.Egger@amd.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] block/raw-posix: use a character device if a block device is given
Date: Tue, 24 May 2011 11:24:12 +0200	[thread overview]
Message-ID: <4DDB793C.4090605@amd.com> (raw)
In-Reply-To: <4DDB75FD.9080606@redhat.com>

On 05/24/11 11:10, Kevin Wolf wrote:
> Am 24.05.2011 10:36, schrieb Christoph Egger:
>> On 05/23/11 16:11, Kevin Wolf wrote:
>>> Am 23.05.2011 14:34, schrieb Christoph Egger:
>>>>
>>>> if given a block device, use the character device instead.
>>>>
>>>> From: Manuel Bouyer<bouyer@NetBSD.org>
>>>> Signed-off-by: Christoph Egger<Christoph.Egger@amd.com>
>>>
>>> A useful commit message would explain why you're doing that.
>>
>> How about this:
>>
>> On NetBSD, the PV backend has to use the block device; but a
>> userland process is better with the character device interface. In
>> addition, a block device can't be opened twice; if the backend opens
>> it qemu can't and vice-versa.
>
> Hm, what PV backend? Are you talking about Xen? If so, let's make this
> clear:

Yes, it is about Xen.

> On NetBSD a userland process is better with the character device
> interface. In addition, a block device can't be opened twice; if a Xen
> backend opens it, qemu can't and vice-versa.
>
>>>> diff --git a/block/raw-posix.c b/block/raw-posix.c
>>>> index 6b72470..d05f373 100644
>>>> --- a/block/raw-posix.c
>>>> +++ b/block/raw-posix.c
>>>> @@ -136,11 +143,45 @@ static int64_t raw_getlength(BlockDriverState *bs);
>>>>     static int cdrom_reopen(BlockDriverState *bs);
>>>>     #endif
>>>>
>>>> +#if defined(__NetBSD__)
>>>> +static const char *raw_get_rawdevice(const char *filename)
>>>> +{
>>>> +    static char namebuf[PATH_MAX];
>>>> +    const char *dp = strrchr(filename, '/');
>>>> +
>>>> +    if (dp == NULL) {
>>>> +        snprintf(namebuf, PATH_MAX, "r%s", filename);
>>>> +    } else {
>>>> +        snprintf(namebuf, PATH_MAX, "%.*s/r%s",
>>>> +            (int)(dp - filename), filename, dp + 1);
>>>> +    }
>>>> +    fprintf(stderr, "%s is a block device", filename);
>>>> +    filename = namebuf;
>>>> +    fprintf(stderr, ", using %s\n", filename);
>>>
>>> Not sure if fprintf is a good idea here, but ok.
>>
>> I want to make it clear what file the qemu process has been
>> using. this is what log files are for, isn't it ?
>
> Yeah, while I don't like fprintfs in block driver code, I do agree that
> it makes some sense here.
>
> Kevin
>


-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

  reply	other threads:[~2011-05-24  9:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 12:34 [Qemu-devel] [PATCH] block/raw-posix: use a character device if a block device is given Christoph Egger
2011-05-23 13:42 ` Christoph Hellwig
2011-05-23 13:49   ` Christoph Egger
2011-05-23 14:11 ` Kevin Wolf
2011-05-24  8:36   ` Christoph Egger
2011-05-24  9:10     ` Kevin Wolf
2011-05-24  9:24       ` Christoph Egger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-24  9:30 Christoph Egger
2011-05-25 10:43 ` Kevin Wolf
2011-05-25 12:19   ` Christoph Egger
2011-05-25 13:01     ` Kevin Wolf

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=4DDB793C.4090605@amd.com \
    --to=christoph.egger@amd.com \
    --cc=kwolf@redhat.com \
    --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 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).