[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC v2 04/23] libxc/xc_sr: naming correction: mfns -> gfns



From: Joshua Otto <jtotto@xxxxxxxxxxxx>

In write_batch() on the migration save side and in process_page_data()
on the corresponding path on the restore side, a local variable named
'mfns' is used to refer to an array of what are actually gfns.  Rename
both to 'gfns' to address this.

No functional change.

Signed-off-by: Joshua Otto <jtotto@xxxxxxxxxxxx>
Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 tools/libxc/xc_sr_restore.c | 16 ++++++++--------
 tools/libxc/xc_sr_save.c    | 20 ++++++++++----------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
index 481a904..2f35f4d 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xc_sr_restore.c
@@ -203,7 +203,7 @@ static int process_page_data(struct xc_sr_context *ctx, 
unsigned count,
                              xen_pfn_t *pfns, uint32_t *types, void *page_data)
 {
     xc_interface *xch = ctx->xch;
-    xen_pfn_t *mfns = malloc(count * sizeof(*mfns));
+    xen_pfn_t *gfns = malloc(count * sizeof(*gfns));
     int *map_errs = malloc(count * sizeof(*map_errs));
     int rc;
     void *mapping = NULL, *guest_page = NULL;
@@ -211,11 +211,11 @@ static int process_page_data(struct xc_sr_context *ctx, 
unsigned count,
         j,         /* j indexes the subset of pfns we decide to map. */
         nr_pages = 0;
 
-    if ( !mfns || !map_errs )
+    if ( !gfns || !map_errs )
     {
         rc = -1;
         ERROR("Failed to allocate %zu bytes to process page data",
-              count * (sizeof(*mfns) + sizeof(*map_errs)));
+              count * (sizeof(*gfns) + sizeof(*map_errs)));
         goto err;
     }
 
@@ -246,7 +246,7 @@ static int process_page_data(struct xc_sr_context *ctx, 
unsigned count,
         case XEN_DOMCTL_PFINFO_L4TAB:
         case XEN_DOMCTL_PFINFO_L4TAB | XEN_DOMCTL_PFINFO_LPINTAB:
 
-            mfns[nr_pages++] = ctx->restore.ops.pfn_to_gfn(ctx, pfns[i]);
+            gfns[nr_pages++] = ctx->restore.ops.pfn_to_gfn(ctx, pfns[i]);
             break;
         }
     }
@@ -257,11 +257,11 @@ static int process_page_data(struct xc_sr_context *ctx, 
unsigned count,
 
     mapping = guest_page = xenforeignmemory_map(xch->fmem,
         ctx->domid, PROT_READ | PROT_WRITE,
-        nr_pages, mfns, map_errs);
+        nr_pages, gfns, map_errs);
     if ( !mapping )
     {
         rc = -1;
-        PERROR("Unable to map %u mfns for %u pages of data",
+        PERROR("Unable to map %u gfns for %u pages of data",
                nr_pages, count);
         goto err;
     }
@@ -281,7 +281,7 @@ static int process_page_data(struct xc_sr_context *ctx, 
unsigned count,
         {
             rc = -1;
             ERROR("Mapping pfn %#"PRIpfn" (mfn %#"PRIpfn", type %#"PRIx32") 
failed with %d",
-                  pfns[i], mfns[j], types[i], map_errs[j]);
+                  pfns[i], gfns[j], types[i], map_errs[j]);
             goto err;
         }
 
@@ -320,7 +320,7 @@ static int process_page_data(struct xc_sr_context *ctx, 
unsigned count,
         xenforeignmemory_unmap(xch->fmem, mapping, nr_pages);
 
     free(map_errs);
-    free(mfns);
+    free(gfns);
 
     return rc;
 }
diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c
index 8aba0d8..e93d8fd 100644
--- a/tools/libxc/xc_sr_save.c
+++ b/tools/libxc/xc_sr_save.c
@@ -79,7 +79,7 @@ static int write_checkpoint_record(struct xc_sr_context *ctx)
 static int write_batch(struct xc_sr_context *ctx)
 {
     xc_interface *xch = ctx->xch;
-    xen_pfn_t *mfns = NULL, *types = NULL;
+    xen_pfn_t *gfns = NULL, *types = NULL;
     void *guest_mapping = NULL;
     void **guest_data = NULL;
     void **local_pages = NULL;
@@ -98,7 +98,7 @@ static int write_batch(struct xc_sr_context *ctx)
     assert(nr_pfns != 0);
 
     /* Mfns of the batch pfns. */
-    mfns = malloc(nr_pfns * sizeof(*mfns));
+    gfns = malloc(nr_pfns * sizeof(*gfns));
     /* Types of the batch pfns. */
     types = malloc(nr_pfns * sizeof(*types));
     /* Errors from attempting to map the gfns. */
@@ -110,7 +110,7 @@ static int write_batch(struct xc_sr_context *ctx)
     /* iovec[] for writev(). */
     iov = malloc((nr_pfns + 4) * sizeof(*iov));
 
-    if ( !mfns || !types || !errors || !guest_data || !local_pages || !iov )
+    if ( !gfns || !types || !errors || !guest_data || !local_pages || !iov )
     {
         ERROR("Unable to allocate arrays for a batch of %u pages",
               nr_pfns);
@@ -119,11 +119,11 @@ static int write_batch(struct xc_sr_context *ctx)
 
     for ( i = 0; i < nr_pfns; ++i )
     {
-        types[i] = mfns[i] = ctx->save.ops.pfn_to_gfn(ctx,
+        types[i] = gfns[i] = ctx->save.ops.pfn_to_gfn(ctx,
                                                       ctx->save.batch_pfns[i]);
 
         /* Likely a ballooned page. */
-        if ( mfns[i] == INVALID_MFN )
+        if ( gfns[i] == INVALID_MFN )
         {
             set_bit(ctx->save.batch_pfns[i], ctx->save.deferred_pages);
             ++ctx->save.nr_deferred_pages;
@@ -148,13 +148,13 @@ static int write_batch(struct xc_sr_context *ctx)
             continue;
         }
 
-        mfns[nr_pages++] = mfns[i];
+        gfns[nr_pages++] = gfns[i];
     }
 
     if ( nr_pages > 0 )
     {
         guest_mapping = xenforeignmemory_map(xch->fmem,
-            ctx->domid, PROT_READ, nr_pages, mfns, errors);
+            ctx->domid, PROT_READ, nr_pages, gfns, errors);
         if ( !guest_mapping )
         {
             PERROR("Failed to map guest pages");
@@ -174,8 +174,8 @@ static int write_batch(struct xc_sr_context *ctx)
 
             if ( errors[p] )
             {
-                ERROR("Mapping of pfn %#"PRIpfn" (mfn %#"PRIpfn") failed %d",
-                      ctx->save.batch_pfns[i], mfns[p], errors[p]);
+                ERROR("Mapping of pfn %#"PRIpfn" (gfn %#"PRIpfn") failed %d",
+                      ctx->save.batch_pfns[i], gfns[p], errors[p]);
                 goto err;
             }
 
@@ -271,7 +271,7 @@ static int write_batch(struct xc_sr_context *ctx)
     free(guest_data);
     free(errors);
     free(types);
-    free(mfns);
+    free(gfns);
 
     return rc;
 }
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.