libxc: move the domain_info_context into the restore_context
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 1 Dec 2009 13:55:50 +0000 (13:55 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 1 Dec 2009 13:55:50 +0000 (13:55 +0000)
Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
tools/libxc/xc_domain_restore.c

index 539d1b918e874a2a91958284125d3532b7c39468..f178b004d4e52b572c3aef81cc7606229a7f815e 100644 (file)
@@ -40,6 +40,7 @@ struct restore_ctx {
     xen_pfn_t *live_p2m; /* Live mapping of the table mapping each PFN to its current MFN. */
     xen_pfn_t *p2m; /* A table mapping each PFN to its new MFN. */
     unsigned no_superpage_mem; /* If have enough continuous memory for super page allocation */
+    struct domain_info_context dinfo;
 };
 
 static struct restore_ctx _ctx = {
@@ -49,9 +50,6 @@ static struct restore_ctx _ctx = {
 };
 static struct restore_ctx *ctx = &_ctx;
 
-static struct domain_info_context _dinfo;
-static struct domain_info_context *dinfo = &_dinfo;
-
 /*
 **
 **
@@ -315,6 +313,7 @@ static int allocate_physmem(int xc_handle, uint32_t dom,
     /* Buffer of pfn list for 2M page, or series of 4K pages */
     xen_pfn_t   *batch_buf;
     unsigned int batch_buf_len;
+    struct domain_info_context *dinfo = &ctx->dinfo;
 
     if ( !superpages )
     {
@@ -504,6 +503,7 @@ static int uncanonicalize_pagetable(int xc_handle, uint32_t dom,
     int i, pte_last;
     unsigned long pfn;
     uint64_t pte;
+    struct domain_info_context *dinfo = &ctx->dinfo;
 
     pte_last = PAGE_SIZE / ((ctx->pt_levels == 2)? 4 : 8);
 
@@ -548,6 +548,7 @@ static xen_pfn_t *load_p2m_frame_list(
     xen_pfn_t *p2m_frame_list;
     vcpu_guest_context_any_t ctxt;
     xen_pfn_t p2m_fl_zero;
+    struct domain_info_context *dinfo = &ctx->dinfo;
 
     /* Read first entry of P2M list, or extended-info signature (~0UL). */
     if ( read_exact(io_fd, &p2m_fl_zero, sizeof(long)) )
@@ -864,6 +865,7 @@ static int buffer_tail_pv(struct tailbuf_pv *buf, int fd,
 {
     unsigned int i;
     size_t pfnlen, vcpulen;
+    struct domain_info_context *dinfo = &ctx->dinfo;
 
     /* TODO: handle changing pfntab and vcpu counts */
     /* PFN tab */
@@ -1172,6 +1174,7 @@ static int apply_batch(int xc_handle, uint32_t dom, xen_pfn_t* region_mfn,
     /* A temporary mapping, and a copy, of one frame of guest memory. */
     unsigned long *page = NULL;
     int nraces = 0;
+    struct domain_info_context *dinfo = &ctx->dinfo;
 
     unsigned long mfn, pfn, pagetype;
 
@@ -1347,6 +1350,8 @@ int xc_domain_restore(int xc_handle, int io_fd, uint32_t dom,
     tailbuf_t tailbuf, tmptail;
     void* vcpup;
 
+    struct domain_info_context *dinfo = &ctx->dinfo;
+
     pagebuf_init(&pagebuf);
     memset(&tailbuf, 0, sizeof(tailbuf));
     tailbuf.ishvm = hvm;