From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: [PATCH v4 06/29] tools/libxl: Split libxl__domain_create_state.restore_fd in two Date: Tue, 14 Jul 2015 11:59:21 +0100 Message-ID: <1436871584-6522-7-git-send-email-andrew.cooper3@citrix.com> References: <1436871584-6522-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436871584-6522-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Ian Jackson , Wei Liu List-Id: xen-devel@lists.xenproject.org In a future patch, we shall support automatically converting a legacy stream to a v2 stream, in which case libxc needs to read from a different fd. Simply overwriting restore_fd does not work; the two fd's have different circumstances. The restore_fd needs to be returned to its original state before libxl_domain_create_restore() returns, while in the converted case, the fd needs allocating and deallocating appropriately. No functional change. Signed-off-by: Andrew Cooper Acked-by: Ian Campbell CC: Ian Jackson CC: Wei Liu --- New in v2 --- tools/libxl/libxl_create.c | 2 +- tools/libxl/libxl_internal.h | 2 +- tools/libxl/libxl_save_callout.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 61515da..be13204 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1525,7 +1525,7 @@ static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config, cdcs->dcs.guest_config = d_config; libxl_domain_config_init(&cdcs->dcs.guest_config_saved); libxl_domain_config_copy(ctx, &cdcs->dcs.guest_config_saved, d_config); - cdcs->dcs.restore_fd = restore_fd; + cdcs->dcs.restore_fd = cdcs->dcs.libxc_fd = restore_fd; if (restore_fd > -1) cdcs->dcs.restore_params = *params; cdcs->dcs.callback = domain_create_cb; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 6428757..e5599a3 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -3216,7 +3216,7 @@ struct libxl__domain_create_state { libxl__ao *ao; libxl_domain_config *guest_config; libxl_domain_config guest_config_saved; /* vanilla config */ - int restore_fd; + int restore_fd, libxc_fd; libxl_domain_restore_params restore_params; libxl__domain_create_cb *callback; libxl_asyncprogress_how aop_console_how; diff --git a/tools/libxl/libxl_save_callout.c b/tools/libxl/libxl_save_callout.c index 80aae1b..1136b79 100644 --- a/tools/libxl/libxl_save_callout.c +++ b/tools/libxl/libxl_save_callout.c @@ -48,7 +48,7 @@ void libxl__xc_domain_restore(libxl__egc *egc, libxl__domain_create_state *dcs, /* Convenience aliases */ const uint32_t domid = dcs->guest_domid; - const int restore_fd = dcs->restore_fd; + const int restore_fd = dcs->libxc_fd; libxl__domain_build_state *const state = &dcs->build_state; unsigned cbflags = libxl__srm_callout_enumcallbacks_restore -- 1.7.10.4