From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNlwe-0007d2-RJ for qemu-devel@nongnu.org; Tue, 08 Nov 2011 08:42:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNlwY-0003aq-U0 for qemu-devel@nongnu.org; Tue, 08 Nov 2011 08:42:32 -0500 Received: from e1.ny.us.ibm.com ([32.97.182.141]:34143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNlwY-0003af-RP for qemu-devel@nongnu.org; Tue, 08 Nov 2011 08:42:26 -0500 Received: from /spool/local by e1.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Nov 2011 08:42:21 -0500 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pA8DddT0170814 for ; Tue, 8 Nov 2011 08:39:39 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pA8Ddcsh017876 for ; Tue, 8 Nov 2011 08:39:39 -0500 From: "Aneesh Kumar K.V" In-Reply-To: <1320731717-903-1-git-send-email-david@gibson.dropbear.id.au> References: <1320731717-903-1-git-send-email-david@gibson.dropbear.id.au> Date: Tue, 08 Nov 2011 19:09:05 +0530 Message-ID: <87pqh268ee.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] 9pfs: Stat response from server offset by 2 bytes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson , jvrao@linux.vnet.ibm.com Cc: trule@linux.vnet.ibm.com, rusty@rustcorp.com.au, qemu-devel@nongnu.org, thuth@de.ibm.com On Tue, 8 Nov 2011 16:55:17 +1100, David Gibson wrote: > From: Timothy Rule >=20 > The 9P spec states that for the stat message the "stat[n]" structure shal= l be > encoded at offset 7 in the 9P message (see =C2=A713.9 message Rstat). >=20 > The existing code is encoding a 2 byte value (hard coded 0 value) at > offset 7 of the 9P message, and then follows with the "stat[n]" structure > at offset 9 of the 9P message. >=20 > This patch removes the encoding of the 2 byte value which has the effect > of moving the "stat[n]" structure from offset 9 to offset 7 in the 9P > message Rstat. >=20 > Signed-off-by: Timothy Rule > Signed-off-by: David Gibson > --- > hw/9pfs/virtio-9p.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) >=20 > diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c > index 01cf337..35d8851 100644 > --- a/hw/9pfs/virtio-9p.c > +++ b/hw/9pfs/virtio-9p.c > @@ -1279,7 +1279,7 @@ static void v9fs_stat(void *opaque) > if (err < 0) { > goto out; > } > - offset +=3D pdu_marshal(pdu, offset, "wS", 0, &v9stat); > + offset +=3D pdu_marshal(pdu, offset, "S", &v9stat); > err =3D offset; > trace_v9fs_stat_return(pdu->tag, pdu->id, v9stat.mode, > v9stat.atime, v9stat.mtime, v9stat.length); The reason for that "w" is explained in the 9p2000 protocol RFC. Towards the end of "wstat" message para we have BUGS To make the contents of a directory, such as returned by read(5), easy to parse, each directory entry begins with a size field. For consistency, the entries in Twstat and Rstat messages also contain their size, which means the size appears twice. For example, the Rstat message is formatted as ``(4+1+2+2+n)[4] Rstat tag[2] n[2] (n-2)[2] type[2] dev[4]...,'' where n is the value returned by convD2M. Also on the client side we do in p9_client_stat err =3D p9pdu_readf(req->rc, clnt->proto_version, "wS", &ignored, ret); if (err) { So the above change will break existing client. Any reason why you need to make the above change ? -aneesh