From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAI95-0001dW-2M for qemu-devel@nongnu.org; Wed, 10 Oct 2018 13:19:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAI90-0007pD-DA for qemu-devel@nongnu.org; Wed, 10 Oct 2018 13:19:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59338) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gAI8u-0007m4-37 for qemu-devel@nongnu.org; Wed, 10 Oct 2018 13:19:30 -0400 References: From: Eric Blake Message-ID: Date: Wed, 10 Oct 2018 12:19:20 -0500 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 11/11] qga-win: demystify namespace striping List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Tomas Golembiovsky Cc: qemu-devel , sjubran@redhat.com, okrishtal@virtuozzo.com, Michael Roth On 10/4/18 8:20 AM, Marc-Andr=C3=A9 Lureau wrote: > Hi >=20 > On Thu, Oct 4, 2018 at 3:22 PM Tom=C3=A1=C5=A1 Golembiovsk=C3=BD wrote: >> >> It was not obvious what exactly the cryptic string copying does to the >> GUID. This change makes the intent clearer. In the subject line, s/striping/stripping/ (this is about performing a=20 'strip' operation on a prefix, but I read the subject as an instance of=20 'stripe' as in drawing a line or fragmenting data in a RAID). >> +++ b/qga/commands-win32.c >> @@ -507,7 +507,14 @@ static GuestPCIAddress *get_pci_info(char *guid, = Error **errp) >> char dev_name[MAX_PATH]; >> char *buffer =3D NULL; >> GuestPCIAddress *pci =3D NULL; >> - char *name =3D g_strdup(&guid[4]); >> + char *name =3D NULL; >> + >> + if ((g_str_has_prefix(guid, "\\\\.\\") =3D=3D TRUE) || >> + (g_str_has_prefix(guid, "\\\\?\\") =3D=3D TRUE)) { I find that 'cond =3D=3D true' is redundant to just writing 'cond'. And t= hat=20 sentiment applies to both the 'bool' and to the glib=20 abomination TRUE (why they had to invent their own boolean names, worse=20 in every way compared to , is beyond me). >> + name =3D g_strdup(&guid[4]); >=20 > I find "guid + 4" easier to read though Concur. --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org