Skip to contentSkip to conversation

Define and implement TSYMLINK for 9P2000.L

PATCH New Venkateswararao Jujjuri (JV) 1 participant 1 message Jun 10, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Define and implement TSYMLINK for 9P2000.L

This patch implements creating a symlink for TSYMLINK request and responds with RSYMLINK. In the case of error, we return RERROR.

SYNOPSIS

size[4] Tsymlink tag[2] fid[4] name[s] symtgt[s] gid[4]

size[4] Rsymlink tag[2] qid[13]

DESCRIPTION

Create a symbolic link named 'name' pointing to 'symtgt'. gid represents the effective group id of the caller.
The permissions of a symbolic link are irrelevant hence it is omitted from the protocol.

---
 hw/virtio-9p-debug.c |   11 +++++++
 hw/virtio-9p.c       |   78 ++++++++++++++++++++++++++++++++++++++++++++++----
 hw/virtio-9p.h       |   14 +++++++++
 3 files changed, 97 insertions(+), 6 deletions(-)
hw/virtio-9p-debug.c +11 -0
index 18ef485..dbe7b24 100644
@@ -462,6 +462,17 @@ void pprint_pdu(V9fsPDU *pdu)
         pprint_qid(pdu, 1, &offset, "qid");
         pprint_int32(pdu, 1, &offset, ", iounit");
         break;
+    case P9_TSYMLINK:
+	fprintf(llogfile, "TSYMLINK: (");
+	pprint_int32(pdu, 0, &offset, "fid");
+	pprint_str(pdu, 0, &offset, ", name");
+	pprint_str(pdu, 0, &offset, ", symname");
+	pprint_int32(pdu, 0, &offset, ", gid");
+	break;
+    case P9_RSYMLINK:
+	fprintf(llogfile, "RSYMLINK: (");
+	pprint_qid(pdu, 1, &offset, "qid");
+	break;
     case P9_TREAD:
         fprintf(llogfile, "TREAD: (");
         pprint_int32(pdu, 0, &offset, "fid");
hw/virtio-9p.c +72 -6

106 lines not on this page · raw message

hw/virtio-9p.h +14 -0
index 52136bd..7203626 100644
@@ -15,6 +15,8 @@
 enum {
     P9_TSTATFS = 8,
     P9_RSTATFS,
+    P9_TSYMLINK = 16,
+    P9_RSYMLINK,
     P9_TGETATTR = 24,
     P9_RGETATTR,
     P9_TSETATTR = 26,
@@ -287,6 +289,18 @@ typedef struct V9fsWstatState
     V9fsString nname;
 } V9fsWstatState;
 
+typedef struct V9fsSymlinkState
+{
+    V9fsPDU *pdu;
+    size_t offset;
+    V9fsString name;
+    V9fsString symname;
+    V9fsString fullname;
+    V9fsFidState *dfidp;
+    V9fsQID qid;
+    struct stat stbuf;
+} V9fsSymlinkState;
+
 typedef struct V9fsIattr
 {
     int32_t valid;
Signature · 1 line
1.6.5.2