diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-28 09:30:19 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-28 09:30:19 +0100 |
commit | 5cc436c1d2b3b0be3f42104582f53eec3969b43a (patch) | |
tree | 1e30ade146ee7287c486d1309b5d3d2c69a2d9b9 /tools/xcutils/xc_save.c | |
parent | 7f9a888af4b65cb8c22cea3c8295d30d0fedd623 (diff) | |
download | xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.tar.gz xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.tar.bz2 xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.zip |
libxc: eliminate static variables, use xentoollog; API change
This patch eliminate the global variables in libxenctrl (used for
logging and error reporting).
Instead the information which was in the global variables is now in a
new xc_interface* opaque structure, which xc_interface open returns
instead of the raw file descriptor; furthermore, logging is done via
xentoollog.
There are three new parameters to xc_interface_open to control the
logging, but existing callers can just pass "0" for all three to get
the old behaviour.
All libxc callers have been adjusted accordingly.
Also update QEMU_TAG for corresponding qemu change.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/xcutils/xc_save.c')
-rw-r--r-- | tools/xcutils/xc_save.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/xcutils/xc_save.c b/tools/xcutils/xc_save.c index 02570bda45..cdf62afba6 100644 --- a/tools/xcutils/xc_save.c +++ b/tools/xcutils/xc_save.c @@ -24,7 +24,7 @@ #include <xenguest.h> static struct suspendinfo { - int xc_fd; /* libxc handle */ + xc_interface *xch; int xce; /* event channel handle */ int suspend_evtchn; int domid; @@ -59,7 +59,7 @@ static int evtchn_suspend(void) return 0; } - if (xc_await_suspend(si.xce, si.suspend_evtchn) < 0) { + if (xc_await_suspend(si.xch, si.xce, si.suspend_evtchn) < 0) { warnx("suspend failed"); return 0; } @@ -77,7 +77,7 @@ static int suspend(void* data) /* Cannot notify guest to shut itself down if it's in ACPI sleep state. */ if (si.flags & XCFLAGS_HVM) - xc_get_hvm_param(si.xc_fd, si.domid, + xc_get_hvm_param(si.xch, si.domid, HVM_PARAM_ACPI_S_STATE, &sx_state); if ((sx_state == 0) && (si.suspend_evtchn >= 0)) @@ -171,8 +171,8 @@ main(int argc, char **argv) if (argc != 6) errx(1, "usage: %s iofd domid maxit maxf flags", argv[0]); - si.xc_fd = xc_interface_open(); - if (si.xc_fd < 0) + si.xch = xc_interface_open(0,0,0); + if (!si.xch) errx(1, "failed to open control interface"); io_fd = atoi(argv[1]); @@ -196,7 +196,7 @@ main(int argc, char **argv) else { si.suspend_evtchn = - xc_suspend_evtchn_init(si.xc_fd, si.xce, si.domid, port); + xc_suspend_evtchn_init(si.xch, si.xce, si.domid, port); if (si.suspend_evtchn < 0) warnx("suspend event channel initialization failed" @@ -205,17 +205,17 @@ main(int argc, char **argv) } memset(&callbacks, 0, sizeof(callbacks)); callbacks.suspend = suspend; - ret = xc_domain_save(si.xc_fd, io_fd, si.domid, maxit, max_f, si.flags, + ret = xc_domain_save(si.xch, io_fd, si.domid, maxit, max_f, si.flags, &callbacks, !!(si.flags & XCFLAGS_HVM), &switch_qemu_logdirty); if (si.suspend_evtchn > 0) - xc_suspend_evtchn_release(si.xce, si.domid, si.suspend_evtchn); + xc_suspend_evtchn_release(si.xch, si.xce, si.domid, si.suspend_evtchn); if (si.xce > 0) xc_evtchn_close(si.xce); - xc_interface_close(si.xc_fd); + xc_interface_close(si.xch); return ret; } |