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

[Xen-changelog] A few changes to the new 'guest handle' interface:



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 4dd325c1d87d50cfa27f5f43b4c93706db98adac
# Parent  e639d53330ba6d8376b296d091f3c69152d77002
A few changes to the new 'guest handle' interface:

 DEFINE_GUEST_HANDLE -> define_guest_handle

 GUEST_HANDLE        -> guest_handle

 New __define_guest_handle allows handle name different from
 encapsulated type's name (useful for awkward typenames).

 Got rid of xen_ulong, now use guest_handle(ulong).

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r e639d53330ba -r 4dd325c1d87d xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Thu Mar  2 10:41:48 2006
+++ b/xen/arch/x86/mm.c Thu Mar  2 13:43:24 2006
@@ -2788,7 +2788,7 @@
 }
 
 
-long arch_memory_op(int op, GUEST_HANDLE(void) arg)
+long arch_memory_op(int op, guest_handle(void) arg)
 {
     struct xen_reserved_phys_area xrpa;
     unsigned long pfn;
diff -r e639d53330ba -r 4dd325c1d87d xen/arch/x86/x86_32/mm.c
--- a/xen/arch/x86/x86_32/mm.c  Thu Mar  2 10:41:48 2006
+++ b/xen/arch/x86/x86_32/mm.c  Thu Mar  2 13:43:24 2006
@@ -192,7 +192,7 @@
     }
 }
 
-long subarch_memory_op(int op, GUEST_HANDLE(void) arg)
+long subarch_memory_op(int op, guest_handle(void) arg)
 {
     struct xen_machphys_mfn_list xmml;
     unsigned long mfn;
diff -r e639d53330ba -r 4dd325c1d87d xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  Thu Mar  2 10:41:48 2006
+++ b/xen/arch/x86/x86_64/mm.c  Thu Mar  2 13:43:24 2006
@@ -183,7 +183,7 @@
     }
 }
 
-long subarch_memory_op(int op, GUEST_HANDLE(void) arg)
+long subarch_memory_op(int op, guest_handle(void) arg)
 {
     struct xen_machphys_mfn_list xmml;
     l3_pgentry_t l3e;
diff -r e639d53330ba -r 4dd325c1d87d xen/common/memory.c
--- a/xen/common/memory.c       Thu Mar  2 10:41:48 2006
+++ b/xen/common/memory.c       Thu Mar  2 13:43:24 2006
@@ -31,7 +31,7 @@
 static long
 increase_reservation(
     struct domain *d, 
-    GUEST_HANDLE(xen_ulong) extent_list,
+    guest_handle(ulong) extent_list,
     unsigned int   nr_extents,
     unsigned int   extent_order,
     unsigned int   flags,
@@ -80,7 +80,7 @@
 static long
 populate_physmap(
     struct domain *d, 
-    GUEST_HANDLE(xen_ulong) extent_list,
+    guest_handle(ulong) extent_list,
     unsigned int  nr_extents,
     unsigned int  extent_order,
     unsigned int  flags,
@@ -141,7 +141,7 @@
 static long
 decrease_reservation(
     struct domain *d,
-    GUEST_HANDLE(xen_ulong) extent_list,
+    guest_handle(ulong) extent_list,
     unsigned int   nr_extents,
     unsigned int   extent_order,
     unsigned int   flags,
@@ -198,7 +198,7 @@
 
 static long
 translate_gpfn_list(
-    GUEST_HANDLE(xen_translate_gpfn_list_t) uop, unsigned long *progress)
+    guest_handle(xen_translate_gpfn_list_t) uop, unsigned long *progress)
 {
     struct xen_translate_gpfn_list op;
     unsigned long i, gpfn, mfn;
@@ -257,7 +257,7 @@
     return 0;
 }
 
-long do_memory_op(unsigned long cmd, GUEST_HANDLE(void) arg)
+long do_memory_op(unsigned long cmd, guest_handle(void) arg)
 {
     struct domain *d;
     int rc, op, flags = 0, preempted = 0;
diff -r e639d53330ba -r 4dd325c1d87d xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Thu Mar  2 10:41:48 2006
+++ b/xen/include/asm-x86/mm.h  Thu Mar  2 13:43:24 2006
@@ -380,7 +380,7 @@
 int __sync_lazy_execstate(void);
 
 /* Arch-specific portion of memory_op hypercall. */
-long arch_memory_op(int op, GUEST_HANDLE(void) arg);
-long subarch_memory_op(int op, GUEST_HANDLE(void) arg);
+long arch_memory_op(int op, guest_handle(void) arg);
+long subarch_memory_op(int op, guest_handle(void) arg);
 
 #endif /* __ASM_X86_MM_H__ */
diff -r e639d53330ba -r 4dd325c1d87d xen/include/public/memory.h
--- a/xen/include/public/memory.h       Thu Mar  2 10:41:48 2006
+++ b/xen/include/public/memory.h       Thu Mar  2 13:43:24 2006
@@ -29,7 +29,7 @@
      *   OUT: GMFN bases of extents that were allocated
      *   (NB. This command also updates the mach_to_phys translation table)
      */
-    GUEST_HANDLE(xen_ulong) extent_start;
+    guest_handle(ulong) extent_start;
 
     /* Number of extents, and size/alignment of each (2^extent_order pages). */
     unsigned long  nr_extents;
@@ -50,7 +50,7 @@
     domid_t        domid;
 
 } xen_memory_reservation_t;
-DEFINE_GUEST_HANDLE(xen_memory_reservation_t);
+define_guest_handle(xen_memory_reservation_t);
 
 /*
  * Returns the maximum machine frame number of mapped RAM in this system.
@@ -86,7 +86,7 @@
      * any large discontiguities in the machine address space, 2MB gaps in
      * the machphys table will be represented by an MFN base of zero.
      */
-    GUEST_HANDLE(xen_ulong) extent_start;
+    guest_handle(ulong) extent_start;
 
     /*
      * Number of extents written to the above array. This will be smaller
@@ -94,7 +94,7 @@
      */
     unsigned int nr_extents;
 } xen_machphys_mfn_list_t;
-DEFINE_GUEST_HANDLE(xen_machphys_mfn_list_t);
+define_guest_handle(xen_machphys_mfn_list_t);
 
 /*
  * Returns the base and size of the specified reserved 'RAM hole' in the
@@ -115,7 +115,7 @@
     /* Base and size of the specified reserved area. */
     unsigned long first_gpfn, nr_gpfns;
 } xen_reserved_phys_area_t;
-DEFINE_GUEST_HANDLE(xen_reserved_phys_area_t);
+define_guest_handle(xen_reserved_phys_area_t);
 
 /*
  * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
@@ -130,15 +130,15 @@
     unsigned long nr_gpfns;
 
     /* List of GPFNs to translate. */
-    GUEST_HANDLE(xen_ulong) gpfn_list;
+    guest_handle(ulong) gpfn_list;
 
     /*
      * Output list to contain MFN translations. May be the same as the input
      * list (in which case each input GPFN is overwritten with the output MFN).
      */
-    GUEST_HANDLE(xen_ulong) mfn_list;
+    guest_handle(ulong) mfn_list;
 } xen_translate_gpfn_list_t;
-DEFINE_GUEST_HANDLE(xen_translate_gpfn_list_t);
+define_guest_handle(xen_translate_gpfn_list_t);
 
 #endif /* __XEN_PUBLIC_MEMORY_H__ */
 
diff -r e639d53330ba -r 4dd325c1d87d xen/include/public/xen.h
--- a/xen/include/public/xen.h  Thu Mar  2 10:41:48 2006
+++ b/xen/include/public/xen.h  Thu Mar  2 13:43:24 2006
@@ -10,19 +10,25 @@
 #define __XEN_PUBLIC_XEN_H__
 
 #ifdef __XEN__
-#define DEFINE_GUEST_HANDLE(type) struct __guest_handle_ ## type { type *p; }
-#define GUEST_HANDLE(type)        struct __guest_handle_ ## type
+#define __define_guest_handle(name, type) \
+    typedef struct { type *p; } __guest_handle_ ## name
 #else
-#define DEFINE_GUEST_HANDLE(type)
-#define GUEST_HANDLE(type)        type *
+#define __define_guest_handle(name, type) \
+    typedef type * __guest_handle_ ## name
 #endif
 
+#define define_guest_handle(name) __define_guest_handle(name, name)
+#define guest_handle(name)        __guest_handle_ ## name
+
 #ifndef __ASSEMBLY__
-/* Guest handle for unsigned long pointer. Define a name with no whitespace. */
-typedef unsigned long xen_ulong;
-DEFINE_GUEST_HANDLE(xen_ulong);
-/* Guest handle for arbitrary-type pointer (void *). */
-DEFINE_GUEST_HANDLE(void);
+/* Guest handles for primitive C types. */
+__define_guest_handle(uchar, unsigned char);
+__define_guest_handle(uint,  unsigned int);
+__define_guest_handle(ulong, unsigned long);
+define_guest_handle(char);
+define_guest_handle(int);
+define_guest_handle(long);
+define_guest_handle(void);
 #endif
 
 #if defined(__i386__)
diff -r e639d53330ba -r 4dd325c1d87d xen/include/xen/guest_access.h
--- a/xen/include/xen/guest_access.h    Thu Mar  2 10:41:48 2006
+++ b/xen/include/xen/guest_access.h    Thu Mar  2 13:43:24 2006
@@ -18,7 +18,7 @@
 /* Cast a guest handle to the specified type of handle. */
 #define guest_handle_cast(hnd, type) ({         \
     type *_x = (hnd).p;                         \
-    (GUEST_HANDLE(type)) { _x };                \
+    (guest_handle(type)) { _x };                \
 })
 
 /*
diff -r e639d53330ba -r 4dd325c1d87d xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Thu Mar  2 10:41:48 2006
+++ b/xen/include/xen/sched.h   Thu Mar  2 13:43:24 2006
@@ -311,7 +311,7 @@
  *  'i' [unsigned] {char, int}
  *  'l' [unsigned] long
  *  'p' pointer (foo *)
- *  'h' guest handle (GUEST_HANDLE(foo))
+ *  'h' guest handle (guest_handle(foo))
  */
 unsigned long hypercall_create_continuation(
     unsigned int op, const char *format, ...);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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