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

[Xen-devel] [PATCH 4 of 8] Rename the struct grant_entry to struct grant_entry_v1, so that it



# HG changeset patch
# User Steven Smith <steven.smith@xxxxxxxxxxxxx>
# Date 1222082608 -3600
# Node ID 1df819bcf08654a2f23e88ce22295caf7806d65c
# Parent  999da363259a122e0c15bf28a0885ec40751e906
Rename the struct grant_entry to struct grant_entry_v1, so that it
isn't in the way when we introduce struct grant_entry_v2.

Signed-off-by: Steven Smith <steven.smith@xxxxxxxxxx>

diff -r 999da363259a -r 1df819bcf086 tools/libxc/xc_linux.c
--- a/tools/libxc/xc_linux.c    Wed Sep 10 14:30:24 2008 -0700
+++ b/tools/libxc/xc_linux.c    Mon Sep 22 12:23:28 2008 +0100
@@ -558,14 +558,14 @@
     return ret;
 }
 
-struct grant_entry *xc_gnttab_map_table(int xc_handle, int domid, int *gnt_num)
+struct grant_entry_v1 *xc_gnttab_map_table(int xc_handle, int domid, int 
*gnt_num)
 {
     int rc, i;
     struct gnttab_query_size query;
     struct gnttab_setup_table setup;
     unsigned long *frame_list = NULL;
     xen_pfn_t *pfn_list = NULL;
-    struct grant_entry *gnt = NULL;
+    struct grant_entry_v1 *gnt = NULL;
 
     if (!gnt_num)
         return NULL;
@@ -581,7 +581,7 @@
     }
 
     *gnt_num = query.nr_frames *
-            (PAGE_SIZE / sizeof(struct grant_entry) );
+            (PAGE_SIZE / sizeof(struct grant_entry_v1) );
 
     frame_list = malloc(query.nr_frames * sizeof(unsigned long));
     if (!frame_list || lock_pages(frame_list, query.nr_frames *
diff -r 999da363259a -r 1df819bcf086 tools/libxc/xc_offline_page.c
--- a/tools/libxc/xc_offline_page.c     Wed Sep 10 14:30:24 2008 -0700
+++ b/tools/libxc/xc_offline_page.c     Mon Sep 22 12:23:28 2008 +0100
@@ -133,7 +133,7 @@
   * There should no update to the grant when domain paused
   */
 static int xc_is_page_granted(int xc_handle, xen_pfn_t gpfn,
-                              struct grant_entry *gnttab, int gnt_num)
+                              struct grant_entry_v1 *gnttab, int gnt_num)
 {
     int i = 0;
 
@@ -549,7 +549,7 @@
     struct domain_mem_info minfo;
     struct xc_mmu *mmu = NULL;
     struct pte_backup old_ptes = {NULL, 0, 0};
-    struct grant_entry *gnttab = NULL;
+    struct grant_entry_v1 *gnttab = NULL;
     struct mmuext_op mops;
     int gnt_num, unpined = 0;
     void *old_p, *backup = NULL;
@@ -756,7 +756,7 @@
         free(backup);
 
     if (gnttab)
-        munmap(gnttab, gnt_num / (PAGE_SIZE/sizeof(struct grant_entry)));
+        munmap(gnttab, gnt_num / (PAGE_SIZE/sizeof(struct grant_entry_v1)));
 
     close_mem_info(xc_handle, &minfo);
 
diff -r 999da363259a -r 1df819bcf086 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Wed Sep 10 14:30:24 2008 -0700
+++ b/tools/libxc/xenctrl.h     Mon Sep 22 12:23:28 2008 +0100
@@ -943,7 +943,7 @@
 int xc_gnttab_op(int xc_handle, int cmd,
                  void * op, int op_size, int count);
 
-struct grant_entry *xc_gnttab_map_table(int xc_handle, int domid, int 
*gnt_num);
+struct grant_entry_v1 *xc_gnttab_map_table(int xc_handle, int domid, int 
*gnt_num);
 
 int xc_physdev_map_pirq(int xc_handle,
                         int domid,
diff -r 999da363259a -r 1df819bcf086 xen/common/compat/grant_table.c
--- a/xen/common/compat/grant_table.c   Wed Sep 10 14:30:24 2008 -0700
+++ b/xen/common/compat/grant_table.c   Mon Sep 22 12:23:28 2008 +0100
@@ -5,9 +5,9 @@
 
 #include <compat/grant_table.h>
 
-#define xen_grant_entry grant_entry
-CHECK_grant_entry;
-#undef xen_grant_entry
+#define xen_grant_entry_v1 grant_entry_v1
+CHECK_grant_entry_v1;
+#undef xen_grant_entry_v1
 
 #define xen_gnttab_map_grant_ref gnttab_map_grant_ref
 CHECK_gnttab_map_grant_ref;
diff -r 999da363259a -r 1df819bcf086 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Wed Sep 10 14:30:24 2008 -0700
+++ b/xen/common/grant_table.c  Mon Sep 22 12:23:28 2008 +0100
@@ -105,7 +105,7 @@
 }
 
 
-#define SHGNT_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_t))
+#define SHGNT_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v1_t))
 #define shared_entry(t, e) \
     ((t)->shared[(e)/SHGNT_PER_PAGE][(e)%SHGNT_PER_PAGE])
 #define ACGNT_PER_PAGE (PAGE_SIZE / sizeof(struct active_grant_entry))
@@ -205,7 +205,7 @@
     unsigned int   cache_flags;
     struct active_grant_entry *act;
     struct grant_mapping *mt;
-    grant_entry_t *sha;
+    grant_entry_v1_t *sha;
     union grant_combo scombo, prev_scombo, new_scombo;
 
     /*
@@ -508,7 +508,7 @@
     domid_t          dom;
     struct domain   *ld, *rd;
     struct active_grant_entry *act;
-    grant_entry_t   *sha;
+    grant_entry_v1_t *sha;
     s16              rc = 0;
     u32              old_pin;
 
@@ -622,7 +622,7 @@
 {
     struct domain   *ld, *rd;
     struct active_grant_entry *act;
-    grant_entry_t   *sha;
+    grant_entry_v1_t *sha;
     struct page_info *pg;
 
     rd = op->rd;
@@ -1046,7 +1046,7 @@
     struct domain *rd, struct domain *ld, grant_ref_t ref)
 {
     struct grant_table *rgt;
-    struct grant_entry *sha;
+    struct grant_entry_v1 *sha;
     union grant_combo   scombo, prev_scombo, new_scombo;
     int                 retries = 0;
 
@@ -1115,7 +1115,7 @@
     struct domain *e;
     struct page_info *page;
     int i;
-    grant_entry_t *sha;
+    grant_entry_v1_t *sha;
     struct gnttab_transfer gop;
     unsigned long mfn;
     unsigned int max_bitsize;
@@ -1278,7 +1278,7 @@
 __release_grant_for_copy(
     struct domain *rd, unsigned long gref, int readonly)
 {
-    grant_entry_t *sha;
+    grant_entry_v1_t *sha;
     struct active_grant_entry *act;
     unsigned long r_frame;
 
@@ -1316,7 +1316,7 @@
     struct domain *rd, unsigned long gref, int readonly,
     unsigned long *frame)
 {
-    grant_entry_t *sha;
+    grant_entry_v1_t *sha;
     struct active_grant_entry *act;
     s16 rc = GNTST_okay;
     int retries = 0;
@@ -1654,7 +1654,7 @@
 
 static unsigned int max_nr_active_grant_frames(void)
 {
-    return (((max_nr_grant_frames * (PAGE_SIZE / sizeof(grant_entry_t))) + 
+    return (((max_nr_grant_frames * (PAGE_SIZE / sizeof(grant_entry_v1_t))) + 
                     ((PAGE_SIZE / sizeof(struct active_grant_entry))-1)) 
                    / (PAGE_SIZE / sizeof(struct active_grant_entry)));
 }
@@ -1667,7 +1667,7 @@
     int                 i;
 
     /* If this sizeof assertion fails, fix the function: shared_index */
-    ASSERT(sizeof(grant_entry_t) == 8);
+    ASSERT(sizeof(grant_entry_v1_t) == 8);
 
     if ( (t = xmalloc(struct grant_table)) == NULL )
         goto no_mem_0;
@@ -1703,7 +1703,7 @@
         t->maptrack[0][i].ref = i+1;
 
     /* Shared grant table. */
-    if ( (t->shared = xmalloc_array(struct grant_entry *,
+    if ( (t->shared = xmalloc_array(struct grant_entry_v1 *,
                                     max_nr_grant_frames)) == NULL )
         goto no_mem_3;
     memset(t->shared, 0, max_nr_grant_frames * sizeof(t->shared[0]));
@@ -1749,7 +1749,7 @@
     grant_handle_t        handle;
     struct domain        *rd;
     struct active_grant_entry *act;
-    struct grant_entry   *sha;
+    struct grant_entry_v1*sha;
     struct page_info     *pg;
 
     BUG_ON(!d->is_dying);
diff -r 999da363259a -r 1df819bcf086 xen/include/public/grant_table.h
--- a/xen/include/public/grant_table.h  Wed Sep 10 14:30:24 2008 -0700
+++ b/xen/include/public/grant_table.h  Mon Sep 22 12:23:28 2008 +0100
@@ -90,7 +90,11 @@
  * [XEN]: This field is written by Xen and read by the sharing guest.
  * [GST]: This field is written by the guest and read by Xen.
  */
-struct grant_entry {
+#if __XEN_INTERFACE_VERSION__ < 0x0003020a
+#define grant_entry_v1 grant_entry
+#define grant_entry_v1_t grant_entry_t
+#endif
+struct grant_entry_v1 {
     /* GTF_xxx: various type and flag information.  [XEN,GST] */
     uint16_t flags;
     /* The domain being granted foreign privileges. [GST] */
@@ -101,7 +105,7 @@
      */
     uint32_t frame;
 };
-typedef struct grant_entry grant_entry_t;
+typedef struct grant_entry_v1 grant_entry_v1_t;
 
 /*
  * Type of grant entry.
diff -r 999da363259a -r 1df819bcf086 xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h   Wed Sep 10 14:30:24 2008 -0700
+++ b/xen/include/public/xen-compat.h   Mon Sep 22 12:23:28 2008 +0100
@@ -27,7 +27,7 @@
 #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 #define __XEN_PUBLIC_XEN_COMPAT_H__
 
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030209
+#define __XEN_LATEST_INTERFACE_VERSION__ 0x0003020a
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /* Xen is built with matching headers and implements the latest interface. */
diff -r 999da363259a -r 1df819bcf086 xen/include/xen/grant_table.h
--- a/xen/include/xen/grant_table.h     Wed Sep 10 14:30:24 2008 -0700
+++ b/xen/include/xen/grant_table.h     Mon Sep 22 12:23:28 2008 +0100
@@ -80,7 +80,7 @@
     /* Table size. Number of frames shared with guest */
     unsigned int          nr_grant_frames;
     /* Shared grant table (see include/public/grant_table.h). */
-    struct grant_entry  **shared;
+    struct grant_entry_v1 **shared;
     /* Active grant table. */
     struct active_grant_entry **active;
     /* Mapping tracking table. */
@@ -117,7 +117,7 @@
 /* Number of grant table entries. Caller must hold d's grant table lock. */
 static inline unsigned int nr_grant_entries(struct grant_table *gt)
 {
-    return (nr_grant_frames(gt) << PAGE_SHIFT) / sizeof(grant_entry_t);
+    return (nr_grant_frames(gt) << PAGE_SHIFT) / sizeof(grant_entry_v1_t);
 }
 
 static inline unsigned int
@@ -126,7 +126,7 @@
     /* How many frames are needed for the active grant table,
      * given the size of the shared grant table? */
     unsigned act_per_page = PAGE_SIZE / sizeof(struct active_grant_entry);
-    unsigned sha_per_page = PAGE_SIZE / sizeof(grant_entry_t);
+    unsigned sha_per_page = PAGE_SIZE / sizeof(grant_entry_v1_t);
     unsigned num_sha_entries = num * sha_per_page;
     unsigned num_act_frames =
         (num_sha_entries + (act_per_page-1)) / act_per_page;
diff -r 999da363259a -r 1df819bcf086 xen/include/xlat.lst
--- a/xen/include/xlat.lst      Wed Sep 10 14:30:24 2008 -0700
+++ b/xen/include/xlat.lst      Mon Sep 22 12:23:28 2008 +0100
@@ -44,7 +44,7 @@
 !      gnttab_transfer                 grant_table.h
 ?      gnttab_unmap_grant_ref          grant_table.h
 ?      gnttab_unmap_and_replace        grant_table.h
-?      grant_entry                     grant_table.h
+?      grant_entry_v1                  grant_table.h
 ?      kexec_exec                      kexec.h
 !      kexec_image                     kexec.h
 !      kexec_range                     kexec.h
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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