From a050657a54f734d6ed809072f9c1329d8324ee67 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 21 Oct 2010 18:46:32 +0100 Subject: tools: cleanup domain save switch_qemu_logdirty callback Move the function into struct save_callbacks with the others and add the void *closure to the callback arguments. Add and propagate an error return code from the callback. Use this in libxl to pass the save context to libxl__domain_suspend_common_switch_qemu_logdirty allowing us to reuse the parent's xenstore handle, gc context etc. Also add an apparently missing libxl__free_all to libxl__domain_suspend_common. Signed-off-by: Ian Campbell Signed-off-by: Ian Jackson --- tools/xcutils/xc_save.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tools/xcutils') diff --git a/tools/xcutils/xc_save.c b/tools/xcutils/xc_save.c index cdf62afba6..4ae7e4cf9c 100644 --- a/tools/xcutils/xc_save.c +++ b/tools/xcutils/xc_save.c @@ -102,7 +102,7 @@ static int suspend(void* data) * active buffer. */ -static void switch_qemu_logdirty(int domid, unsigned int enable) +static int switch_qemu_logdirty(int domid, unsigned int enable, void *data) { struct xs_handle *xs; char *path, *p, *ret_str, *cmd_str, **watch; @@ -159,6 +159,8 @@ static void switch_qemu_logdirty(int domid, unsigned int enable) free(path); free(cmd_str); free(ret_str); + + return 0; } int @@ -205,9 +207,9 @@ main(int argc, char **argv) } memset(&callbacks, 0, sizeof(callbacks)); callbacks.suspend = suspend; + callbacks.switch_qemu_logdirty = switch_qemu_logdirty; ret = xc_domain_save(si.xch, io_fd, si.domid, maxit, max_f, si.flags, - &callbacks, !!(si.flags & XCFLAGS_HVM), - &switch_qemu_logdirty); + &callbacks, !!(si.flags & XCFLAGS_HVM)); if (si.suspend_evtchn > 0) xc_suspend_evtchn_release(si.xch, si.xce, si.domid, si.suspend_evtchn); -- cgit v1.2.3