aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/pcifront.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-04-06 07:13:19 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-04-06 07:13:19 +0100
commit453c7b64421b0520de33fdc130863f60a0f1bf9c (patch)
tree11c0c137e30bc58c5bb596d69c9ec7941b63aceb /extras/mini-os/pcifront.c
parentefdf57d6133754c78a095ae15174f83f88039fb8 (diff)
downloadxen-453c7b64421b0520de33fdc130863f60a0f1bf9c.tar.gz
xen-453c7b64421b0520de33fdc130863f60a0f1bf9c.tar.bz2
xen-453c7b64421b0520de33fdc130863f60a0f1bf9c.zip
mini-os: Fix xenbus initialisation
This fixes xenbus initialization of blkfront, netfront and pcifront by uniformizing with fbfront: after writing parameters, set state to initialised, then wait for backend to switch to connect state, and then only read its parameter and switch to the connect state. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'extras/mini-os/pcifront.c')
-rw-r--r--extras/mini-os/pcifront.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/extras/mini-os/pcifront.c b/extras/mini-os/pcifront.c
index c2fbe7d178..ccbef3f0e5 100644
--- a/extras/mini-os/pcifront.c
+++ b/extras/mini-os/pcifront.c
@@ -143,7 +143,7 @@ struct pcifront_dev *init_pcifront(char *_nodename)
char* err;
char* message=NULL;
int retry=0;
- char* msg;
+ char* msg = NULL;
char* nodename = _nodename ? _nodename : "device/pci/0";
int dom;
@@ -206,7 +206,7 @@ again:
snprintf(path, sizeof(path), "%s/state", nodename);
err = xenbus_switch_state(xbt, path, XenbusStateInitialised);
if (err) {
- message = "switching state";
+ printk("error writing pci initialized: %s\n", err);
goto abort_transaction;
}
@@ -237,7 +237,7 @@ done:
{
char path[strlen(dev->backend) + 1 + 5 + 1];
- char frontpath[strlen(nodename) + 1 + 5 + 1];
+ char frontpath[strlen(nodename) + 1 + 6 + 1];
XenbusState state;
snprintf(path, sizeof(path), "%s/state", dev->backend);
@@ -254,9 +254,9 @@ done:
}
snprintf(frontpath, sizeof(frontpath), "%s/state", nodename);
- if ((err = xenbus_switch_state(XBT_NIL, frontpath, XenbusStateConnected))
+ if((err = xenbus_switch_state(XBT_NIL, frontpath, XenbusStateConnected))
!= NULL) {
- printk("error switching state %s\n", err);
+ printk("error switching state: %s\n", err);
xenbus_unwatch_path_token(XBT_NIL, path, path);
goto error;
}
@@ -271,6 +271,7 @@ done:
return dev;
error:
+ free(msg);
free(err);
free_pcifront(dev);
return NULL;