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);
}
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);
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;
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);
}
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);
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;
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
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);
}
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;
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
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);
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
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);
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