From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLh2c-0006wb-0G for qemu-devel@nongnu.org; Thu, 06 Mar 2014 17:45:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLh2X-0006Es-05 for qemu-devel@nongnu.org; Thu, 06 Mar 2014 17:45:25 -0500 Received: from lnantes-156-75-100-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:55880 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLh2W-0006El-R8 for qemu-devel@nongnu.org; Thu, 06 Mar 2014 17:45:20 -0500 Date: Thu, 6 Mar 2014 23:45:19 +0100 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140306224519.GD28835@irqsave.net> References: <1394144739-2294-1-git-send-email-mreitz@redhat.com> <1394144739-2294-5-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1394144739-2294-5-git-send-email-mreitz@redhat.com> Content-Transfer-Encoding: quoted-printable 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: Max Reitz Cc: Kevin Wolf , =?iso-8859-1?Q?Beno=EEt?= Canet , qemu-devel@nongnu.org, Stefan Hajnoczi The Thursday 06 Mar 2014 =E0 23:25:38 (+0100), 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"). >=20 > Signed-off-by: Max Reitz > --- > block/raw-posix.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) >=20 > 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, QEM= UOptionParameter *options, > int ret =3D 0; > struct stat stat_buf; > int64_t total_size =3D 0; > + bool has_prefix; > + > + /* This function is used by all three protocol block drivers and t= herefore > + * any of these three prefixes may be given. > + * The return value has to be stored somewhere, otherwise this is = an error > + * due to -Werror=3Dunused-value. */ > + has_prefix =3D > + strstart(filename, "host_device:", &filename) || > + strstart(filename, "host_cdrom:" , &filename) || > + strstart(filename, "host_floppy:", &filename); > + > + (void)has_prefix; > =20 > /* Read out options */ > while (options && options->name) { > --=20 > 1.9.0 >=20 >=20 Reviewed-by: Benoit Canet