From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: [PATCH] mini-os: make init_pcifront fail early if there is no backend Date: Thu, 31 Jul 2008 12:57:03 +0100 Message-ID: <20080731115702.GG4678@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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();