From 0a9b2d786bbda43e056ae835dba758a74c26ec43 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 18 Jun 2008 09:32:50 +0100 Subject: stubdom: fix using minios frontends directly when libc is actived Signed-off-by: Samuel Thibault --- extras/mini-os/blkfront.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'extras/mini-os/blkfront.c') diff --git a/extras/mini-os/blkfront.c b/extras/mini-os/blkfront.c index e2ac965434..9e5411bce6 100644 --- a/extras/mini-os/blkfront.c +++ b/extras/mini-os/blkfront.c @@ -63,7 +63,8 @@ void blkfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) 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 *nodename, struct blkfront_info *info) 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_dev *dev) 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; -- cgit v1.2.3