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

[Xen-devel] [PATCH 1/2] libxc: replace INVALID_P2M_ENTRY by INVALID_PFN



INVALID_P2M_ENTRY is defined as (xen_pfn_t)-1 and is often used
according to it's type for an invalid pfn. Change the name of the
macro to INVALID_PFN.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/libxc/include/xc_dom.h  |  2 +-
 tools/libxc/xc_compression.c  | 10 +++++-----
 tools/libxc/xc_core.c         |  4 ++--
 tools/libxc/xc_dom_arm.c      |  2 +-
 tools/libxc/xc_dom_core.c     |  4 ++--
 tools/libxc/xc_dom_x86.c      |  2 +-
 tools/libxc/xc_offline_page.c |  2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h
index 43a65ee..3c94b57 100644
--- a/tools/libxc/include/xc_dom.h
+++ b/tools/libxc/include/xc_dom.h
@@ -19,7 +19,7 @@
 #include <xen/libelf/libelf.h>
 #include <xenguest.h>
 
-#define INVALID_P2M_ENTRY   ((xen_pfn_t)-1)
+#define INVALID_PFN ((xen_pfn_t)-1)
 
 /* --- typedefs and structs ---------------------------------------- */
 
diff --git a/tools/libxc/xc_compression.c b/tools/libxc/xc_compression.c
index b1b16e8..89c1114 100644
--- a/tools/libxc/xc_compression.c
+++ b/tools/libxc/xc_compression.c
@@ -217,7 +217,7 @@ char *get_cache_page(comp_ctx *ctx, xen_pfn_t pfn,
 
         /* If the list is full, evict a page from the tail end. */
         item = ctx->page_list_tail;
-        if (item->pfn != INVALID_P2M_ENTRY)
+        if (item->pfn != INVALID_PFN)
             ctx->pfn2cache[item->pfn] = NULL;
 
         item->pfn = pfn;
@@ -278,7 +278,7 @@ void invalidate_cache_page(comp_ctx *ctx, xen_pfn_t pfn)
             ctx->page_list_tail = item;
         }
         ctx->pfn2cache[pfn] = NULL;
-        (ctx->page_list_tail)->pfn = INVALID_P2M_ENTRY;
+        (ctx->page_list_tail)->pfn = INVALID_PFN;
     }
 }
 
@@ -295,7 +295,7 @@ int xc_compression_add_page(xc_interface *xch, comp_ctx 
*ctx,
     /* pagetable page */
     if (israw)
         invalidate_cache_page(ctx, pfn);
-    ctx->sendbuf_pfns[ctx->pfns_len] = israw ? INVALID_P2M_ENTRY : pfn;
+    ctx->sendbuf_pfns[ctx->pfns_len] = israw ? INVALID_PFN : pfn;
     memcpy(ctx->inputbuf + ctx->pfns_len * XC_PAGE_SIZE, page, XC_PAGE_SIZE);
     ctx->pfns_len++;
 
@@ -329,7 +329,7 @@ int xc_compression_compress_pages(xc_interface *xch, 
comp_ctx *ctx,
         cache_copy = NULL;
         current_page = ctx->inputbuf + ctx->pfns_index * XC_PAGE_SIZE;
 
-        if (ctx->sendbuf_pfns[ctx->pfns_index] == INVALID_P2M_ENTRY)
+        if (ctx->sendbuf_pfns[ctx->pfns_index] == INVALID_PFN)
             israw = 1;
         else
             cache_copy = get_cache_page(ctx,
@@ -518,7 +518,7 @@ comp_ctx *xc_compression_create_context(xc_interface *xch,
 
     for (i = 0; i < num_cache_pages; i++)
     {
-        ctx->cache[i].pfn = INVALID_P2M_ENTRY;
+        ctx->cache[i].pfn = INVALID_PFN;
         ctx->cache[i].page = ctx->cache_base + i * XC_PAGE_SIZE;
         ctx->cache[i].prev = (i == 0) ? NULL : &(ctx->cache[i - 1]);
         ctx->cache[i].next = ((i+1) == num_cache_pages)? NULL :
diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c
index 011336c..d792566 100644
--- a/tools/libxc/xc_core.c
+++ b/tools/libxc/xc_core.c
@@ -808,13 +808,13 @@ xc_domain_dumpcore_via_callback(xc_interface *xch,
                         gmfn = p2m[i];
                     else
                         gmfn = ((uint64_t *)p2m)[i];
-                    if ( gmfn == INVALID_P2M_ENTRY )
+                    if ( gmfn == INVALID_PFN )
                         continue;
                 }
                 else
                 {
                     gmfn = ((uint32_t *)p2m)[i];
-                    if ( gmfn == (uint32_t)INVALID_P2M_ENTRY )
+                    if ( gmfn == (uint32_t)INVALID_PFN )
                        continue;
                 }
 
diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index d9a6371..64a8b67 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xc_dom_arm.c
@@ -439,7 +439,7 @@ static int meminit(struct xc_dom_image *dom)
     if ( dom->p2m_host == NULL )
         return -EINVAL;
     for ( pfn = 0; pfn < p2m_size; pfn++ )
-        dom->p2m_host[pfn] = INVALID_P2M_ENTRY;
+        dom->p2m_host[pfn] = INVALID_PFN;
 
     /* setup initial p2m and allocate guest memory */
     for ( i = 0; i < GUEST_RAM_BANKS && dom->rambank_size[i]; i++ )
diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
index 8967970..d0c6596 100644
--- a/tools/libxc/xc_dom_core.c
+++ b/tools/libxc/xc_dom_core.c
@@ -971,7 +971,7 @@ int xc_dom_update_guest_p2m(struct xc_dom_image *dom)
                   __FUNCTION__, dom->p2m_size);
         p2m_32 = dom->p2m_guest;
         for ( i = 0; i < dom->p2m_size; i++ )
-            if ( dom->p2m_host[i] != INVALID_P2M_ENTRY )
+            if ( dom->p2m_host[i] != INVALID_PFN )
                 p2m_32[i] = dom->p2m_host[i];
             else
                 p2m_32[i] = (uint32_t) - 1;
@@ -981,7 +981,7 @@ int xc_dom_update_guest_p2m(struct xc_dom_image *dom)
                   __FUNCTION__, dom->p2m_size);
         p2m_64 = dom->p2m_guest;
         for ( i = 0; i < dom->p2m_size; i++ )
-            if ( dom->p2m_host[i] != INVALID_P2M_ENTRY )
+            if ( dom->p2m_host[i] != INVALID_PFN )
                 p2m_64[i] = dom->p2m_host[i];
             else
                 p2m_64[i] = (uint64_t) - 1;
diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index 5ff33ca..7c77e69 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -1172,7 +1172,7 @@ static int meminit_pv(struct xc_dom_image *dom)
     if ( dom->p2m_host == NULL )
         return -EINVAL;
     for ( pfn = 0; pfn < dom->p2m_size; pfn++ )
-        dom->p2m_host[pfn] = INVALID_P2M_ENTRY;
+        dom->p2m_host[pfn] = INVALID_PFN;
 
     /* allocate guest memory */
     for ( i = 0; i < nr_vmemranges; i++ )
diff --git a/tools/libxc/xc_offline_page.c b/tools/libxc/xc_offline_page.c
index 7bb522f..bc91d51 100644
--- a/tools/libxc/xc_offline_page.c
+++ b/tools/libxc/xc_offline_page.c
@@ -282,7 +282,7 @@ static int change_pte(xc_interface *xch, int domid,
         uint64_t pte, new_pte;
         int j;
 
-        if ( (table_mfn == INVALID_P2M_ENTRY) ||
+        if ( (table_mfn == INVALID_PFN) ||
              ((minfo->pfn_type[i] & XEN_DOMCTL_PFINFO_LTAB_MASK) ==
               XEN_DOMCTL_PFINFO_XTAB) )
             continue;
-- 
2.6.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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