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

[Xen-devel] Re: [rfc] [patch] more 'long' in the hypervisor interface



On Wed, 2006-06-28 at 22:02 +0100, Keir Fraser wrote:
> On 28 Jun 2006, at 22:03, Hollis Blanchard wrote:
> 
> > Hi Keir, we've come across some more users of 'long' in the hypervisor
> > interface: xen/include/public/memory.h. Unlike the dom0_ops, we can't
> > just change these to be 64 bits because 32-bit kernels use these
> > structures for the balloon driver.
> >
> > I would like to create a new type, say "legacy_ulong_t", to cover these
> > cases and future instances we'll undoubtedly come across. What do you
> > think?
> >
> > Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
> 
> Call them xen_ulong_t and they're fine. They're hardly legacy since 
> there's no suitable non-legacy replacement right now. Don't forget the 
> typedef in the other arch-*.h headers as well.

Excellent!

The reason I worry about calling it "xen_ulong_t" is that name doesn't
discourage people from using it. In fact, it only makes sense to use
this type in the interface, and even then only in places in the
interface that were 'long' already. In other words, nobody should ever
use this type any more, which is why I called it "legacy" originally. I
could imagine people trying to use it in the future because it seems
like the right thing to do. I'll leave the decision to you.



Define an architecture-specific 'long' type for ABI compatibility.
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>

diff -r 10db0f8c710d xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Wed Jun 28 15:37:45 2006 -0400
+++ b/xen/include/public/arch-ia64.h    Wed Jun 28 16:12:48 2006 -0500
@@ -39,6 +39,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define MAX_VIRT_CPUS 64
 
 #ifndef __ASSEMBLY__
+
+typedef unsigned long xen_ulong_t;
 
 #define MAX_NR_SECTION  32  /* at most 32 memory holes */
 struct mm_section {
diff -r 10db0f8c710d xen/include/public/arch-x86_32.h
--- a/xen/include/public/arch-x86_32.h  Wed Jun 28 15:37:45 2006 -0400
+++ b/xen/include/public/arch-x86_32.h  Wed Jun 28 16:12:48 2006 -0500
@@ -97,6 +97,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define MAX_VIRT_CPUS 32
 
 #ifndef __ASSEMBLY__
+
+typedef unsigned long xen_ulong_t;
 
 /*
  * Send an array of these to HYPERVISOR_set_trap_table()
diff -r 10db0f8c710d xen/include/public/arch-x86_64.h
--- a/xen/include/public/arch-x86_64.h  Wed Jun 28 15:37:45 2006 -0400
+++ b/xen/include/public/arch-x86_64.h  Wed Jun 28 16:12:48 2006 -0500
@@ -104,6 +104,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define MAX_VIRT_CPUS 32
 
 #ifndef __ASSEMBLY__
+
+typedef unsigned long xen_ulong_t;
 
 /*
  * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base)
diff -r 10db0f8c710d xen/include/public/memory.h
--- a/xen/include/public/memory.h       Wed Jun 28 15:37:45 2006 -0400
+++ b/xen/include/public/memory.h       Wed Jun 28 16:12:48 2006 -0500
@@ -32,7 +32,7 @@ struct xen_memory_reservation {
     XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
 
     /* Number of extents, and size/alignment of each (2^extent_order pages). */
-    unsigned long  nr_extents;
+    xen_ulong_t  nr_extents;
     unsigned int   extent_order;
 
     /*
@@ -90,7 +90,7 @@ struct xen_memory_exchange {
      *     command will be non-zero.
      *  5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
      */
-    unsigned long nr_exchanged;
+    xen_ulong_t nr_exchanged;
 };
 typedef struct xen_memory_exchange xen_memory_exchange_t;
 DEFINE_XEN_GUEST_HANDLE(xen_memory_exchange_t);
@@ -148,8 +148,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn
  */
 #define XENMEM_machphys_mapping     12
 struct xen_machphys_mapping {
-    unsigned long v_start, v_end; /* Start and end virtual addresses.   */
-    unsigned long max_mfn;        /* Maximum MFN that can be looked up. */
+    xen_ulong_t v_start, v_end; /* Start and end virtual addresses.   */
+    xen_ulong_t max_mfn;        /* Maximum MFN that can be looked up. */
 };
 typedef struct xen_machphys_mapping xen_machphys_mapping_t;
 DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t);
@@ -170,7 +170,7 @@ struct xen_add_to_physmap {
     unsigned int space;
 
     /* Index into source mapping space. */
-    unsigned long idx;
+    xen_ulong_t idx;
 
     /* GPFN where the source mapping page should appear. */
     xen_pfn_t     gpfn;
@@ -188,7 +188,7 @@ struct xen_translate_gpfn_list {
     domid_t domid;
 
     /* Length of list. */
-    unsigned long nr_gpfns;
+    xen_ulong_t nr_gpfns;
 
     /* List of GPFNs to translate. */
     XEN_GUEST_HANDLE(xen_pfn_t) gpfn_list;


-- 
Hollis Blanchard
IBM Linux Technology Center


_______________________________________________
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®.