On 11/05/15 12:33, Ian Campbell wrote: > On Fri, 2015-05-08 at 22:14 +0100, Andrew Cooper wrote: >> The migration code itself should be able to validly assume all mandatory >> callbacks are set up. >> >> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> >> CC: Ian Campbell <ian.campb...@citrix.com> >> CC: Ian Jackson <ian.jack...@eu.citrix.com> >> CC: Wei Liu <wei.l...@citrix.com> >> CC: Yang Hongyang <yan...@cn.fujitsu.com> >> --- >> tools/libxc/xc_sr_save.c | 4 ++++ >> tools/libxc/xc_sr_save_x86_hvm.c | 7 ------- >> 2 files changed, 4 insertions(+), 7 deletions(-) >> >> diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c >> index 5d9c267..83f0591 100644 >> --- a/tools/libxc/xc_sr_save.c >> +++ b/tools/libxc/xc_sr_save.c >> @@ -738,6 +738,10 @@ int xc_domain_save2(xc_interface *xch, int io_fd, >> uint32_t dom, >> ctx.save.max_iterations = 5; >> ctx.save.dirty_threshold = 50; >> >> + /* Sanity checks for callbacks. */ >> + if ( hvm ) >> + assert(callbacks->switch_qemu_logdirty); > assert(!hvm || callbacks->switch_qemu_logdirty) > > ?
I would argue that the former is far easier to read. The intention for this, and a subsequent patch, is "if (some option) assert(mandatory callbacks for option)" ~Andrew > >> + >> IPRINTF("In experimental %s", __func__); >> DPRINTF("fd %d, dom %u, max_iters %u, max_factor %u, flags %u, hvm %d", >> io_fd, dom, max_iters, max_factor, flags, hvm); >> diff --git a/tools/libxc/xc_sr_save_x86_hvm.c >> b/tools/libxc/xc_sr_save_x86_hvm.c >> index 8baa104..58efdb9 100644 >> --- a/tools/libxc/xc_sr_save_x86_hvm.c >> +++ b/tools/libxc/xc_sr_save_x86_hvm.c >> @@ -166,13 +166,6 @@ static int x86_hvm_setup(struct xc_sr_context *ctx) >> { >> xc_interface *xch = ctx->xch; >> >> - if ( !ctx->save.callbacks->switch_qemu_logdirty ) >> - { >> - ERROR("No switch_qemu_logdirty callback provided"); >> - errno = EINVAL; >> - return -1; >> - } >> - >> if ( ctx->save.callbacks->switch_qemu_logdirty( >> ctx->domid, 1, ctx->save.callbacks->data) ) >> { > _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel