Message ID | 1308419348-31934-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sat, 2011-06-18 at 23:19 +0530, Aneesh Kumar K.V wrote: > The TSTAT output formwat is wS. So not sure whey we > need sizeof(u16)*2 in pdu length. See http://ericvh.github.com/9p-rfc/rfc9p2000.html#anchor32 "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." > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> > --- > tools/kvm/virtio/9p.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c > index 3172c1a..ef2fbaf 100644 > --- a/tools/kvm/virtio/9p.c > +++ b/tools/kvm/virtio/9p.c > @@ -458,7 +458,7 @@ static bool virtio_p9_stat(struct p9_dev *p9dev, struct p9_msg *msg, > > ret = virtio_p9_fill_stat(p9dev, fid->path, &st, rstat); > > - *outlen = VIRTIO_P9_HDR_LEN + ret + sizeof(u16) * 2; > + *outlen = VIRTIO_P9_HDR_LEN + ret + sizeof(u16); > set_p9msg_hdr(outmsg, *outlen, P9_RSTAT, msg->tag); > return true; > }
On Sat, 18 Jun 2011 14:51:19 -0400, Sasha Levin <levinsasha928@gmail.com> wrote: > On Sat, 2011-06-18 at 23:19 +0530, Aneesh Kumar K.V wrote: > > The TSTAT output formwat is wS. So not sure whey we > > need sizeof(u16)*2 in pdu length. > > See http://ericvh.github.com/9p-rfc/rfc9p2000.html#anchor32 > > "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." > The value returned by virtio_p9_fill_stat will include the accounting for extra size field added to rstat reply. So we just need an additional sizeof(u16). Not sizeof(u16) * 2 right ? -aneesh -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sun, 2011-06-19 at 10:41 +0530, Aneesh Kumar K.V wrote: > On Sat, 18 Jun 2011 14:51:19 -0400, Sasha Levin <levinsasha928@gmail.com> wrote: > > On Sat, 2011-06-18 at 23:19 +0530, Aneesh Kumar K.V wrote: > > > The TSTAT output formwat is wS. So not sure whey we > > > need sizeof(u16)*2 in pdu length. > > > > See http://ericvh.github.com/9p-rfc/rfc9p2000.html#anchor32 > > > > "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." > > > > The value returned by virtio_p9_fill_stat will include the accounting > for extra size field added to rstat reply. So we just need an additional > sizeof(u16). Not sizeof(u16) * 2 right ? virtio_p9_fill_stat() fills a stat structure as defined in section 13.9 of the RFC. rstat specifically requires an additional u16 before that stat structure, so virtio_p9_fill_stat() doesn't take it into account. Since that additional u16 is specific only to rstat - and is not needed in other places which expect the stat structure (such as when reading a directory), I wouldn't want virtio_p9_fill_stat() to take it into account.
diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c index 3172c1a..ef2fbaf 100644 --- a/tools/kvm/virtio/9p.c +++ b/tools/kvm/virtio/9p.c @@ -458,7 +458,7 @@ static bool virtio_p9_stat(struct p9_dev *p9dev, struct p9_msg *msg, ret = virtio_p9_fill_stat(p9dev, fid->path, &st, rstat); - *outlen = VIRTIO_P9_HDR_LEN + ret + sizeof(u16) * 2; + *outlen = VIRTIO_P9_HDR_LEN + ret + sizeof(u16); set_p9msg_hdr(outmsg, *outlen, P9_RSTAT, msg->tag); return true; }
The TSTAT output formwat is wS. So not sure whey we need sizeof(u16)*2 in pdu length. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> --- tools/kvm/virtio/9p.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)