|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 3/6] libxc/migration: Be rather stricter with illformed callers
On Mon, 2015-05-11 at 12:47 +0100, Andrew Cooper wrote:
> 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.cooper3@xxxxxxxxxx>
> >> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
> >> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> >> CC: Wei Liu <wei.liu2@xxxxxxxxxx>
> >> CC: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
> >> ---
> >> 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.
I read this as "assert that either the guest is not an hvm guest or the
callback is provided", but fair enough.
> 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@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |