[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] 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 the .c file in question declares #define _INSIDE_MINIOS Suppressing the namespace pollution is necessary to get recent upstream qemu's to compile, since they (quite properly) use `current' as an ordinary identifier. Ian. Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> diff -r 10d338e5f741 extras/mini-os/arch/x86/sched.c --- a/extras/mini-os/arch/x86/sched.c Wed Oct 22 16:47:44 2008 +0100 +++ b/extras/mini-os/arch/x86/sched.c Thu Oct 23 17:08:46 2008 +0100 @@ -34,6 +34,8 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ + +#define _INSIDE_MINIOS #include <os.h> #include <hypervisor.h> diff -r 10d338e5f741 extras/mini-os/arch/x86/traps.c --- a/extras/mini-os/arch/x86/traps.c Wed Oct 22 16:47:44 2008 +0100 +++ b/extras/mini-os/arch/x86/traps.c Thu Oct 23 17:04:42 2008 +0100 @@ -1,3 +1,5 @@ + +#define _INSIDE_MINIOS #include <os.h> #include <traps.h> diff -r 10d338e5f741 extras/mini-os/fs-front.c --- a/extras/mini-os/fs-front.c Wed Oct 22 16:47:44 2008 +0100 +++ b/extras/mini-os/fs-front.c Thu Oct 23 16:57:07 2008 +0100 @@ -23,6 +23,8 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ + +#define _INSIDE_MINIOS #undef NDEBUG #include <os.h> diff -r 10d338e5f741 extras/mini-os/include/sched.h --- a/extras/mini-os/include/sched.h Wed Oct 22 16:47:44 2008 +0100 +++ b/extras/mini-os/include/sched.h Thu Oct 23 12:11:55 2008 +0100 @@ -48,8 +48,9 @@ void exit_thread(void) __attribute__((no void exit_thread(void) __attribute__((noreturn)); void schedule(void); +#ifdef _INSIDE_MINIOS #define current get_current() - +#endif void wake(struct thread *thread); void block(struct thread *thread); diff -r 10d338e5f741 extras/mini-os/include/wait.h --- a/extras/mini-os/include/wait.h Wed Oct 22 16:47:44 2008 +0100 +++ b/extras/mini-os/include/wait.h Thu Oct 23 12:26:48 2008 +0100 @@ -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) diff -r 10d338e5f741 extras/mini-os/lwip-net.c --- a/extras/mini-os/lwip-net.c Wed Oct 22 16:47:44 2008 +0100 +++ b/extras/mini-os/lwip-net.c Thu Oct 23 17:05:44 2008 +0100 @@ -40,6 +40,8 @@ * Author: Adam Dunkels <adam@xxxxxxx> * */ + +#define _INSIDE_MINIOS #include <os.h> diff -r 10d338e5f741 extras/mini-os/netfront.c --- a/extras/mini-os/netfront.c Wed Oct 22 16:47:44 2008 +0100 +++ b/extras/mini-os/netfront.c Thu Oct 23 17:05:44 2008 +0100 @@ -4,6 +4,8 @@ * * Does not handle fragments or extras. */ + +#define _INSIDE_MINIOS #include <os.h> #include <xenbus.h> diff -r 10d338e5f741 extras/mini-os/sched.c --- a/extras/mini-os/sched.c Wed Oct 22 16:47:44 2008 +0100 +++ b/extras/mini-os/sched.c Thu Oct 23 17:05:44 2008 +0100 @@ -34,6 +34,8 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ + +#define _INSIDE_MINIOS #include <os.h> #include <hypervisor.h> diff -r 10d338e5f741 extras/mini-os/xenbus/xenbus.c --- a/extras/mini-os/xenbus/xenbus.c Wed Oct 22 16:47:44 2008 +0100 +++ b/extras/mini-os/xenbus/xenbus.c Thu Oct 23 17:05:44 2008 +0100 @@ -15,6 +15,9 @@ * **************************************************************************** **/ + +#define _INSIDE_MINIOS + #include <os.h> #include <mm.h> #include <traps.h> _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |