WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] mini-os: make init_pcifront fail early if there is n

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] mini-os: make init_pcifront fail early if there is no backend
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Thu, 31 Jul 2008 12:57:03 +0100
Delivery-date: Thu, 31 Jul 2008 04:57:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
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();

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] mini-os: make init_pcifront fail early if there is no backend, Samuel Thibault <=