diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-04-06 07:13:19 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-04-06 07:13:19 +0100 |
commit | 453c7b64421b0520de33fdc130863f60a0f1bf9c (patch) | |
tree | 11c0c137e30bc58c5bb596d69c9ec7941b63aceb /extras/mini-os/blkfront.c | |
parent | efdf57d6133754c78a095ae15174f83f88039fb8 (diff) | |
download | xen-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/blkfront.c')
-rw-r--r-- | extras/mini-os/blkfront.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/extras/mini-os/blkfront.c b/extras/mini-os/blkfront.c index e06cf9f94a..9862fb9acb 100644 --- a/extras/mini-os/blkfront.c +++ b/extras/mini-os/blkfront.c @@ -152,13 +152,12 @@ again: } snprintf(path, sizeof(path), "%s/state", nodename); - err = xenbus_switch_state(xbt, path, XenbusStateConnected); + err = xenbus_switch_state(xbt, path, XenbusStateInitialised); if (err) { - message = "switching state"; + printk("error writing blk initialized on %s: %s\n", path, err); goto abort_transaction; } - err = xenbus_transaction_end(xbt, 0, &retry); if (err) free(err); if (retry) { @@ -189,6 +188,7 @@ done: { XenbusState state; char path[strlen(dev->backend) + 1 + 19 + 1]; + char frontpath[strlen(nodename) + 1 + 6 + 1]; snprintf(path, sizeof(path), "%s/mode", dev->backend); msg = xenbus_read(XBT_NIL, path, &c); if (msg) { @@ -232,7 +232,18 @@ done: dev->info.flush = xenbus_read_integer(path); *info = dev->info; + + printk("%s connected\n", dev->backend); + + snprintf(frontpath, sizeof(frontpath), "%s/state", nodename); + if((err = xenbus_switch_state(XBT_NIL, frontpath, XenbusStateConnected)) + != NULL) { + printk("error switching state: %s\n", err); + xenbus_unwatch_path_token(XBT_NIL, path, path); + goto error; + } } + unmask_evtchn(dev->evtchn); printk("%u sectors of %u bytes\n", dev->info.sectors, dev->info.sector_size); |