[XEN] Fix guest-access macros.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 12 Jan 2007 14:22:28 +0000 (14:22 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 12 Jan 2007 14:22:28 +0000 (14:22 +0000)
From: Christoph Egger <Christoph.Egger@amd.com>

xen/include/asm-x86/guest_access.h

index ce5c2907871bf446432b8eb3ae5092bb59f07424..0fc5bc98dc5b0ed85152e93516f4fb2b494f37dc 100644 (file)
@@ -32,7 +32,7 @@
  * specifying an offset into the guest array.
  */
 #define copy_to_guest_offset(hnd, off, ptr, nr) ({      \
-    const typeof(ptr) _x = (hnd).p;                     \
+    typeof(ptr) _x = (hnd).p;                           \
     const typeof(ptr) _y = (ptr);                       \
     is_hvm_vcpu(current) ?                              \
     copy_to_user_hvm(_x+(off), _y, sizeof(*_x)*(nr)) :  \
@@ -45,7 +45,7 @@
  */
 #define copy_from_guest_offset(ptr, hnd, off, nr) ({    \
     const typeof(ptr) _x = (hnd).p;                     \
-    const typeof(ptr) _y = (ptr);                       \
+    typeof(ptr) _y = (ptr);                             \
     is_hvm_vcpu(current) ?                              \
     copy_from_user_hvm(_y, _x+(off), sizeof(*_x)*(nr)) :\
     copy_from_user(_y, _x+(off), sizeof(*_x)*(nr));     \
@@ -53,7 +53,7 @@
 
 /* Copy sub-field of a structure to guest context via a guest handle. */
 #define copy_field_to_guest(hnd, ptr, field) ({         \
-    const typeof(&(ptr)->field) _x = &(hnd).p->field;   \
+    typeof(&(ptr)->field) _x = &(hnd).p->field;         \
     const typeof(&(ptr)->field) _y = &(ptr)->field;     \
     is_hvm_vcpu(current) ?                              \
     copy_to_user_hvm(_x, _y, sizeof(*_x)) :             \
@@ -63,7 +63,7 @@
 /* Copy sub-field of a structure from guest context via a guest handle. */
 #define copy_field_from_guest(ptr, hnd, field) ({       \
     const typeof(&(ptr)->field) _x = &(hnd).p->field;   \
-    const typeof(&(ptr)->field) _y = &(ptr)->field;     \
+    typeof(&(ptr)->field) _y = &(ptr)->field;           \
     is_hvm_vcpu(current) ?                              \
     copy_from_user_hvm(_y, _x, sizeof(*_x)) :           \
     copy_from_user(_y, _x, sizeof(*_x));                \
@@ -78,7 +78,7 @@
      array_access_ok((hnd).p, (nr), sizeof(*(hnd).p)))
 
 #define __copy_to_guest_offset(hnd, off, ptr, nr) ({    \
-    const typeof(ptr) _x = (hnd).p;                     \
+    typeof(ptr) _x = (hnd).p;                           \
     const typeof(ptr) _y = (ptr);                       \
     is_hvm_vcpu(current) ?                              \
     copy_to_user_hvm(_x+(off), _y, sizeof(*_x)*(nr)) :  \
 
 #define __copy_from_guest_offset(ptr, hnd, off, nr) ({  \
     const typeof(ptr) _x = (hnd).p;                     \
-    const typeof(ptr) _y = (ptr);                       \
+    typeof(ptr) _y = (ptr);                             \
     is_hvm_vcpu(current) ?                              \
     copy_from_user_hvm(_y, _x+(off),sizeof(*_x)*(nr)) : \
     __copy_from_user(_y, _x+(off), sizeof(*_x)*(nr));   \
 })
 
 #define __copy_field_to_guest(hnd, ptr, field) ({       \
-    const typeof(&(ptr)->field) _x = &(hnd).p->field;   \
+    typeof(&(ptr)->field) _x = &(hnd).p->field;         \
     const typeof(&(ptr)->field) _y = &(ptr)->field;     \
     is_hvm_vcpu(current) ?                              \
     copy_to_user_hvm(_x, _y, sizeof(*_x)) :             \
 
 #define __copy_field_from_guest(ptr, hnd, field) ({     \
     const typeof(&(ptr)->field) _x = &(hnd).p->field;   \
-    const typeof(&(ptr)->field) _y = &(ptr)->field;     \
+    typeof(&(ptr)->field) _y = &(ptr)->field;           \
     is_hvm_vcpu(current) ?                              \
-    copy_from_user_hvm(_x, _y, sizeof(*_x)) :           \
+    copy_from_user_hvm(_y, _x, sizeof(*_x)) :           \
     __copy_from_user(_y, _x, sizeof(*_x));              \
 })