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

[Xen-devel] [PATCH RFC v2 21/23] xen/mem_paging: move paging op arguments into a union



From: Joshua Otto <jtotto@xxxxxxxxxxxx>

In preparation for the addition of a mem paging op with different
arguments than the existing ops, move the op-specific arguments into a
union.

No functional change.

Signed-off-by: Joshua Otto <jtotto@xxxxxxxxxxxx>
---
 tools/libxc/xc_mem_paging.c  |  8 ++++----
 xen/arch/x86/mm/mem_paging.c |  6 +++---
 xen/include/public/memory.h  | 12 ++++++++----
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/tools/libxc/xc_mem_paging.c b/tools/libxc/xc_mem_paging.c
index 28611f4..f314b08 100644
--- a/tools/libxc/xc_mem_paging.c
+++ b/tools/libxc/xc_mem_paging.c
@@ -29,10 +29,10 @@ static int xc_mem_paging_memop(xc_interface *xch, domid_t 
domain_id,
 
     memset(&mpo, 0, sizeof(mpo));
 
-    mpo.op      = op;
-    mpo.domain  = domain_id;
-    mpo.gfn     = gfn;
-    mpo.buffer  = (unsigned long) buffer;
+    mpo.op               = op;
+    mpo.domain           = domain_id;
+    mpo.u.single.gfn     = gfn;
+    mpo.u.single.buffer  = (unsigned long) buffer;
 
     return do_memory_op(xch, XENMEM_paging_op, &mpo, sizeof(mpo));
 }
diff --git a/xen/arch/x86/mm/mem_paging.c b/xen/arch/x86/mm/mem_paging.c
index a049e0d..e23e26c 100644
--- a/xen/arch/x86/mm/mem_paging.c
+++ b/xen/arch/x86/mm/mem_paging.c
@@ -49,15 +49,15 @@ int 
mem_paging_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_paging_op_t) arg)
     switch( mpo.op )
     {
     case XENMEM_paging_op_nominate:
-        rc = p2m_mem_paging_nominate(d, mpo.gfn);
+        rc = p2m_mem_paging_nominate(d, mpo.u.single.gfn);
         break;
 
     case XENMEM_paging_op_evict:
-        rc = p2m_mem_paging_evict(d, mpo.gfn);
+        rc = p2m_mem_paging_evict(d, mpo.u.single.gfn);
         break;
 
     case XENMEM_paging_op_prep:
-        rc = p2m_mem_paging_prep(d, mpo.gfn, mpo.buffer);
+        rc = p2m_mem_paging_prep(d, mpo.u.single.gfn, mpo.u.single.buffer);
         if ( !rc )
             copyback = 1;
         break;
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index 6eee0c8..49ef162 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -394,10 +394,14 @@ struct xen_mem_paging_op {
     uint8_t     op;         /* XENMEM_paging_op_* */
     domid_t     domain;
 
-    /* PAGING_PREP IN: buffer to immediately fill page in */
-    uint64_aligned_t    buffer;
-    /* Other OPs */
-    uint64_aligned_t    gfn;           /* IN:  gfn of page being operated on */
+    union {
+        struct {
+            /* PAGING_PREP IN: buffer to immediately fill page in */
+            uint64_aligned_t    buffer;
+            /* Other OPs */
+            uint64_aligned_t    gfn;   /* IN:  gfn of page being operated on */
+        } single;
+    } u;
 };
 typedef struct xen_mem_paging_op xen_mem_paging_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_mem_paging_op_t);
-- 
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®.