# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1213777970 -3600
# Node ID 21e1daf19b961c34f0709e0e652eab2a863f7a1b
# Parent 7e00ebe2b7fdeaa8982326f61e776bfe912ea53b
stubdom: fix using minios frontends directly when libc is actived
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
extras/mini-os/blkfront.c | 12 +++++++++---
extras/mini-os/fbfront.c | 28 ++++++++++++++++++++--------
extras/mini-os/netfront.c | 8 ++++++--
3 files changed, 35 insertions(+), 13 deletions(-)
diff -r 7e00ebe2b7fd -r 21e1daf19b96 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Tue Jun 17 09:36:25 2008 +0100
+++ b/extras/mini-os/blkfront.c Wed Jun 18 09:32:50 2008 +0100
@@ -63,7 +63,8 @@ void blkfront_handler(evtchn_port_t port
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 @@ struct blkfront_dev *init_blkfront(char
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);
@@ -418,8 +422,10 @@ int blkfront_aio_poll(struct blkfront_de
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 7e00ebe2b7fd -r 21e1daf19b96 extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c Tue Jun 17 09:36:25 2008 +0100
+++ b/extras/mini-os/fbfront.c Wed Jun 18 09:32:50 2008 +0100
@@ -44,7 +44,8 @@ void kbdfront_handler(evtchn_port_t port
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 @@ struct kbdfront_dev *init_kbdfront(char
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 kbdfront_receive(struct kbdfront_dev
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 @@ int kbdfront_receive(struct kbdfront_dev
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
@@ -281,7 +287,8 @@ void fbfront_handler(evtchn_port_t port,
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);
}
@@ -307,8 +314,10 @@ int fbfront_receive(struct fbfront_dev *
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;
@@ -326,7 +335,7 @@ int fbfront_receive(struct fbfront_dev *
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
@@ -354,6 +363,9 @@ struct fbfront_dev *init_fbfront(char *n
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 7e00ebe2b7fd -r 21e1daf19b96 extras/mini-os/netfront.c
--- a/extras/mini-os/netfront.c Tue Jun 17 09:36:25 2008 +0100
+++ b/extras/mini-os/netfront.c Wed Jun 18 09:32:50 2008 +0100
@@ -259,7 +259,8 @@ void netfront_select_handler(evtchn_port
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 @@ struct netfront_dev *init_netfront(char
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);
@@ -599,7 +603,7 @@ ssize_t netfront_receive(struct netfront
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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|