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

[Xen-changelog] [xen-unstable] minios: do not expose #define current to applications



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1225133512 0
# Node ID 8d41996e6897c52bbcfacda68e6911c7459eb2b8
# Parent  324b9b1dd71dbbfc7f2af7bee0f4e704e59ba7d5
minios: do not expose #define current to applications

Currently the minios headers do this:
 #define current get_current()
Obviously when porting general code to this environment, this can
cause problems !

The attached patch arranges for this only to be done if
 #define __MINIOS__
is declared, which is set up by the makefile in extras/mini-os.

Suppressing the namespace pollution is necessary to get recent
upstream qemu's to compile, since they (quite properly) use `current'
as an ordinary identifier.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 extras/mini-os/Makefile        |    3 +++
 extras/mini-os/include/sched.h |    3 ++-
 extras/mini-os/include/wait.h  |   10 +++++-----
 3 files changed, 10 insertions(+), 6 deletions(-)

diff -r 324b9b1dd71d -r 8d41996e6897 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile   Mon Oct 27 14:59:01 2008 +0000
+++ b/extras/mini-os/Makefile   Mon Oct 27 18:51:52 2008 +0000
@@ -17,6 +17,9 @@ include minios.mk
 
 # Set tester flags
 # CFLAGS += -DBLKTEST_WRITE
+
+# Make the headers define our internal stuff
+CFLAGS += -D__MINIOS__
 
 # Define some default flags for linking.
 LDLIBS := 
diff -r 324b9b1dd71d -r 8d41996e6897 extras/mini-os/include/sched.h
--- a/extras/mini-os/include/sched.h    Mon Oct 27 14:59:01 2008 +0000
+++ b/extras/mini-os/include/sched.h    Mon Oct 27 18:51:52 2008 +0000
@@ -48,8 +48,9 @@ void exit_thread(void) __attribute__((no
 void exit_thread(void) __attribute__((noreturn));
 void schedule(void);
 
+#ifdef __MINIOS__
 #define current get_current()
-
+#endif
 
 void wake(struct thread *thread);
 void block(struct thread *thread);
diff -r 324b9b1dd71d -r 8d41996e6897 extras/mini-os/include/wait.h
--- a/extras/mini-os/include/wait.h     Mon Oct 27 14:59:01 2008 +0000
+++ b/extras/mini-os/include/wait.h     Mon Oct 27 18:51:52 2008 +0000
@@ -7,7 +7,7 @@
 
 #define DEFINE_WAIT(name)                               \
 struct wait_queue name = {                              \
-    .thread       = current,                            \
+    .thread       = get_current(),                            \
     .thread_list  = MINIOS_LIST_HEAD_INIT((name).thread_list), \
 }
 
@@ -53,7 +53,7 @@ static inline void wake_up(struct wait_q
     unsigned long flags;        \
     local_irq_save(flags);      \
     add_wait_queue(&wq, &w);    \
-    block(current);             \
+    block(get_current());       \
     local_irq_restore(flags);   \
 } while (0)
 
@@ -74,8 +74,8 @@ static inline void wake_up(struct wait_q
         /* protect the list */                                  \
         local_irq_save(flags);                                  \
         add_wait_queue(&wq, &__wait);                           \
-        current->wakeup_time = deadline;                        \
-        clear_runnable(current);                                \
+        get_current()->wakeup_time = deadline;                  \
+        clear_runnable(get_current());                          \
         local_irq_restore(flags);                               \
         if((condition) || (deadline && NOW() >= deadline))      \
             break;                                              \
@@ -83,7 +83,7 @@ static inline void wake_up(struct wait_q
     }                                                           \
     local_irq_save(flags);                                      \
     /* need to wake up */                                       \
-    wake(current);                                              \
+    wake(get_current());                                        \
     remove_wait_queue(&__wait);                                 \
     local_irq_restore(flags);                                   \
 } while(0) 

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