All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mini-os: make init_pcifront fail early if there is no backend
@ 2008-07-31 11:57 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2008-07-31 11:57 UTC (permalink / raw)
  To: xen-devel

mini-os: make init_pcifront fail early if there is no backend

Else, we would leave entries in xenstore, which disturbs xend.

diff -r 2a79aff15b74 extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c	Thu Jul 31 12:19:22 2008 +0100
+++ b/extras/mini-os/pcifront.c	Thu Jul 31 12:56:09 2008 +0100
@@ -57,6 +57,7 @@ struct pcifront_dev *init_pcifront(char 
     int retry=0;
     char* msg;
     char* nodename = _nodename ? _nodename : "device/pci/0";
+    int dom;
 
     struct pcifront_dev *dev;
 
@@ -64,12 +65,18 @@ struct pcifront_dev *init_pcifront(char 
 
     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);
+    dev->dom = dom;
 
-    snprintf(path, sizeof(path), "%s/backend-id", nodename);
-    dev->dom = xenbus_read_integer(path); 
     evtchn_alloc_unbound(dev->dom, pcifront_handler, dev, &dev->evtchn);
 
     dev->info = (struct xen_pci_sharedinfo*) alloc_page();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-31 11:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-31 11:57 [PATCH] mini-os: make init_pcifront fail early if there is no backend Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.