ia64/xen-unstable

changeset 18445:b146f0cf3b8b

xc_save: Janitorial work.

Remove an unused variable.
Replace errx by warnx when cleanup code follows.

From: Brendan Cully <brendan@cs.ubc.ca>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Sep 08 10:55:09 2008 +0100 (2008-09-08)
parents be573a356c90
children a7586ec158d0
files tools/xcutils/xc_save.c
line diff
     1.1 --- a/tools/xcutils/xc_save.c	Fri Sep 05 11:56:35 2008 +0100
     1.2 +++ b/tools/xcutils/xc_save.c	Mon Sep 08 10:55:09 2008 +0100
     1.3 @@ -71,7 +71,7 @@ static int suspend_evtchn_init(int xc, i
     1.4  
     1.5      xs = xs_daemon_open();
     1.6      if (!xs) {
     1.7 -	errx(1, "failed to get xenstore handle");
     1.8 +	warnx("failed to get xenstore handle");
     1.9  	return -1;
    1.10      }
    1.11      sprintf(path, "/local/domain/%d/device/suspend/event-channel", domid);
    1.12 @@ -88,20 +88,19 @@ static int suspend_evtchn_init(int xc, i
    1.13  
    1.14      si.xce = xc_evtchn_open();
    1.15      if (si.xce < 0) {
    1.16 -	errx(1, "failed to open event channel handle");
    1.17 +	warnx("failed to open event channel handle");
    1.18  	goto cleanup;
    1.19      }
    1.20  
    1.21      si.suspend_evtchn = xc_evtchn_bind_interdomain(si.xce, domid, port);
    1.22      if (si.suspend_evtchn < 0) {
    1.23 -	errx(1, "failed to bind suspend event channel: %d",
    1.24 -	     si.suspend_evtchn);
    1.25 +	warnx("failed to bind suspend event channel: %d", si.suspend_evtchn);
    1.26  	goto cleanup;
    1.27      }
    1.28  
    1.29      rc = xc_domain_subscribe_for_suspend(xc, domid, port);
    1.30      if (rc < 0) {
    1.31 -	errx(1, "failed to subscribe to domain: %d", rc);
    1.32 +	warnx("failed to subscribe to domain: %d", rc);
    1.33  	goto cleanup;
    1.34      }
    1.35  
    1.36 @@ -118,27 +117,25 @@ static int suspend_evtchn_init(int xc, i
    1.37   * receive the acknowledgement from the subscribe event channel. */
    1.38  static int evtchn_suspend(int domid)
    1.39  {
    1.40 -    int xcefd;
    1.41      int rc;
    1.42  
    1.43      rc = xc_evtchn_notify(si.xce, si.suspend_evtchn);
    1.44      if (rc < 0) {
    1.45 -	errx(1, "failed to notify suspend request channel: %d", rc);
    1.46 +	warnx("failed to notify suspend request channel: %d", rc);
    1.47  	return 0;
    1.48      }
    1.49  
    1.50 -    xcefd = xc_evtchn_fd(si.xce);
    1.51      do {
    1.52        rc = xc_evtchn_pending(si.xce);
    1.53        if (rc < 0) {
    1.54 -	errx(1, "error polling suspend notification channel: %d", rc);
    1.55 +	warnx("error polling suspend notification channel: %d", rc);
    1.56  	return 0;
    1.57        }
    1.58      } while (rc != si.suspend_evtchn);
    1.59  
    1.60      /* harmless for one-off suspend */
    1.61      if (xc_evtchn_unmask(si.xce, si.suspend_evtchn) < 0)
    1.62 -	errx(1, "failed to unmask suspend notification channel: %d", rc);
    1.63 +	warnx("failed to unmask suspend notification channel: %d", rc);
    1.64  
    1.65      /* notify xend that it can do device migration */
    1.66      printf("suspended\n");
    1.67 @@ -195,11 +192,9 @@ static void qemu_flip_buffer(int domid, 
    1.68  
    1.69      /* Tell qemu that we want it to start writing log-dirty bits to the
    1.70       * other buffer */
    1.71 -    if (!xs_write(xs, XBT_NULL, qemu_next_active_path, &digit, 1)) {
    1.72 +    if (!xs_write(xs, XBT_NULL, qemu_next_active_path, &digit, 1))
    1.73          errx(1, "can't write next-active to store path (%s)\n", 
    1.74 -              qemu_next_active_path);
    1.75 -        exit(1);
    1.76 -    }
    1.77 +	     qemu_next_active_path);
    1.78  
    1.79      /* Wait a while for qemu to signal that it has switched to the new 
    1.80       * active buffer */
    1.81 @@ -208,10 +203,8 @@ static void qemu_flip_buffer(int domid, 
    1.82      tv.tv_usec = 0;
    1.83      FD_ZERO(&fdset);
    1.84      FD_SET(xs_fileno(xs), &fdset);
    1.85 -    if ((select(xs_fileno(xs) + 1, &fdset, NULL, NULL, &tv)) != 1) {
    1.86 +    if ((select(xs_fileno(xs) + 1, &fdset, NULL, NULL, &tv)) != 1)
    1.87          errx(1, "timed out waiting for qemu to switch buffers\n");
    1.88 -        exit(1);
    1.89 -    }
    1.90      watch = xs_read_watch(xs, &len);
    1.91      free(watch);
    1.92