# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1217507424 -3600
# Node ID 1f338c90d60f02ae46a32ed0c088950e4bea1e9e
# Parent 8182a85460f74d14f3b2fd49df43c528872700db
mini-os: make init_pcifront fail early if there is no backend
Else, we would leave entries in xenstore, which disturbs xend.
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
extras/mini-os/pcifront.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff -r 8182a85460f7 -r 1f338c90d60f extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c Thu Jul 31 12:39:56 2008 +0100
+++ b/extras/mini-os/pcifront.c Thu Jul 31 13:30:24 2008 +0100
@@ -57,19 +57,26 @@ struct pcifront_dev *init_pcifront(char
int retry=0;
char* msg;
char* nodename = _nodename ? _nodename : "device/pci/0";
+ int dom;
struct pcifront_dev *dev;
char path[strlen(nodename) + 1 + 10 + 1];
printk("******************* PCIFRONT for %s **********\n\n\n", nodename);
+
+ snprintf(path, sizeof(path), "%s/backend-id", nodename);
+ dom = xenbus_read_integer(path);
+ if (dom == -1) {
+ printk("no backend\n");
+ return NULL;
+ }
dev = malloc(sizeof(*dev));
memset(dev, 0, sizeof(*dev));
dev->nodename = strdup(nodename);
-
- snprintf(path, sizeof(path), "%s/backend-id", nodename);
- dev->dom = xenbus_read_integer(path);
+ dev->dom = dom;
+
evtchn_alloc_unbound(dev->dom, pcifront_handler, dev, &dev->evtchn);
dev->info = (struct xen_pci_sharedinfo*) alloc_page();
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|