virtio-9p: Add P9_TVERSION support
authorAnthony Liguori <aliguori@us.ibm.com>
Thu, 29 Apr 2010 12:14:51 +0000 (17:44 +0530)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 3 May 2010 17:17:38 +0000 (12:17 -0500)
Implement P9_TVERSION support.

[sripathik@in.ibm.com: Handle unknown 9P versions as per the standards]

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 c31f48c36e4ef3370931d135e4dfefcc23220e85..c1c7723d40a499153494b804bab6c956fa37c301 100644 (file)
@@ -843,9 +843,20 @@ static void v9fs_dummy(V9fsState *s, V9fsPDU *pdu)
 
 static void v9fs_version(V9fsState *s, V9fsPDU *pdu)
 {
-    if (debug_9p_pdu) {
-        pprint_pdu(pdu);
+    int32_t msize;
+    V9fsString version;
+    size_t offset = 7;
+
+    pdu_unmarshal(pdu, offset, "ds", &msize, &version);
+
+    if (strcmp(version.data, "9P2000.u")) {
+        v9fs_string_sprintf(&version, "unknown");
     }
+
+    offset += pdu_marshal(pdu, offset, "ds", msize, &version);
+    complete_pdu(s, pdu, offset);
+
+    v9fs_string_free(&version);
 }
 
 static void v9fs_attach(V9fsState *s, V9fsPDU *pdu)