debuggers.hg

changeset 21159:3895f8e0e633

mini-os: Fix frontend shutdown wait loop

minios frontends must wait for backends to be shut down and
reinitialized before freeing resources.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Apr 07 08:15:55 2010 +0100 (2010-04-07)
parents f46055ab176a
children d7ee309d0e01
files extras/mini-os/blkfront.c extras/mini-os/fbfront.c extras/mini-os/netfront.c extras/mini-os/pcifront.c
line diff
     1.1 --- a/extras/mini-os/blkfront.c	Wed Apr 07 08:15:33 2010 +0100
     1.2 +++ b/extras/mini-os/blkfront.c	Wed Apr 07 08:15:55 2010 +0100
     1.3 @@ -289,7 +289,7 @@ void shutdown_blkfront(struct blkfront_d
     1.4          goto close;
     1.5      }
     1.6      state = xenbus_read_integer(path);
     1.7 -    if (state < XenbusStateClosed) {
     1.8 +    while (state < XenbusStateClosed) {
     1.9          err = xenbus_wait_for_state_change(path, &state, &dev->events);
    1.10          if (err) free(err);
    1.11      }
     2.1 --- a/extras/mini-os/fbfront.c	Wed Apr 07 08:15:33 2010 +0100
     2.2 +++ b/extras/mini-os/fbfront.c	Wed Apr 07 08:15:55 2010 +0100
     2.3 @@ -262,7 +262,7 @@ void shutdown_kbdfront(struct kbdfront_d
     2.4          goto close_kbdfront;
     2.5      }
     2.6      state = xenbus_read_integer(path);
     2.7 -    if (state < XenbusStateClosed) {
     2.8 +    while (state < XenbusStateClosed) {
     2.9          err = xenbus_wait_for_state_change(path, &state, &dev->events);
    2.10          if (err) free(err);
    2.11      }
    2.12 @@ -272,8 +272,10 @@ void shutdown_kbdfront(struct kbdfront_d
    2.13                  XenbusStateInitialising, err);
    2.14          goto close_kbdfront;
    2.15      }
    2.16 -    // does not work yet.
    2.17 -    //xenbus_wait_for_value(path, "2", &dev->events);
    2.18 +    err = NULL;
    2.19 +    state = xenbus_read_integer(path);
    2.20 +    while (err == NULL && (state < XenbusStateInitWait || state >= XenbusStateClosed))
    2.21 +    err = xenbus_wait_for_state_change(path, &state, &dev->events);
    2.22  
    2.23  close_kbdfront:
    2.24      if (err) free(err);
    2.25 @@ -660,8 +662,11 @@ void shutdown_fbfront(struct fbfront_dev
    2.26                  XenbusStateInitialising, err);
    2.27          goto close_fbfront;
    2.28      }
    2.29 -    // does not work yet
    2.30 -    //xenbus_wait_for_value(path, "2", &dev->events);
    2.31 +
    2.32 +    err = NULL;
    2.33 +    state = xenbus_read_integer(path);
    2.34 +    while (err == NULL && (state < XenbusStateInitWait || state >= XenbusStateClosed))
    2.35 +        err = xenbus_wait_for_state_change(path, &state, &dev->events);
    2.36  
    2.37  close_fbfront:
    2.38      if (err) free(err);
     3.1 --- a/extras/mini-os/netfront.c	Wed Apr 07 08:15:33 2010 +0100
     3.2 +++ b/extras/mini-os/netfront.c	Wed Apr 07 08:15:55 2010 +0100
     3.3 @@ -546,7 +546,7 @@ void shutdown_netfront(struct netfront_d
     3.4          goto close;
     3.5      }
     3.6      state = xenbus_read_integer(path);
     3.7 -    if (state < XenbusStateClosed) {
     3.8 +    while (state < XenbusStateClosed) {
     3.9          err = xenbus_wait_for_state_change(path, &state, &dev->events);
    3.10          if (err) free(err);
    3.11      }
     4.1 --- a/extras/mini-os/pcifront.c	Wed Apr 07 08:15:33 2010 +0100
     4.2 +++ b/extras/mini-os/pcifront.c	Wed Apr 07 08:15:55 2010 +0100
     4.3 @@ -354,7 +354,7 @@ void shutdown_pcifront(struct pcifront_d
     4.4          goto close_pcifront;
     4.5      }
     4.6      state = xenbus_read_integer(path);
     4.7 -    if (state < XenbusStateClosed) {
     4.8 +    while (state < XenbusStateClosed) {
     4.9          err = xenbus_wait_for_state_change(path, &state, &dev->events);
    4.10          free(err);
    4.11      }