virtio-9p: readdir implementation for 9p2000.L
PATCH 1/1 virtio-9p: readdir implementation for 9p2000.L
This patch implements the server part of readdir() implementation for 9p2000.L
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.
inode[8]
inode number of the file.
offset[8]
offset into the next dirent.
type[1]
type of this directory entry.
name[256]
name of this directory entry.
Signed-off-by Sripathi Kodi <[email protected]>
Reviewed-by M. Mohan Kumar <[email protected]>
Reviewed-by Venkateswararao Jujjuri <[email protected]>
---
hw/virtio-9p-debug.c | 13 ++++++ hw/virtio-9p.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/virtio-9p.h | 2 + 3 files changed, 125 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 +110 -0
122 lines not on this page · raw message
hw/virtio-9p.h +2 -0
@@ -13,6 +13,8 @@#define VIRTIO_9P_MOUNT_TAG 0enum { +P9_TREADDIR =40 , +P9_RREADDIR ,P9_TVERSION =100 ,P9_RVERSION ,P9_TAUTH =102 ,