From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOo2o-0005rV-Gg for qemu-devel@nongnu.org; Tue, 24 May 2011 05:36:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOo2k-00065G-5t for qemu-devel@nongnu.org; Tue, 24 May 2011 05:36:54 -0400 Received: from tx2ehsobe002.messaging.microsoft.com ([65.55.88.12]:11879 helo=TX2EHSOBE003.bigfish.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOo2k-000659-1O for qemu-devel@nongnu.org; Tue, 24 May 2011 05:36:50 -0400 Message-ID: <4DDB793C.4090605@amd.com> Date: Tue, 24 May 2011 11:24:12 +0200 From: Christoph Egger MIME-Version: 1.0 References: <4DDA5442.30801@amd.com> <4DDA6B2A.6000900@redhat.com> <4DDB6DFC.2090801@amd.com> <4DDB75FD.9080606@redhat.com> In-Reply-To: <4DDB75FD.9080606@redhat.com> Content-Type: text/plain; charset="ISO-8859-15"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] block/raw-posix: use a character device if a block device is given List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: "qemu-devel@nongnu.org" 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 >>>> Signed-off-by: Christoph Egger >>> >>> 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