From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d81MT-00010y-BJ for qemu-devel@nongnu.org; Tue, 09 May 2017 05:23:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d81MO-00088k-7E for qemu-devel@nongnu.org; Tue, 09 May 2017 05:23:17 -0400 Received: from 17.mo5.mail-out.ovh.net ([46.105.56.132]:54566) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d81MO-000874-0a for qemu-devel@nongnu.org; Tue, 09 May 2017 05:23:12 -0400 Received: from player786.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id 46ABFEE27B for ; Tue, 9 May 2017 11:23:09 +0200 (CEST) Date: Tue, 9 May 2017 11:23:05 +0200 From: Greg Kurz Message-ID: <20170509112305.439c4d85@bahia> In-Reply-To: <3c8abd95-b490-1b71-b467-4f00d6ce121d@redhat.com> References: <149399500677.29022.12340124231191204194.stgit@bahia.lan> <149399504137.29022.4985100698645275511.stgit@bahia.lan> <3c8abd95-b490-1b71-b467-4f00d6ce121d@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/iX=/f9Tg0fZGwFXqt3QqHHa"; protocol="application/pgp-signature" Subject: Re: [Qemu-devel] [PATCH 3/5] 9pfs: local: simplify file opening List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, =?UTF-8?B?TMOpbw==?= Gaspard --Sig_/iX=/f9Tg0fZGwFXqt3QqHHa Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 5 May 2017 12:01:55 -0500 Eric Blake wrote: > On 05/05/2017 09:37 AM, Greg Kurz wrote: > > All paths in the virtfs directory now start with "./" (except the virtfs > > root itself which is exactly "."). > >=20 > > We hence don't need to skip leading '/' characters anymore, nor to hand= le > > the empty path case. Also, since virtfs will only ever be supported on > > linux+glibc hosts, we can use strchrnul() and come up with a much simpl= ier > > code to walk through the path elements. And we don't need to dup() the > > passed directory fd. > >=20 > > Signed-off-by: Greg Kurz > > --- > > hw/9pfs/9p-local.c | 5 ----- > > hw/9pfs/9p-util.c | 26 ++++++++++---------------- > > 2 files changed, 10 insertions(+), 21 deletions(-) > >=20 > > diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c > > index 92262f3c3e37..bb6e296df317 100644 > > --- a/hw/9pfs/9p-local.c > > +++ b/hw/9pfs/9p-local.c > > @@ -54,11 +54,6 @@ int local_open_nofollow(FsContext *fs_ctx, const cha= r *path, int flags, > > { > > LocalData *data =3D fs_ctx->private; > > =20 > > - /* All paths are relative to the path data->mountfd points to */ > > - while (*path =3D=3D '/') { > > - path++; > > - } =20 >=20 > Is it worth adding any assert()s in place of the deleted code? >=20 The assert() added by this patch ensures that we never pass an empty string to relative_openat_nofollow(), which isn't related to this hunk of deleted code... so I'm not sure I understand the question :-\ > Otherwise looks okay. >=20 --Sig_/iX=/f9Tg0fZGwFXqt3QqHHa Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlkRinoACgkQAvw66wEB28KJ+QCfS+fRyADG4JPzk0Blc8kHfXVg dksAniI9am1dSUkFLCQa+108oVYnX/Sm =kFOQ -----END PGP SIGNATURE----- --Sig_/iX=/f9Tg0fZGwFXqt3QqHHa--