From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLgvd-0007s0-11 for qemu-devel@nongnu.org; Thu, 06 Mar 2014 17:38:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLgvT-0003g5-BN for qemu-devel@nongnu.org; Thu, 06 Mar 2014 17:38:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLgvT-0003fs-2d for qemu-devel@nongnu.org; Thu, 06 Mar 2014 17:38:03 -0500 Message-ID: <5318F8C4.5010104@redhat.com> Date: Thu, 06 Mar 2014 23:37:56 +0100 From: Max Reitz MIME-Version: 1.0 References: <1394144739-2294-1-git-send-email-mreitz@redhat.com> <1394144861-2403-1-git-send-email-mreitz@redhat.com> In-Reply-To: <1394144861-2403-1-git-send-email-mreitz@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/5] block/raw-posix: Strip protocol prefix on creation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , =?ISO-8859-1?Q?Beno=EEt_Canet?= , Stefan Hajnoczi Sorry for the duplicate 4/5 and the wrong in-reply-to for 5/5, but I deduced from the send-email output that 4/5 failed to send (and 5/5 wasn't even attempted) and forgot --no-thread for the resend of 4 and 5. Max On 06.03.2014 23:27, Max Reitz wrote: > The hdev_create() implementation in block/raw-posix.c is used by the > "host_device", "host_cdrom" and "host_floppy" protocol block drivers > together. Thus, it any of the associated prefixes may occur and exactly > one should be stripped, if it does (thus, > "host_device:host_cdrom:/dev/cdrom" is not shortened to "/dev/cdrom"). > > Signed-off-by: Max Reitz > --- > block/raw-posix.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/block/raw-posix.c b/block/raw-posix.c > index 6c9b8f2..598d736 100644 > --- a/block/raw-posix.c > +++ b/block/raw-posix.c > @@ -1776,6 +1776,18 @@ static int hdev_create(const char *filename, QEMUOptionParameter *options, > int ret = 0; > struct stat stat_buf; > int64_t total_size = 0; > + bool has_prefix; > + > + /* This function is used by all three protocol block drivers and therefore > + * any of these three prefixes may be given. > + * The return value has to be stored somewhere, otherwise this is an error > + * due to -Werror=unused-value. */ > + has_prefix = > + strstart(filename, "host_device:", &filename) || > + strstart(filename, "host_cdrom:" , &filename) || > + strstart(filename, "host_floppy:", &filename); > + > + (void)has_prefix; > > /* Read out options */ > while (options && options->name) {