ia64/xen-unstable

changeset 18217:1f338c90d60f

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@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jul 31 13:30:24 2008 +0100 (2008-07-31)
parents 8182a85460f7
children e446b7c3db5f
files extras/mini-os/pcifront.c
line diff
     1.1 --- a/extras/mini-os/pcifront.c	Thu Jul 31 12:39:56 2008 +0100
     1.2 +++ b/extras/mini-os/pcifront.c	Thu Jul 31 13:30:24 2008 +0100
     1.3 @@ -57,6 +57,7 @@ struct pcifront_dev *init_pcifront(char 
     1.4      int retry=0;
     1.5      char* msg;
     1.6      char* nodename = _nodename ? _nodename : "device/pci/0";
     1.7 +    int dom;
     1.8  
     1.9      struct pcifront_dev *dev;
    1.10  
    1.11 @@ -64,12 +65,18 @@ struct pcifront_dev *init_pcifront(char 
    1.12  
    1.13      printk("******************* PCIFRONT for %s **********\n\n\n", nodename);
    1.14  
    1.15 +    snprintf(path, sizeof(path), "%s/backend-id", nodename);
    1.16 +    dom = xenbus_read_integer(path); 
    1.17 +    if (dom == -1) {
    1.18 +        printk("no backend\n");
    1.19 +        return NULL;
    1.20 +    }
    1.21 +
    1.22      dev = malloc(sizeof(*dev));
    1.23      memset(dev, 0, sizeof(*dev));
    1.24      dev->nodename = strdup(nodename);
    1.25 +    dev->dom = dom;
    1.26  
    1.27 -    snprintf(path, sizeof(path), "%s/backend-id", nodename);
    1.28 -    dev->dom = xenbus_read_integer(path); 
    1.29      evtchn_alloc_unbound(dev->dom, pcifront_handler, dev, &dev->evtchn);
    1.30  
    1.31      dev->info = (struct xen_pci_sharedinfo*) alloc_page();