Patchwork [2/2,virtio-9p] Implement TLERROR/RLERROR.

login
register
mail settings
Submitter Arun Bharadwaj
Date July 13, 2010, 10:56 a.m.
Message ID <20100713105630.GB11854@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/58764/
State New
Headers show

Comments

Arun Bharadwaj - July 13, 2010, 10:56 a.m.
* Arun R Bharadwaj <arun@linux.vnet.ibm.com> [2010-07-13 16:24:41]:

This patch implements TLERROR/RLERROR in the qemu 9P server.

Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com>
---
 hw/virtio-9p.c |   19 +++++++++++++------
 hw/virtio-9p.h |    2 ++
 2 files changed, 15 insertions(+), 6 deletions(-)
Arun Bharadwaj - July 13, 2010, 12:44 p.m.
* Arun R Bharadwaj <arun@linux.vnet.ibm.com> [2010-07-13 16:26:30]:

> * Arun R Bharadwaj <arun@linux.vnet.ibm.com> [2010-07-13 16:24:41]:
> 
> This patch implements TLERROR/RLERROR in the qemu 9P server.
> 

Here is the link to client implementation of the same
http://sourceforge.net/mailarchive/message.php?msg_name=20100713110049.GC11854%40linux.vnet.ibm.com

-arun
Aneesh Kumar K.V - July 13, 2010, 1:11 p.m.
On Tuesday 13 July 2010 04:26 PM, Arun R Bharadwaj wrote:
> * Arun R Bharadwaj<arun@linux.vnet.ibm.com>  [2010-07-13 16:24:41]:
>
> This patch implements TLERROR/RLERROR in the qemu 9P server.
>
> Signed-off-by: Arun R Bharadwaj<arun@linux.vnet.ibm.com>
> ---
>   hw/virtio-9p.c |   19 +++++++++++++------
>   hw/virtio-9p.h |    2 ++
>   2 files changed, 15 insertions(+), 6 deletions(-)
>
> Index: qemu/hw/virtio-9p.h
> ===================================================================
> --- qemu.orig/hw/virtio-9p.h
> +++ qemu/hw/virtio-9p.h
> @@ -13,6 +13,8 @@
>   #define VIRTIO_9P_MOUNT_TAG 0
>
>   enum {
> +    P9_TLERROR = 6,
> +    P9_RLERROR,
>       P9_TVERSION = 100,
>       P9_RVERSION,
>       P9_TAUTH = 102,
> Index: qemu/hw/virtio-9p.c
> ===================================================================
> --- qemu.orig/hw/virtio-9p.c
> +++ qemu/hw/virtio-9p.c
> @@ -744,17 +744,24 @@ static void complete_pdu(V9fsState *s, V
>       int8_t id = pdu->id + 1; /* Response */
>
>       if (len<  0) {
> -        V9fsString str;
>           int err = -len;
> +        len = 7;
>
> -        str.data = strerror(err);
> -        str.size = strlen(str.data);
> +        if (s->proto_version != V9FS_PROTO_2000L) {
> +            V9fsString str;
> +
> +            str.data = strerror(err);
> +            str.size = strlen(str.data);
> +
> +            len += pdu_marshal(pdu, len, "s",&str);
> +            id = P9_RERROR;
> +        }
>
> -        len = 7;
> -        len += pdu_marshal(pdu, len, "s",&str);
>           len += pdu_marshal(pdu, len, "d", err);
>
> -        id = P9_RERROR;
> +        if (s->proto_version == V9FS_PROTO_2000L) {
> +            id = P9_RLERROR;
> +        }
>       }

I guess this can go in the else part of the above if loop
ie

if (s->proto_version != V9FS_PROTO_2000L) {

  id = P9_RERROR;
} else {
id = P9_RLERROR;
}


-aneesh
Arun Bharadwaj - July 13, 2010, 1:27 p.m.
* Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> [2010-07-13 18:41:18]:

> On Tuesday 13 July 2010 04:26 PM, Arun R Bharadwaj wrote:
> >* Arun R Bharadwaj<arun@linux.vnet.ibm.com>  [2010-07-13 16:24:41]:
> >
> >This patch implements TLERROR/RLERROR in the qemu 9P server.
> >
> >Signed-off-by: Arun R Bharadwaj<arun@linux.vnet.ibm.com>
> >---
> >  hw/virtio-9p.c |   19 +++++++++++++------
> >  hw/virtio-9p.h |    2 ++
> >  2 files changed, 15 insertions(+), 6 deletions(-)
> >
> >Index: qemu/hw/virtio-9p.h
> >===================================================================
> >--- qemu.orig/hw/virtio-9p.h
> >+++ qemu/hw/virtio-9p.h
> >@@ -13,6 +13,8 @@
> >  #define VIRTIO_9P_MOUNT_TAG 0
> >
> >  enum {
> >+    P9_TLERROR = 6,
> >+    P9_RLERROR,
> >      P9_TVERSION = 100,
> >      P9_RVERSION,
> >      P9_TAUTH = 102,
> >Index: qemu/hw/virtio-9p.c
> >===================================================================
> >--- qemu.orig/hw/virtio-9p.c
> >+++ qemu/hw/virtio-9p.c
> >@@ -744,17 +744,24 @@ static void complete_pdu(V9fsState *s, V
> >      int8_t id = pdu->id + 1; /* Response */
> >
> >      if (len<  0) {
> >-        V9fsString str;
> >          int err = -len;
> >+        len = 7;
> >
> >-        str.data = strerror(err);
> >-        str.size = strlen(str.data);
> >+        if (s->proto_version != V9FS_PROTO_2000L) {
> >+            V9fsString str;
> >+
> >+            str.data = strerror(err);
> >+            str.size = strlen(str.data);
> >+
> >+            len += pdu_marshal(pdu, len, "s",&str);
> >+            id = P9_RERROR;
> >+        }
> >
> >-        len = 7;
> >-        len += pdu_marshal(pdu, len, "s",&str);
> >          len += pdu_marshal(pdu, len, "d", err);
> >
> >-        id = P9_RERROR;
> >+        if (s->proto_version == V9FS_PROTO_2000L) {
> >+            id = P9_RLERROR;
> >+        }
> >      }
> 
> I guess this can go in the else part of the above if loop
> ie
> 
> if (s->proto_version != V9FS_PROTO_2000L) {
> 
>  id = P9_RERROR;
> } else {
> id = P9_RLERROR;
> }
> 

Sure. That works fine.

> 
> -aneesh

Patch

Index: qemu/hw/virtio-9p.h
===================================================================
--- qemu.orig/hw/virtio-9p.h
+++ qemu/hw/virtio-9p.h
@@ -13,6 +13,8 @@ 
 #define VIRTIO_9P_MOUNT_TAG 0
 
 enum {
+    P9_TLERROR = 6,
+    P9_RLERROR,
     P9_TVERSION = 100,
     P9_RVERSION,
     P9_TAUTH = 102,
Index: qemu/hw/virtio-9p.c
===================================================================
--- qemu.orig/hw/virtio-9p.c
+++ qemu/hw/virtio-9p.c
@@ -744,17 +744,24 @@  static void complete_pdu(V9fsState *s, V
     int8_t id = pdu->id + 1; /* Response */
 
     if (len < 0) {
-        V9fsString str;
         int err = -len;
+        len = 7;
 
-        str.data = strerror(err);
-        str.size = strlen(str.data);
+        if (s->proto_version != V9FS_PROTO_2000L) {
+            V9fsString str;
+
+            str.data = strerror(err);
+            str.size = strlen(str.data);
+
+            len += pdu_marshal(pdu, len, "s", &str);
+            id = P9_RERROR;
+        }
 
-        len = 7;
-        len += pdu_marshal(pdu, len, "s", &str);
         len += pdu_marshal(pdu, len, "d", err);
 
-        id = P9_RERROR;
+        if (s->proto_version == V9FS_PROTO_2000L) {
+            id = P9_RLERROR;
+        }
     }
 
     /* fill out the header */