aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_domain_restore.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-05-24 10:14:10 +0100
committerIan Campbell <ian.campbell@citrix.com>2011-05-24 10:14:10 +0100
commitbc95f3a87c5f95550d3252d058122c8a8e769b8c (patch)
treebfdd358378c5cc07ea6288d011fee2e720098e26 /tools/libxc/xc_domain_restore.c
parent048e71cd85e5ab1a91c60a53745c7706004cf3d0 (diff)
downloadxen-bc95f3a87c5f95550d3252d058122c8a8e769b8c.tar.gz
xen-bc95f3a87c5f95550d3252d058122c8a8e769b8c.tar.bz2
xen-bc95f3a87c5f95550d3252d058122c8a8e769b8c.zip
libxc: save/restore: remove static context variables
20544:ad9d75d74bd5 and 20545:cc7d66ba0dad seemingly intended to change these global static variables into stack variables but didn't remove the static qualifier. Also zero the entire struct once with memset rather than clearing fields piecemeal in two different places. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com> Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_domain_restore.c')
-rw-r--r--tools/libxc/xc_domain_restore.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
index 6baf207f98..d475b2dc14 100644
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -1133,23 +1133,19 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
int orig_io_fd_flags;
- static struct restore_ctx _ctx = {
- .live_p2m = NULL,
- .p2m = NULL,
- };
- static struct restore_ctx *ctx = &_ctx;
+ struct restore_ctx _ctx;
+ struct restore_ctx *ctx = &_ctx;
struct domain_info_context *dinfo = &ctx->dinfo;
pagebuf_init(&pagebuf);
memset(&tailbuf, 0, sizeof(tailbuf));
tailbuf.ishvm = hvm;
- /* For info only */
- ctx->nr_pfns = 0;
-
if ( superpages )
return 1;
+ memset(ctx, 0, sizeof(*ctx));
+
ctxt = xc_hypercall_buffer_alloc(xch, ctxt, sizeof(*ctxt));
if ( ctxt == NULL )