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

[Xen-changelog] [xen-unstable] xen: Make bool_t an arch-dep definition, and define macros



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1175850645 -3600
# Node ID 5a7eebbae5dc2cf9cc0e046eb8b06b04689b8046
# Parent  a00c629f67be6e42468dc08b6e35904641462e8a
xen: Make bool_t an arch-dep definition, and define macros
specifically for atomic test-and-modify operations on bool_t.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/common/domain.c             |    8 ++++----
 xen/include/asm-ia64/xentypes.h |    5 +++++
 xen/include/asm-powerpc/types.h |    4 ++++
 xen/include/asm-x86/types.h     |    4 ++++
 xen/include/xen/types.h         |    2 --
 5 files changed, 17 insertions(+), 6 deletions(-)

diff -r a00c629f67be -r 5a7eebbae5dc xen/common/domain.c
--- a/xen/common/domain.c       Thu Apr 05 18:47:04 2007 +0100
+++ b/xen/common/domain.c       Fri Apr 06 10:10:45 2007 +0100
@@ -307,7 +307,7 @@ void domain_kill(struct domain *d)
     domain_pause(d);
 
     /* Already dying? Then bail. */
-    if ( xchg(&d->is_dying, 1) )
+    if ( test_and_set_bool(d->is_dying) )
     {
         domain_unpause(d);
         return;
@@ -453,7 +453,7 @@ void domain_pause_for_debugger(void)
     struct vcpu *v;
 
     atomic_inc(&d->pause_count);
-    if ( xchg(&d->is_paused_by_controller, 1) )
+    if ( test_and_set_bool(d->is_paused_by_controller) )
         domain_unpause(d); /* race-free atomic_dec(&d->pause_count) */
 
     for_each_vcpu ( d, v )
@@ -553,13 +553,13 @@ void domain_pause_by_systemcontroller(st
 void domain_pause_by_systemcontroller(struct domain *d)
 {
     domain_pause(d);
-    if ( xchg(&d->is_paused_by_controller, 1) )
+    if ( test_and_set_bool(d->is_paused_by_controller) )
         domain_unpause(d);
 }
 
 void domain_unpause_by_systemcontroller(struct domain *d)
 {
-    if ( xchg(&d->is_paused_by_controller, 0) )
+    if ( test_and_clear_bool(d->is_paused_by_controller) )
         domain_unpause(d);
 }
 
diff -r a00c629f67be -r 5a7eebbae5dc xen/include/asm-ia64/xentypes.h
--- a/xen/include/asm-ia64/xentypes.h   Thu Apr 05 18:47:04 2007 +0100
+++ b/xen/include/asm-ia64/xentypes.h   Fri Apr 06 10:10:45 2007 +0100
@@ -5,6 +5,11 @@ typedef unsigned long ssize_t;
 typedef unsigned long ssize_t;
 typedef unsigned long size_t;
 typedef long long loff_t;
+
+typedef char bool_t;
+#define test_and_set_bool(b)   xchg(&(b), 1)
+#define test_and_clear_bool(b) xchg(&(b), 0)
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _ASM_IA64_XENTYPES_H */
diff -r a00c629f67be -r 5a7eebbae5dc xen/include/asm-powerpc/types.h
--- a/xen/include/asm-powerpc/types.h   Thu Apr 05 18:47:04 2007 +0100
+++ b/xen/include/asm-powerpc/types.h   Fri Apr 06 10:10:45 2007 +0100
@@ -70,5 +70,9 @@ typedef u64 dma64_addr_t;
 
 typedef unsigned short xmem_bufctl_t;
 
+typedef int bool_t;
+#define test_and_set_bool(b)   xchg(&(b), 1)
+#define test_and_clear_bool(b) xchg(&(b), 0)
+
 #endif  /* __ASSEMBLY__ */
 #endif
diff -r a00c629f67be -r 5a7eebbae5dc xen/include/asm-x86/types.h
--- a/xen/include/asm-x86/types.h       Thu Apr 05 18:47:04 2007 +0100
+++ b/xen/include/asm-x86/types.h       Fri Apr 06 10:10:45 2007 +0100
@@ -52,6 +52,10 @@ typedef unsigned long paddr_t;
 
 typedef unsigned long size_t;
 
+typedef char bool_t;
+#define test_and_set_bool(b)   xchg(&(b), 1)
+#define test_and_clear_bool(b) xchg(&(b), 0)
+
 #endif /* __ASSEMBLY__ */
 
 #if defined(__i386__)
diff -r a00c629f67be -r 5a7eebbae5dc xen/include/xen/types.h
--- a/xen/include/xen/types.h   Thu Apr 05 18:47:04 2007 +0100
+++ b/xen/include/xen/types.h   Fri Apr 06 10:10:45 2007 +0100
@@ -19,8 +19,6 @@
 #define LONG_MAX        ((long)(~0UL>>1))
 #define LONG_MIN        (-LONG_MAX - 1)
 #define ULONG_MAX       (~0UL)
-
-typedef char bool_t;
 
 /* bsd */
 typedef unsigned char           u_char;

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