virtio-9p: readdir implementation for 9p2000.L
PATCH v4 1/1 virtio-9p: readdir implementation for 9p2000.L
This patch implements the server part of readdir() implementation for
9p2000.L
Change from V3: Instead of inode, server now sends qids for each dirent
SYNOPSIS
size[4] Treaddir tag[2] fid[4] offset[8] count[4] size[4] Rreaddir tag[2] count[4] data[count]
DESCRIPTION
The readdir request asks the server to read the directory specified by 'fid' at an offset specified by 'offset' and return as many dirent structures as possible that fit into count bytes. Each dirent structure is laid out as follows.
qid.type[1]
the type of the file (directory, etc.), represented as a bit vector corresponding to the high 8 bits of the file's mode word.
qid.vers[4]
version number for given path
qid.path[8]
the file server's unique identification for the file
offset[8]
offset into the next dirent.
type[1]
type of this directory entry.
name[256]
name of this directory entry.
---
hw/virtio-9p-debug.c | 13 +++++ hw/virtio-9p.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/virtio-9p.h | 2 + 3 files changed, 134 insertions(+), 0 deletions(-)
hw/virtio-9p-debug.c +13 -0
@@ -328,6 +328,19 @@ void pprint_pdu(V9fsPDU *pdu) }switch (pdu->id) { +case P9_TREADDIR : +fprintf (llogfile,"TREADDIR: (" ); +pprint_int32 (pdu,0 , &offset,"fid" ); +pprint_int64 (pdu,0 , &offset,", initial offset" ); +pprint_int32 (pdu,0 , &offset,", max count" ); +break ; +case P9_RREADDIR : +fprintf (llogfile,"RREADDIR: (" ); +pprint_int32 (pdu,1 , &offset,"count" ); +#ifdef DEBUG_DATA +pprint_data (pdu,1 , &offset,", data" ); +#endif +break ;case P9_TVERSION :fprintf (llogfile,"TVERSION: (" );pprint_int32 (pdu,0 , &offset,"msize" );
hw/virtio-9p.c +119 -0
131 lines not on this page · raw message
hw/virtio-9p.h +2 -0
@@ -15,6 +15,8 @@enum {P9_TSTATFS =8 ,P9_RSTATFS , +P9_TREADDIR =40 , +P9_RREADDIR ,P9_TVERSION =100 ,P9_RVERSION ,P9_TAUTH =102 ,