WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] minios: do not expose #define current to applications
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 05 Nov 2008 07:00:32 -0800
Delivery-date: Wed, 05 Nov 2008 07:05:01 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] minios: do not expose #define current to applications, Xen patchbot-unstable <=