virtio-9p: Add P9_TCLUNK support
authorAnthony Liguori <aliguori@us.ibm.com>
Thu, 29 Apr 2010 12:14:57 +0000 (17:44 +0530)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 3 May 2010 17:17:39 +0000 (12:17 -0500)
Implement P9_TCLUNK support.
This patch gets `ls -al` to work.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/virtio-9p.c

index 96e75d6ed8aa2ec9178d96bc0b564de02d5602e7..b9b892c318bf2b8970fa78459d87aad92874f908 100644 (file)
@@ -1311,9 +1311,21 @@ out:
 
 static void v9fs_clunk(V9fsState *s, V9fsPDU *pdu)
 {
-    if (debug_9p_pdu) {
-        pprint_pdu(pdu);
+    int32_t fid;
+    size_t offset = 7;
+    int err;
+
+    pdu_unmarshal(pdu, offset, "d", &fid);
+
+    err = free_fid(s, fid);
+    if (err < 0) {
+        goto out;
     }
+
+    offset = 7;
+    err = offset;
+out:
+    complete_pdu(s, pdu, err);
 }
 
 typedef struct V9fsReadState {