WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] stubdom: fix using minios frontends directly when li

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] stubdom: fix using minios frontends directly when libc is actived
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Tue, 17 Jun 2008 11:31:21 +0100
Delivery-date: Tue, 17 Jun 2008 03:31:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
stubdom: fix using minios frontends directly when libc is actived

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

diff -r 4f7f01de4239 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Tue Jun 17 10:18:15 2008 +0100
+++ b/extras/mini-os/blkfront.c Tue Jun 17 11:32:05 2008 +0100
@@ -63,7 +63,8 @@
     struct blkfront_dev *dev = data;
     int fd = dev->fd;
 
-    files[fd].read = 1;
+    if (fd != -1)
+        files[fd].read = 1;
 #endif
     wake_up(&blkfront_queue);
 }
@@ -105,6 +106,9 @@
     dev = malloc(sizeof(*dev));
     memset(dev, 0, sizeof(*dev));
     dev->nodename = strdup(nodename);
+#ifdef HAVE_LIBC
+    dev->fd = -1;
+#endif
 
     snprintf(path, sizeof(path), "%s/backend-id", nodename);
     dev->dom = xenbus_read_integer(path); 
@@ -424,8 +428,10 @@
 
 moretodo:
 #ifdef HAVE_LIBC
-    files[dev->fd].read = 0;
-    mb(); /* Make sure to let the handler set read to 1 before we start 
looking at the ring */
+    if (dev->fd != -1) {
+        files[dev->fd].read = 0;
+        mb(); /* Make sure to let the handler set read to 1 before we start 
looking at the ring */
+    }
 #endif
 
     rp = dev->ring.sring->rsp_prod;
diff -r 4f7f01de4239 extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c  Tue Jun 17 10:18:15 2008 +0100
+++ b/extras/mini-os/fbfront.c  Tue Jun 17 11:32:05 2008 +0100
@@ -44,7 +44,8 @@
     struct kbdfront_dev *dev = data;
     int fd = dev->fd;
 
-    files[fd].read = 1;
+    if (fd != -1)
+        files[fd].read = 1;
 #endif
     wake_up(&kbdfront_queue);
 }
@@ -83,6 +84,9 @@
 
     dev = malloc(sizeof(*dev));
     dev->nodename = strdup(nodename);
+#ifdef HAVE_LIBC
+    dev->fd = -1;
+#endif
 
     snprintf(path, sizeof(path), "%s/backend-id", nodename);
     dev->dom = xenbus_read_integer(path); 
@@ -179,8 +183,10 @@
     int i;
 
 #ifdef HAVE_LIBC
-    files[dev->fd].read = 0;
-    mb(); /* Make sure to let the handler set read to 1 before we start 
looking at the ring */
+    if (dev->fd != -1) {
+        files[dev->fd].read = 0;
+        mb(); /* Make sure to let the handler set read to 1 before we start 
looking at the ring */
+    }
 #endif
 
     prod = page->in_prod;
@@ -198,7 +204,7 @@
     notify_remote_via_evtchn(dev->evtchn);
 
 #ifdef HAVE_LIBC
-    if (cons != prod)
+    if (cons != prod && dev->fd != -1)
         /* still some events to read */
         files[dev->fd].read = 1;
 #endif
@@ -290,7 +296,8 @@
     struct fbfront_dev *dev = data;
     int fd = dev->fd;
 
-    files[fd].read = 1;
+    if (fd != -1)
+        files[fd].read = 1;
 #endif
     wake_up(&fbfront_queue);
 }
@@ -316,8 +323,10 @@
     int i;
 
 #ifdef HAVE_LIBC
-    files[dev->fd].read = 0;
-    mb(); /* Make sure to let the handler set read to 1 before we start 
looking at the ring */
+    if (dev->fd != -1) {
+        files[dev->fd].read = 0;
+        mb(); /* Make sure to let the handler set read to 1 before we start 
looking at the ring */
+    }
 #endif
 
     prod = page->in_prod;
@@ -335,7 +344,7 @@
     notify_remote_via_evtchn(dev->evtchn);
 
 #ifdef HAVE_LIBC
-    if (cons != prod)
+    if (cons != prod && dev->fd != -1)
         /* still some events to read */
         files[dev->fd].read = 1;
 #endif
@@ -363,6 +372,9 @@
 
     dev = malloc(sizeof(*dev));
     dev->nodename = strdup(nodename);
+#ifdef HAVE_LIBC
+    dev->fd = -1;
+#endif
 
     snprintf(path, sizeof(path), "%s/backend-id", nodename);
     dev->dom = xenbus_read_integer(path); 
diff -r 4f7f01de4239 extras/mini-os/netfront.c
--- a/extras/mini-os/netfront.c Tue Jun 17 10:18:15 2008 +0100
+++ b/extras/mini-os/netfront.c Tue Jun 17 11:32:05 2008 +0100
@@ -259,7 +259,8 @@
     network_tx_buf_gc(dev);
     local_irq_restore(flags);
 
-    files[fd].read = 1;
+    if (fd != -1)
+        files[fd].read = 1;
     wake_up(&netfront_queue);
 }
 #endif
@@ -323,6 +324,9 @@
     dev = malloc(sizeof(*dev));
     memset(dev, 0, sizeof(*dev));
     dev->nodename = strdup(nodename);
+#ifdef HAVE_LIBC
+    dev->fd = -1;
+#endif
 
     printk("net TX ring size %d\n", NET_TX_RING_SIZE);
     printk("net RX ring size %d\n", NET_RX_RING_SIZE);
@@ -610,7 +614,7 @@
 
     local_irq_save(flags);
     network_rx(dev);
-    if (!dev->rlen)
+    if (!dev->rlen && fd != -1)
        /* No data for us, make select stop returning */
        files[fd].read = 0;
     /* Before re-enabling the interrupts, in case a packet just arrived in the

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] stubdom: fix using minios frontends directly when libc is actived, Samuel Thibault <=