[Xenomai-git] Philippe Gerum : nucleus: introduce generic bits for MAYDAY support

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: 878384cbe1ea328683f6b65510fb1864faa13cff
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=878384cbe1ea328683f6b65510fb1864faa13cff

Author: Philippe Gerum r...@xenomai.org
Date:   Sat Jun  5 11:39:24 2010 +0200

nucleus: introduce generic bits for MAYDAY support

This patch enables the nucleus to force a user-space thread running
syscall-less code in primary mode, to call the nucleus back on its way
out from an interrupt via a dedicated syscall (__xn_sys_mayday).

This feature is currently useful for recovering gracefully from a
runaway thread situation detected by the nucleus watchdog. Instead of
killing the runaway thread bluntly, this feature allows to force a
relax on it, despite the syscall-less nature of the code it was
running in primary mode.

The trick is to force the thread to run a piece of user-space code
that issues the mayday syscall, by fixup up its program counter on its
way back to userland. This code is laid on the special mayday page,
mapped to the process address space at binding time. The
implementation relies on the new IPIPE_EVENT_RETURN notification
available from the latest I-pipe patches, to run the fixup code.

In the future, Xenomai real-time signals will be rebased on this
feature to make them able to preempt syscall-less code as well.

---

 include/asm-generic/hal.h |   28 ++-
 include/asm-generic/syscall.h |1 +
 include/nucleus/ppd.h |4 +
 include/nucleus/shadow.h  |   10 +++
 ksrc/nucleus/sched.c  |1 +
 ksrc/nucleus/shadow.c |  176 ++---
 6 files changed, 206 insertions(+), 14 deletions(-)

diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index f03219d..f90cafa 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -259,7 +259,7 @@ static int hdlr (unsigned event, struct ipipe_domain *ipd, 
void *data) \
 static int hdlr (unsigned event, struct ipipe_domain *ipd, void *data) \
 {  \
struct task_struct *p = (struct task_struct *)data; \
-   do_##hdlr(p,p-rt_priority);\
+   do_##hdlr(p, p-rt_priority);   \
return RTHAL_EVENT_PROPAGATE;   \
 }
 
@@ -287,6 +287,14 @@ static int hdlr (unsigned event, struct ipipe_domain *ipd, 
void *data) \
return RTHAL_EVENT_PROPAGATE;  \
 }
 
+#define RTHAL_DECLARE_MAYDAY_EVENT(hdlr) \
+static int hdlr(unsigned event, struct ipipe_domain *ipd, void *data) \
+{\
+   struct pt_regs *regs = data;  \
+   do_##hdlr(regs);  \
+   return RTHAL_EVENT_PROPAGATE; \
+}
+
 #ifndef TASK_ATOMICSWITCH
 #ifdef CONFIG_PREEMPT
 /* We want this feature for preemptible kernels, or the behaviour when
@@ -321,6 +329,15 @@ static inline void clear_task_nowakeup(struct task_struct 
*p)
 #define rthal_set_foreign_stack(ipd)   ipipe_set_foreign_stack(ipd)
 #define rthal_clear_foreign_stack(ipd) ipipe_clear_foreign_stack(ipd)
 
+#ifdef __IPIPE_FEATURE_ENABLE_NOTIFIER
+#define rthal_enable_notifier(p)   ipipe_enable_notifier(p)
+#else
+static inline void rthal_enable_notifier(struct task_struct *p)
+{
+   p-flags |= PF_EVNOTIFY;
+}
+#endif
+
 #define rthal_catch_cleanup(hdlr) \
 ipipe_catch_event(ipipe_root_domain,IPIPE_EVENT_CLEANUP,hdlr)
 #define rthal_catch_taskexit(hdlr) \
@@ -338,6 +355,15 @@ static inline void clear_task_nowakeup(struct task_struct 
*p)
 #define rthal_catch_exception(ex,hdlr) \
 ipipe_catch_event(rthal_domain,ex|IPIPE_EVENT_SELF,hdlr)
 
+#ifdef IPIPE_EVENT_RETURN
+#define RTHAL_HAVE_RETURN_EVENT
+#define rthal_catch_return(hdlr) \
+ipipe_catch_event(rthal_domain,IPIPE_EVENT_RETURN,hdlr)
+#define rthal_return_intercept(p)  ipipe_return_notify(p)
+#else
+#define rthal_catch_return(hdlr)   do { } while(0)
+#endif
+
 #define rthal_register_domain(_dom,_name,_id,_prio,_entry) \
 ({ \
struct ipipe_domain_attr attr;  \
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index 3f10065..7e3d01a 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -47,6 +47,7 @@
 #define __xn_sys_current_info  9   /* r = xnshadow_current_info(info) */
 #define __xn_sys_get_next_sigs 10  /* only unqueue pending signals. */
 #define __xn_sys_drop_u_mode   11  /* stop updating thread-u_mode */
+#define __xn_sys_mayday12  /* request mayday fixup */
 
 #define XENOMAI_LINUX_DOMAIN  0
 #define XENOMAI_XENO_DOMAIN   1
diff --git 

[Xenomai-git] Philippe Gerum : scripts: fix --enable-debug help string

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: 2d869af8f719fcd2a58661e9db1dac02feb5913b
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=2d869af8f719fcd2a58661e9db1dac02feb5913b

Author: Philippe Gerum r...@xenomai.org
Date:   Fri May 21 11:20:52 2010 +0200

scripts: fix --enable-debug help string

---

 configure.in |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.in b/configure.in
index 9c68443..a920f13 100644
--- a/configure.in
+++ b/configure.in
@@ -148,7 +148,7 @@ dnl Debug build (default: off)
 debug_symbols=
 AC_MSG_CHECKING(for debug symbols)
 AC_ARG_ENABLE(debug,
-   AS_HELP_STRING([--enable-debug], [Enable debug support in nucleus and 
debug symbols in programs]),
+   AS_HELP_STRING([--enable-debug], [Enable debug symbols in programs]),
[case $enableval in
y | yes) debug_symbols=y ;;
*) unset debug_symbols ;;


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nucleus: prevent stack overflow w/ unlocked context switch

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: 16b5cfad3e519bc8524537e149fc4a6722c7f642
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=16b5cfad3e519bc8524537e149fc4a6722c7f642

Author: Philippe Gerum r...@xenomai.org
Date:   Mon May 17 22:46:07 2010 +0200

nucleus: prevent stack overflow w/ unlocked context switch

Under high IRQ pressure w/ unlocked context switch support enabled, we
could face stack overflows, due to recurring calls to xnpod_schedule()
from xnsched_resched_after_unlocked_switch().

Typically:

__xnpod_schedule()
xnpod_switch_to()
xnlock_clear_irqon(nklock)
IRQ
xnsched_set_resched()
xnsched_resched_after_unlocked_switch()
__xnpod_schedule()
...etc...

This fix replaces the recursive function call to __xnpod_schedule()
from itself by a plain unconditional branch to respin the scheduling
procedure.

---

 include/nucleus/sched.h |9 +
 ksrc/nucleus/pod.c  |9 +
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/include/nucleus/sched.h b/include/nucleus/sched.h
index 05dd4b1..441a3a2 100644
--- a/include/nucleus/sched.h
+++ b/include/nucleus/sched.h
@@ -203,6 +203,12 @@ struct xnsched *xnsched_finish_unlocked_switch(struct 
xnsched *sched);
 
 #define xnsched_resched_after_unlocked_switch() xnpod_schedule()
 
+static inline
+int xnsched_maybe_resched_after_unlocked_switch(struct xnsched *sched)
+{
+   return testbits(sched-status, XNRESCHED);
+}
+
 #else /* !CONFIG_XENO_HW_UNLOCKED_SWITCH */
 
 #ifdef CONFIG_SMP
@@ -217,6 +223,9 @@ struct xnsched *xnsched_finish_unlocked_switch(struct 
xnsched *sched);
 
 #define xnsched_resched_after_unlocked_switch()do { } while(0)
 
+#define xnsched_maybe_resched_after_unlocked_switch(sched) \
+   ({ (void)(sched); 0; })
+
 #endif /* !CONFIG_XENO_HW_UNLOCKED_SWITCH */
 
 #ifdef CONFIG_XENO_OPT_WATCHDOG
diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index fb63f35..7002a73 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -2175,7 +2175,7 @@ void __xnpod_schedule(struct xnsched *sched)
xnarch_trace_pid(xnthread_user_task(curr) ?
 xnarch_user_pid(xnthread_archtcb(curr)) : -1,
 xnthread_current_priority(curr));
-
+reschedule:
need_resched = __xnpod_test_resched(sched);
 #if !XENO_DEBUG(NUCLEUS)
if (!need_resched)
@@ -2284,10 +2284,11 @@ void __xnpod_schedule(struct xnsched *sched)
if (xnthread_signaled_p(curr))
xnpod_dispatch_signals();
 
-   xnlock_put_irqrestore(nklock, s);
+   if (switched 
+   xnsched_maybe_resched_after_unlocked_switch(sched))
+   goto reschedule;
 
-   if (switched)
-   xnsched_resched_after_unlocked_switch();
+   xnlock_put_irqrestore(nklock, s);
 
return;
 


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : powerpc: upgrade I-pipe support to 2.6.33.4-powerpc-2.9-01

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: e02e82fe04d014ae4bb9a4c1495a5aec0c633c11
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=e02e82fe04d014ae4bb9a4c1495a5aec0c633c11

Author: Philippe Gerum r...@xenomai.org
Date:   Mon May 17 22:45:45 2010 +0200

powerpc: upgrade I-pipe support to 2.6.33.4-powerpc-2.9-01

---

 ...h = adeos-ipipe-2.6.33.4-powerpc-2.9-01.patch} |  199 +++-
 1 files changed, 107 insertions(+), 92 deletions(-)

diff --git a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33-powerpc-2.9-00.patch 
b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.4-powerpc-2.9-01.patch
similarity index 99%
rename from ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33-powerpc-2.9-00.patch
rename to ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.4-powerpc-2.9-01.patch
index 7b84ba9..924989c 100644
--- a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33-powerpc-2.9-00.patch
+++ b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.4-powerpc-2.9-01.patch
@@ -262,10 +262,10 @@ index 9f4c9d4..ce168bf 100644
   * or should we not care like we do now ? --BenH.
 diff --git a/arch/powerpc/include/asm/ipipe.h 
b/arch/powerpc/include/asm/ipipe.h
 new file mode 100644
-index 000..95e36f6
+index 000..83ee731
 --- /dev/null
 +++ b/arch/powerpc/include/asm/ipipe.h
-@@ -0,0 +1,271 @@
+@@ -0,0 +1,270 @@
 +/*
 + *   include/asm-powerpc/ipipe.h
 + *
@@ -313,10 +313,10 @@ index 000..95e36f6
 +#include asm/paca.h
 +#endif
 +
-+#define IPIPE_ARCH_STRING 2.9-00
++#define IPIPE_ARCH_STRING 2.9-01
 +#define IPIPE_MAJOR_NUMBER2
 +#define IPIPE_MINOR_NUMBER9
-+#define IPIPE_PATCH_NUMBER0
++#define IPIPE_PATCH_NUMBER1
 +
 +#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
 +
@@ -337,6 +337,22 @@ index 000..95e36f6
 +  !__x__; \
 +  })
 +
++DECLARE_PER_CPU(struct mm_struct *, ipipe_active_mm);
++
++#define ipipe_mm_switch_protect(flags)
\
++  do {\
++  preempt_disable();  \
++  per_cpu(ipipe_active_mm, smp_processor_id()) = NULL;\
++  barrier();  \
++  (void)(flags);  \
++  } while(0)
++
++#define ipipe_mm_switch_unprotect(flags)  \
++  do {\
++  preempt_enable();   \
++  (void)(flags);  \
++  } while(0)
++
 +#else /* !CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH */
 +
 +#define prepare_arch_switch(next) \
@@ -352,6 +368,9 @@ index 000..95e36f6
 +  if (__x__) local_irq_enable_hw(); !__x__;   \
 +  })
 +
++#define ipipe_mm_switch_protect(flags)
local_irq_save_hw_cond(flags)
++#define ipipe_mm_switch_unprotect(flags)  local_irq_restore_hw_cond(flags)
++
 +#endif /* !CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH */
 +
 +struct ipipe_domain;
@@ -368,26 +387,6 @@ index 000..95e36f6
 +extern cpumask_t __ipipe_dbrk_pending;
 +#endif
 +
-+#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
-+struct mm;
-+DECLARE_PER_CPU(struct mm_struct *, ipipe_active_mm);
-+#define ipipe_mm_switch_protect(flags)
\
-+  do {\
-+  preempt_disable();  \
-+  per_cpu(ipipe_active_mm, smp_processor_id()) = NULL;\
-+  barrier();  \
-+  (void)(flags);  \
-+  } while(0)
-+#define ipipe_mm_switch_unprotect(flags)  \
-+  do {\
-+  preempt_enable();   \
-+  (void)(flags);  \
-+  } while(0)
-+#else
-+#define ipipe_mm_switch_protect(flags)
local_irq_save_hw_cond(flags)
-+#define ipipe_mm_switch_unprotect(flags)  local_irq_restore_hw_cond(flags)
-+#endif
-+
 +#define __ipipe_hrtimer_irq   IPIPE_TIMER_VIRQ
 +#define __ipipe_hrtimer_freq  ppc_tb_freq
 +#define __ipipe_hrclock_freq  __ipipe_hrtimer_freq
@@ -539,10 +538,10 @@ index 000..95e36f6
 +#endif /* !__ASM_POWERPC_IPIPE_H */
 diff --git a/arch/powerpc/include/asm/ipipe_base.h 
b/arch/powerpc/include/asm/ipipe_base.h
 new file mode 100644
-index 000..3a9d8df
+index 000..b0ebc6f
 --- /dev/null
 +++ b/arch/powerpc/include/asm/ipipe_base.h
-@@ -0,0 +1,155 @@
+@@ -0,0 +1,156 @@
 +/* -*- linux-c -*-
 + * include/asm-powerpc/ipipe_base.h
 + *
@@ -694,6 +693,7 @@ index 000..3a9d8df
 +
 +#define 

[Xenomai-git] Tschaeche IT-Services : nucleus: enable tswitch callout for the root thread

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: 56f7e9518b5270e1bf37e386be9debb66ce9bc1e
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=56f7e9518b5270e1bf37e386be9debb66ce9bc1e

Author: Tschaeche IT-Services servi...@tschaeche.com
Date:   Fri May 21 11:26:51 2010 +0200

nucleus: enable tswitch callout for the root thread

Signed-off-by: Philippe Gerum r...@xenomai.org

---

 include/nucleus/pod.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/nucleus/pod.h b/include/nucleus/pod.h
index 8831fb5..bab9f07 100644
--- a/include/nucleus/pod.h
+++ b/include/nucleus/pod.h
@@ -298,7 +298,7 @@ void xnpod_fire_callouts(xnqueue_t *hookq,
 static inline void xnpod_run_hooks(struct xnqueue *q,
   struct xnthread *thread, const char *type)
 {
-   if (!emptyq_p(q)  !xnthread_test_state(thread, XNROOT)) {
+   if (!emptyq_p(q)) {
trace_mark(xn_nucleus, thread_callout,
   thread %p thread_name %s hook %s,
   thread, xnthread_name(thread), type);


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : posix: fix build w/o CONFIG_PROC_FS

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: b375cc7cf8852b25f5e8b8b428f51ab43b1b3548
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=b375cc7cf8852b25f5e8b8b428f51ab43b1b3548

Author: Philippe Gerum r...@xenomai.org
Date:   Tue May 25 17:07:23 2010 +0200

posix: fix build w/o CONFIG_PROC_FS

---

 ksrc/skins/posix/syscall.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/ksrc/skins/posix/syscall.c b/ksrc/skins/posix/syscall.c
index 2a97a2d..f0d0781 100644
--- a/ksrc/skins/posix/syscall.c
+++ b/ksrc/skins/posix/syscall.c
@@ -20,6 +20,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include linux/err.h
 #include asm/xenomai/wrappers.h
 #include nucleus/jhash.h
 #include nucleus/ppd.h


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : x86: upgrade I-pipe support to 2.6.32.13-x86-2.6-04

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: b7073ca9d528945ce2f4ebcf13d731ca56d4
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=b7073ca9d528945ce2f4ebcf13d731ca56d4

Author: Philippe Gerum r...@xenomai.org
Date:   Tue May 25 23:03:01 2010 +0200

x86: upgrade I-pipe support to 2.6.32.13-x86-2.6-04

---

 ...atch = adeos-ipipe-2.6.32.13-x86-2.6-04.patch} |   81 +++
 1 files changed, 47 insertions(+), 34 deletions(-)

diff --git a/ksrc/arch/x86/patches/adeos-ipipe-2.6.32.11-x86-2.6-03.patch 
b/ksrc/arch/x86/patches/adeos-ipipe-2.6.32.13-x86-2.6-04.patch
similarity index 99%
rename from ksrc/arch/x86/patches/adeos-ipipe-2.6.32.11-x86-2.6-03.patch
rename to ksrc/arch/x86/patches/adeos-ipipe-2.6.32.13-x86-2.6-04.patch
index a52c3f0..b8c36c6 100644
--- a/ksrc/arch/x86/patches/adeos-ipipe-2.6.32.11-x86-2.6-03.patch
+++ b/ksrc/arch/x86/patches/adeos-ipipe-2.6.32.13-x86-2.6-04.patch
@@ -1,5 +1,5 @@
 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
-index 4fdb669..89b72a9 100644
+index fbc161d..966de95 100644
 --- a/arch/x86/Kconfig
 +++ b/arch/x86/Kconfig
 @@ -480,6 +480,7 @@ config SCHED_OMIT_FRAME_POINTER
@@ -168,7 +168,7 @@ index 0b72282..6574056 100644
  /*
 diff --git a/arch/x86/include/asm/ipipe.h b/arch/x86/include/asm/ipipe.h
 new file mode 100644
-index 000..7d29f03
+index 000..8d31e67
 --- /dev/null
 +++ b/arch/x86/include/asm/ipipe.h
 @@ -0,0 +1,158 @@
@@ -199,10 +199,10 @@ index 000..7d29f03
 +#ifdef CONFIG_IPIPE
 +
 +#ifndef IPIPE_ARCH_STRING
-+#define IPIPE_ARCH_STRING 2.6-03
++#define IPIPE_ARCH_STRING 2.6-04
 +#define IPIPE_MAJOR_NUMBER2
 +#define IPIPE_MINOR_NUMBER6
-+#define IPIPE_PATCH_NUMBER3
++#define IPIPE_PATCH_NUMBER4
 +#endif
 +
 +DECLARE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
@@ -1251,7 +1251,7 @@ index d8e5d0c..847cc01 100644
  obj-$(CONFIG_HPET_TIMER)  += hpet.o
  
 diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
-index 0e69e17..47586ca 100644
+index 168e172..948c033 100644
 --- a/arch/x86/kernel/apic/apic.c
 +++ b/arch/x86/kernel/apic/apic.c
 @@ -446,7 +446,7 @@ static void lapic_timer_setup(enum clock_event_mode mode,
@@ -1310,7 +1310,7 @@ index 0e69e17..47586ca 100644
}
}
  
-@@ -1735,7 +1739,7 @@ void smp_spurious_interrupt(struct pt_regs *regs)
+@@ -1737,7 +1741,7 @@ void smp_spurious_interrupt(struct pt_regs *regs)
 */
v = apic_read(APIC_ISR + ((SPURIOUS_APIC_VECTOR  ~0x1f)  1));
if (v  (1  (SPURIOUS_APIC_VECTOR  0x1f)))
@@ -1319,7 +1319,7 @@ index 0e69e17..47586ca 100644
  
inc_irq_stat(irq_spurious_count);
  
-@@ -2004,13 +2008,13 @@ static int lapic_suspend(struct sys_device *dev, 
pm_message_t state)
+@@ -2006,13 +2010,13 @@ static int lapic_suspend(struct sys_device *dev, 
pm_message_t state)
apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
  #endif
  
@@ -1335,7 +1335,7 @@ index 0e69e17..47586ca 100644
return 0;
  }
  
-@@ -2025,7 +2029,7 @@ static int lapic_resume(struct sys_device *dev)
+@@ -2027,7 +2031,7 @@ static int lapic_resume(struct sys_device *dev)
if (!apic_pm_state.active)
return 0;
  
@@ -1344,7 +1344,7 @@ index 0e69e17..47586ca 100644
if (intr_remapping_enabled) {
ioapic_entries = alloc_ioapic_entries();
if (!ioapic_entries) {
-@@ -2091,7 +2095,7 @@ static int lapic_resume(struct sys_device *dev)
+@@ -2093,7 +2097,7 @@ static int lapic_resume(struct sys_device *dev)
free_ioapic_entries(ioapic_entries);
}
  restore:
@@ -4251,7 +4251,7 @@ index 4cf7956..fff349c 100644
bool preload_fpu;
  
 diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
-index 6eabe90..e96b01d 100644
+index 868fdb4..ddf025d 100644
 --- a/arch/x86/kernel/process_64.c
 +++ b/arch/x86/kernel/process_64.c
 @@ -58,6 +58,8 @@ asmlinkage extern void ret_from_fork(void);
@@ -4271,7 +4271,7 @@ index 6eabe90..e96b01d 100644
  
set_tsk_thread_flag(p, TIF_FORK);
  
-@@ -358,10 +361,12 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, 
unsigned long new_sp)
+@@ -357,10 +360,12 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, 
unsigned long new_sp)
regs-ss= __USER_DS;
regs-flags = 0x200;
set_fs(USER_DS);
@@ -4284,7 +4284,7 @@ index 6eabe90..e96b01d 100644
  }
  EXPORT_SYMBOL_GPL(start_thread);
  
-@@ -380,7 +385,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct 
*next_p)
+@@ -379,7 +384,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct 
*next_p)
  {
struct thread_struct *prev = prev_p-thread;
struct thread_struct *next = next_p-thread;
@@ -6275,6 +6275,19 @@ index f4e3184..3b80b7b 100644
  #endif
  
  #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
+diff --git a/include/linux/module.h b/include/linux/module.h
+index 460df15..482efc8 100644
+--- a/include/linux/module.h
 

[Xenomai-git] Philippe Gerum : x86: update fpu state accessor for 2.6.35+

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: 1a57534d5b7224510c83d6e14d14145004acc27a
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=1a57534d5b7224510c83d6e14d14145004acc27a

Author: Philippe Gerum r...@xenomai.org
Date:   Wed May 26 12:12:45 2010 +0200

x86: update fpu state accessor for 2.6.35+

---

 include/asm-x86/wrappers_32.h |5 -
 include/asm-x86/wrappers_64.h |5 -
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/asm-x86/wrappers_32.h b/include/asm-x86/wrappers_32.h
index f738dc4..5f37766 100644
--- a/include/asm-x86/wrappers_32.h
+++ b/include/asm-x86/wrappers_32.h
@@ -219,9 +219,12 @@ typedef irq_handler_t rthal_irq_host_handler_t;
 #if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,25)
 typedef union i387_union x86_fpustate;
 #define x86_fpustate_ptr(t) ((t)-i387)
-#else
+#elif LINUX_VERSION_CODE = KERNEL_VERSION(2,6,34)
 typedef union thread_xstate x86_fpustate;
 #define x86_fpustate_ptr(t) ((t)-xstate)
+#else /* 2.6.35 and above */
+typedef union thread_xstate x86_fpustate;
+#define x86_fpustate_ptr(t) ((t)-fpu.state)
 #endif
 
 #endif /* _XENO_ASM_X86_WRAPPERS_32_H */
diff --git a/include/asm-x86/wrappers_64.h b/include/asm-x86/wrappers_64.h
index 346cf71..a61f6ba 100644
--- a/include/asm-x86/wrappers_64.h
+++ b/include/asm-x86/wrappers_64.h
@@ -70,9 +70,12 @@ typedef irq_handler_t rthal_irq_host_handler_t;
 #if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,25)
 typedef union i387_union x86_fpustate;
 #define x86_fpustate_ptr(t) ((t)-i387)
-#else
+#elif LINUX_VERSION_CODE = KERNEL_VERSION(2,6,34)
 typedef union thread_xstate x86_fpustate;
 #define x86_fpustate_ptr(t) ((t)-xstate)
+#else /* 2.6.35 and above */
+typedef union thread_xstate x86_fpustate;
+#define x86_fpustate_ptr(t) ((t)-fpu.state)
 #endif
 
 #endif /* _XENO_ASM_X86_WRAPPERS_64_H */


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : hal/generic: always track switch to foreign stack

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: d21ee7fc9aa5aa871ad71fd72a6d475cb157961f
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=d21ee7fc9aa5aa871ad71fd72a6d475cb157961f

Author: Philippe Gerum r...@xenomai.org
Date:   Fri Jun  4 16:32:43 2010 +0200

hal/generic: always track switch to foreign stack

We do want to let the I-pipe know when we switch to a non-linux stack,
always.  So remove the condition on CONFIG_KGDB for tracking such
change.

---

 include/asm-generic/hal.h |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index 84c1a4d..f03219d 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -318,14 +318,8 @@ static inline void clear_task_nowakeup(struct task_struct 
*p)
 #define rthal_disable_ondemand_mappings(tsk)   (0)
 #endif /* !(VM_PINNED || MMF_VM_PINNED) */
 
-#ifdef CONFIG_KGDB
 #define rthal_set_foreign_stack(ipd)   ipipe_set_foreign_stack(ipd)
 #define rthal_clear_foreign_stack(ipd) ipipe_clear_foreign_stack(ipd)
-#else /* !CONFIG_KGDB */
-/* No need to track foreign stacks unless KGDB is active. */
-#define rthal_set_foreign_stack(ipd)   do { } while(0)
-#define rthal_clear_foreign_stack(ipd) do { } while(0)
-#endif /* CONFIG_KGDB */
 
 #define rthal_catch_cleanup(hdlr) \
 ipipe_catch_event(ipipe_root_domain,IPIPE_EVENT_CLEANUP,hdlr)


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : uitron: fix wait flag helper

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: 2ee82e03747d306aaf3c14763adeffa564b2792c
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=2ee82e03747d306aaf3c14763adeffa564b2792c

Author: Philippe Gerum r...@xenomai.org
Date:   Mon May 31 18:54:44 2010 +0200

uitron: fix wait flag helper

All wait flag services from the uITRON emulator were missing the wait
mask and mode information in the sleeper TCB, so there is no way they
could ever work.

---

 ksrc/skins/uitron/flag.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ksrc/skins/uitron/flag.c b/ksrc/skins/uitron/flag.c
index 8238ca7..c7f3c0d 100644
--- a/ksrc/skins/uitron/flag.c
+++ b/ksrc/skins/uitron/flag.c
@@ -316,6 +316,8 @@ static ER wai_flg_helper(UINT *p_flgptn,
task = ui_current_task();
 
xnthread_clear_info(task-threadbase, uITRON_TASK_RLWAIT);
+   task-wargs.flag.wfmode = wfmode;
+   task-wargs.flag.waiptn = waiptn;
 
xnsynch_sleep_on(flag-synchbase, timeout, XN_RELATIVE);
 


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : powerpc: upgrade I-pipe support to 2.6.33.5-powerpc-2. 10-01, 2.6.34-powerpc-2.10-00

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: 8875b2bf74956d9c9d284b7ded4a7ab6c6582863
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=8875b2bf74956d9c9d284b7ded4a7ab6c6582863

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun  9 11:31:28 2010 +0200

powerpc: upgrade I-pipe support to 2.6.33.5-powerpc-2.10-01, 
2.6.34-powerpc-2.10-00

---

 ksrc/arch/powerpc/patches/README   |8 +
 .../adeos-ipipe-2.6.30.3-powerpc-DENX-2.7-06.patch |11728 
 ... = adeos-ipipe-2.6.33.5-powerpc-2.10-01.patch} |  460 +-
 ...ch = adeos-ipipe-2.6.34-powerpc-2.10-00.patch} |  428 +-
 4 files changed, 548 insertions(+), 12076 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-rpm.git;a=commitdiff;h=8875b2bf74956d9c9d284b7ded4a7ab6c6582863

___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-00, 2.6. 34-x86-2.7-00

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: e79d626240913ca1343c62e795491c6a6aff66ea
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=e79d626240913ca1343c62e795491c6a6aff66ea

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun  9 11:32:52 2010 +0200

x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-00, 2.6.34-x86-2.7-00

---

 .../patches/adeos-ipipe-2.6.32.13-x86-2.6-04.patch |11424 ---
 .../patches/adeos-ipipe-2.6.34-x86-2.6-04.patch|11613 
 2 files changed, 0 insertions(+), 23037 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-rpm.git;a=commitdiff;h=e79d626240913ca1343c62e795491c6a6aff66ea

___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : rtai: mark as deprecated

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: for-upstream
Commit: 2b66eb3839defc67f60ca75f73b4437c6023411f
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=2b66eb3839defc67f60ca75f73b4437c6023411f

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Jun  7 19:48:04 2010 +0200

rtai: mark as deprecated

Keeping this emulator does not make much sense anymore. Most people
who ported to Xenomai already moved to either the native or POSIX
APIs.

Additionally, this kernel-only emulator has no future in the next
Xenomai architecture, and it is very unlikely that anyone would bother
writing an LXRT emulator for Xenomai.

The RTAI emulator is scheduled for removal in Xenomai 2.6.x.

---

 ksrc/skins/rtai/Kconfig |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ksrc/skins/rtai/Kconfig b/ksrc/skins/rtai/Kconfig
index 5c6a701..ac411eb 100644
--- a/ksrc/skins/rtai/Kconfig
+++ b/ksrc/skins/rtai/Kconfig
@@ -1,10 +1,15 @@
 menuconfig XENO_SKIN_RTAI
depends on XENO_OPT_NUCLEUS
-   tristate RTAI emulator
+   tristate RTAI emulator (DEPRECATED)
help
 
An emulator of the RTAI system.
 
+   WARNING: This emulator is DEPRECATED. It is planned for
+   removal in v2.6.x. Legacy applications depending on it should
+   be converted to the native Xenomai API, which provides
+   equivalent features, and more.
+
 if XENO_SKIN_RTAI
 
 config XENO_OPT_RTAI_PERIOD


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : powerpc: enable MAYDAY support

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/mayday
Commit: 947e3d873af832703f41d193ad94648d4c935cdc
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=947e3d873af832703f41d193ad94648d4c935cdc

Author: Philippe Gerum r...@xenomai.org
Date:   Sat Jun  5 11:57:40 2010 +0200

powerpc: enable MAYDAY support

---

 include/asm-powerpc/bits/shadow.h |   61 +
 include/asm-powerpc/system.h  |8 -
 2 files changed, 68 insertions(+), 1 deletions(-)

diff --git a/include/asm-powerpc/bits/shadow.h 
b/include/asm-powerpc/bits/shadow.h
index 47b65a2..7f3554e 100644
--- a/include/asm-powerpc/bits/shadow.h
+++ b/include/asm-powerpc/bits/shadow.h
@@ -27,6 +27,12 @@
 #error Pure kernel header included from user-space!
 #endif
 
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,0)
+#include asm/cache.h
+#else
+#include asm/cacheflush.h
+#endif
+
 static inline void xnarch_init_shadow_tcb(xnarchtcb_t * tcb,
  struct xnthread *thread,
  const char *name)
@@ -59,4 +65,59 @@ static inline int xnarch_local_syscall(struct pt_regs *regs)
 
 #define xnarch_schedule_tail(prev) do { } while(0)
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+* 3c 00 0b 00  lis r0,mux_c...@h
+* 60 00 02 2b  ori r0,r0,mux_c...@l
+* 39 00 00 00  li  r8,0
+* 44 00 00 02  sc
+* 00 b0 0b 00  .long   0x00b00b00 illegal insn
+*
+* We don't mess with CCR here, so no need to save/restore it
+* in handle/fixup code.
+*/
+   u32 mux, insn[5];
+
+   mux = __xn_mux_code(0, __xn_sys_mayday);
+   insn[0] = 0x3c00 | (mux  16);
+   insn[1] = 0x6000 | (mux  0x);
+   insn[2] = 0x3900;
+   insn[3] = 0x4402;
+   insn[4] = 0x00b00b00;
+   memcpy(page, insn, sizeof(insn));
+
+   flush_dcache_range((unsigned long)page,
+  (unsigned long)page + sizeof(insn));
+}
+
+static inline void xnarch_call_mayday(void)
+{
+   rthal_return_intercept(current);
+}
+
+static inline void xnarch_handle_mayday(struct xnarchtcb *tcb,
+   struct pt_regs *regs,
+   unsigned long tramp)
+{
+   tcb-mayday.nip = regs-nip;
+   tcb-mayday.r0 = regs-gpr[0];
+   tcb-mayday.r8 = regs-gpr[8];
+   regs-nip = tramp;
+}
+
+static inline void xnarch_fixup_mayday(struct xnarchtcb *tcb,
+  struct pt_regs *regs)
+{
+   regs-nip = tcb-mayday.nip;
+   regs-gpr[0] = tcb-mayday.r0;
+   regs-gpr[8] = tcb-mayday.r8;
+}
+
+#endif /* XNARCH_HAVE_MAYDAY */
+
 #endif /* !_XENO_ASM_POWERPC_BITS_SHADOW_H */
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 0e1072a..4044f43 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -51,7 +51,13 @@ typedef struct xnarchtcb {   /* Per-thread arch-dependent 
block */
struct thread_struct *tsp;  /* Pointer to the active thread struct 
(ts or user-thread). */
struct mm_struct *mm;
struct mm_struct *active_mm;
-
+#ifdef XNARCH_HAVE_MAYDAY
+   struct {
+   unsigned long nip;
+   unsigned long r0;
+   unsigned long r8;
+   } mayday;
+#endif
/* Kernel mode side */
struct thread_struct ts;/* Holds kernel-based thread context. */
 #ifdef CONFIG_XENO_HW_UNLOCKED_SWITCH


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : wrappers: introduce file-to-inode converter

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 0fb592c0f37b739f01b16bfe7ebcb028a82d1946
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=0fb592c0f37b739f01b16bfe7ebcb028a82d1946

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Apr 29 19:52:53 2010 +0200

wrappers: introduce file-to-inode converter

---

 include/asm-generic/wrappers.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index ecc1867..d82727f 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -37,6 +37,7 @@
 #include linux/sched.h
 #include linux/bitops.h
 #include linux/delay.h
+#include linux/slab.h
 #include linux/moduleparam.h /* Use the backport. */
 #include asm/atomic.h
 
@@ -335,6 +336,8 @@ unsigned long find_next_bit(const unsigned long *addr,
 
 #define mmiowb()   barrier()
 
+#define wrap_f_inode(file) ((file)-f_dentry-d_inode)
+
 #else /* LINUX_VERSION_CODE = KERNEL_VERSION(2,6,0) */
 
 #define compat_module_param_array(name, type, count, perm) \
@@ -457,6 +460,8 @@ unsigned long find_next_bit(const unsigned long *addr,
 #define DECLARE_DELAYED_WORK_NODATA(n, f) DECLARE_DELAYED_WORK(n, f)
 #endif /* = 2.6.20 */
 
+#define wrap_f_inode(file) ((file)-f_path.dentry-d_inode)
+
 #endif /* LINUX_VERSION_CODE  KERNEL_VERSION(2,6,0) */
 
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,18)


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nucleus/registry: convert to vfile

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: abf97a745e5d28ceededdde1fa5dffb82c780b92
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=abf97a745e5d28ceededdde1fa5dffb82c780b92

Author: Philippe Gerum r...@xenomai.org
Date:   Tue May 25 17:37:11 2010 +0200

nucleus/registry: convert to vfile

---

 include/nucleus/registry.h |  168 +---
 ksrc/nucleus/Makefile  |2 +
 ksrc/nucleus/registry.c|  475 
 3 files changed, 357 insertions(+), 288 deletions(-)

diff --git a/include/nucleus/registry.h b/include/nucleus/registry.h
index 6bd5ec9..34780f6 100644
--- a/include/nucleus/registry.h
+++ b/include/nucleus/registry.h
@@ -31,37 +31,33 @@
 #if defined(__KERNEL__) || defined(__XENO_SIM__)
 
 #include nucleus/synch.h
+#include nucleus/vfile.h
 
 struct xnpnode;
 
 typedef struct xnobject {
-
-xnholder_t link;
-
-#define link2xnobj(ln) container_of(ln, xnobject_t, link)
-
-void *objaddr;
-
-const char *key;   /* ! Hash key. */
-
-xnsynch_t safesynch; /* ! Safe synchronization object. */
-
-u_long safelock;/* ! Safe lock count. */
-
-u_long cstamp; /* ! Creation stamp. */
-
-struct xnobject *hnext;/* ! Next in h-table */
-
+   void *objaddr;
+   const char *key;  /* ! Hash key. */
+   struct xnsynch safesynch; /* ! Safe synchronization object. */
+   u_long safelock;  /* ! Safe lock count. */
+   u_long cstamp;/* ! Creation stamp. */
 #ifdef CONFIG_PROC_FS
-
-struct xnpnode *pnode; /* ! /proc information class. */
-
-struct proc_dir_entry *proc; /* ! /proc entry. */
-
+   struct xnpnode *pnode;  /* ! v-file information class. */
+   union {
+   struct {
+   struct xnvfile_rev_tag tag;
+   struct xnvfile_snapshot vfile;
+   } file; /* ! virtual file. */
+   struct xnvfile_link link; /* ! virtual link. */
+   } vfile_u;
+   struct xnvfile *vfilp;
 #endif /* CONFIG_PROC_FS */
-
+   struct xnobject *hnext; /* ! Next in h-table */
+   struct xnholder link;
 } xnobject_t;
 
+#define link2xnobj(ln) container_of(ln, struct xnobject, link)
+
 #ifdef __cplusplus
 extern C {
 #endif
@@ -72,41 +68,65 @@ void xnregistry_cleanup(void);
 
 #ifdef CONFIG_PROC_FS
 
-#include linux/proc_fs.h
-
-#define XNOBJECT_PROC_RESERVED1 ((struct proc_dir_entry *)1)
-#define XNOBJECT_PROC_RESERVED2 ((struct proc_dir_entry *)2)
-
-typedef ssize_t link_proc_t(char *buf,
-   int count,
-   void *data);
-typedef struct xnptree {
-
-struct proc_dir_entry *dir;
-const char *name;
-int entries;
-
-} xnptree_t;
+#define XNOBJECT_PNODE_RESERVED1 ((struct xnvfile *)1)
+#define XNOBJECT_PNODE_RESERVED2 ((struct xnvfile *)2)
+
+struct xnptree {
+   const char *dirname;
+   /* hidden */
+   int entries;
+   struct xnvfile_directory vdir;
+};
+
+#define DEFINE_XNPTREE(__var, __name)  \
+   struct xnptree __var = {\
+   .dirname = __name,  \
+   .entries = 0,   \
+   .vdir = xnvfile_nodir,  \
+   }
 
-typedef struct xnpnode {
+struct xnpnode_ops {
+   int (*export)(struct xnobject *object, struct xnpnode *pnode);
+   void (*unexport)(struct xnobject *object, struct xnpnode *pnode);
+   void (*touch)(struct xnobject *object);
+};
+
+struct xnpnode {
+   const char *dirname;
+   struct xnptree *root;
+   struct xnpnode_ops *ops;
+   /* hidden */
+   int entries;
+   struct xnvfile_directory vdir;
+};
+
+struct xnpnode_file {
+   struct xnpnode node;
+   struct xnvfile_snapshot_template vfile;
+};
+
+struct xnpnode_link {
+   struct xnpnode node;
+   char *(*target)(void *obj);
+};
 
-struct proc_dir_entry *dir;
-const char *type;
-int entries;
-read_proc_t *read_proc;
-write_proc_t *write_proc;
-link_proc_t *link_proc;
-xnptree_t *root;
+#else /* !CONFIG_PROC_FS */
 
-} xnpnode_t;
+#define DEFINE_XNPTREE(__var, __name);
 
-#else /* !CONFIG_PROC_FS */
+/* Placeholders. */
 
-typedef struct xnpnode { /* Placeholder. */
+struct xnpnode {
+   const char *dirname;
+};
 
-const char *type;
+struct xnpnode_file {
+   struct xnpnode node;
+};
 
-} xnpnode_t;
+struct xnpnode_link {
+   struct xnpnode node;
+};
 
 #endif /* !CONFIG_PROC_FS */
 
@@ -114,26 +134,7 @@ extern struct xnobject *registry_obj_slots;
 
 /* Public interface. */
 
-int xnregistry_enter(const char *key,
-void *objaddr,
-xnhandle_t *phandle,
-xnpnode_t *pnode);
-
-int xnregistry_bind(const char *key,
-   xnticks_t timeout,
-   int timeout_mode,
-   xnhandle_t *phandle);
-
-int xnregistry_remove(xnhandle_t handle);
-
-int 

[Xenomai-git] Philippe Gerum : nucleus/pod: convert to vfile

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: b0b29d848ed8eae6ab98db71b88e07d65ef07091
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=b0b29d848ed8eae6ab98db71b88e07d65ef07091

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun  9 18:36:17 2010 +0200

nucleus/pod: convert to vfile

---

 ksrc/nucleus/pod.c |  135 ---
 1 files changed, 53 insertions(+), 82 deletions(-)

diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index 7e8a3b7..4f6060d 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -3094,16 +3094,13 @@ EXPORT_SYMBOL_GPL(xnpod_set_thread_tslice);
 
 #if XENO_DEBUG(XNLOCK)
 
-xnlockinfo_t xnlock_stats[RTHAL_NR_CPUS];
+xnlockinfo_t xnlock_stats[XNARCH_NR_CPUS];
+EXPORT_SYMBOL_GPL(xnlock_stats);
 
-static int lock_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
+static int lock_vfile_show(struct xnvfile_regular_iterator *it, void *data)
 {
xnlockinfo_t lockinfo;
-   int cpu, len = 0;
-   char *p = page;
-   spl_t s;
+   int cpu;
 
for_each_online_cpu(cpu) {
 
@@ -3112,11 +3109,11 @@ static int lock_read_proc(char *page,
xnlock_put_irqrestore(nklock, s);
 
if (cpu  0)
-   p += sprintf(p, \n);
+   xnvfile_printf(it, \n);
 
-   p += sprintf(p, CPU%d:\n, cpu);
+   xnvfile_printf(it, CPU%d:\n, cpu);
 
-   p += sprintf(p,
+   xnvfile_printf(it,
   longest locked section: %llu ns\n
   spinning time: %llu ns\n
   section entry: %s:%d (%s)\n,
@@ -3125,84 +3122,64 @@ static int lock_read_proc(char *page,
 lockinfo.file, lockinfo.line, lockinfo.function);
}
 
-   len = p - page - off;
+   return 0;
+}
 
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+static struct xnvfile_regular_ops lock_vfile_ops = {
+   .show = lock_vfile_show,
+};
 
-   return len;
-}
-EXPORT_SYMBOL_GPL(xnlock_stats);
+static struct xnvfile_regular lock_vfile = {
+   .ops = lock_vfile_ops,
+};
 
 #endif /* XENO_DEBUG(XNLOCK) */
 
-static int latency_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
+static int latency_vfile_show(struct xnvfile_regular_iterator *it, void *data)
 {
-   int len;
-
-   len = sprintf(page, %Lu\n, xnarch_tsc_to_ns(nklatency));
-   len -= off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
-
-   return len;
+   xnvfile_printf(it, %Lu\n, xnarch_tsc_to_ns(nklatency));
+
+   return 0;
 }
 
-static int latency_write_proc(struct file *file,
- const char __user * buffer,
- unsigned long count, void *data)
+static ssize_t latency_vfile_store(struct xnvfile_input *input)
 {
-   char *end, buf[16];
-   long ns;
-   int n;
-
-   n = count  sizeof(buf) - 1 ? sizeof(buf) - 1 : count;
+   long val;
+   int ret;
 
-   if (copy_from_user(buf, buffer, n))
-   return -EFAULT;
+   ret = xnvfile_get_integer(input, val);
+   if (ret)
+   return ret;
 
-   buf[n] = '\0';
-   ns = simple_strtol(buf, end, 0);
+   nklatency = xnarch_ns_to_tsc(val);
 
-   if ((*end != '\0'  !isspace(*end)) || ns  0)
-   return -EINVAL;
+   return 0;
+}
 
-   nklatency = xnarch_ns_to_tsc(ns);
+static struct xnvfile_regular_ops latency_vfile_ops = {
+   .show = latency_vfile_show,
+   .store = latency_vfile_store,
+};
 
-   return count;
-}
+static struct xnvfile_regular latency_vfile = {
+   .ops = latency_vfile_ops,
+};
 
-static int version_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
+static int version_vfile_show(struct xnvfile_regular_iterator *it, void *data)
 {
-   int len;
-
-   len = sprintf(page, %s\n, XENO_VERSION_STRING);
-   len -= off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
-
-   return len;
+   xnvfile_printf(it, %s\n, XENO_VERSION_STRING);
+
+   return 0;
 }
 
+static struct xnvfile_regular_ops version_vfile_ops = {
+   .show = version_vfile_show,
+};
+
+static struct xnvfile_regular version_vfile = {
+   .ops = version_vfile_ops,
+};
+
 int xnpod_init_proc(void)
 {
int ret;

[Xenomai-git] Philippe Gerum : native: convert to vfile

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: c9826b8a23b699addf8d156e9e7a73247592fbec
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=c9826b8a23b699addf8d156e9e7a73247592fbec

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Apr 29 18:22:32 2010 +0200

native: convert to vfile

---

 ksrc/nucleus/heap.c|2 +-
 ksrc/skins/native/alarm.c  |  146 ---
 ksrc/skins/native/buffer.c |  181 +---
 ksrc/skins/native/cond.c   |  127 +--
 ksrc/skins/native/event.c  |  153 +
 ksrc/skins/native/heap.c   |  159 ++
 ksrc/skins/native/intr.c   |  156 +-
 ksrc/skins/native/module.c |9 +--
 ksrc/skins/native/mutex.c  |  166 +++-
 ksrc/skins/native/pipe.c   |   40 ++
 ksrc/skins/native/queue.c  |  158 +++---
 ksrc/skins/native/sem.c|  148 +---
 12 files changed, 972 insertions(+), 473 deletions(-)

diff --git a/ksrc/nucleus/heap.c b/ksrc/nucleus/heap.c
index def742b..24d963d 100644
--- a/ksrc/nucleus/heap.c
+++ b/ksrc/nucleus/heap.c
@@ -159,7 +159,7 @@ static int vfile_show(struct xnvfile_snapshot_iterator *it, 
void *data)
   p-usable_mem,
   p-used_mem,
   p-page_size,
-  sizeof(p-label),
+  (int)sizeof(p-label),
   p-label);
return 0;
 }
diff --git a/ksrc/skins/native/alarm.c b/ksrc/skins/native/alarm.c
index 1130dfb..76bce0d 100644
--- a/ksrc/skins/native/alarm.c
+++ b/ksrc/skins/native/alarm.c
@@ -45,67 +45,119 @@
 
 #ifdef CONFIG_PROC_FS
 
-static int __alarm_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
+struct vfile_priv {
+   int nrdata;
+   struct xnpholder *curr;
+   RTIME interval;
+   unsigned long expiries;
+};
+
+struct vfile_data {
+   char name[XNOBJECT_NAME_LEN];
+};
+
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
 {
-   RT_ALARM *alarm = (RT_ALARM *)data;
-   char *p = page;
-   int len;
-   spl_t s;
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   RT_ALARM *alarm = xnvfile_priv(it-vfile);
 
-   xnlock_get_irqsave(nklock, s);
+   alarm = xeno_h2obj_validate(alarm, XENO_ALARM_MAGIC, RT_ALARM);
+   if (alarm == NULL)
+   return -EIDRM;
 
-   p += sprintf(p, interval=%Lu:expiries=%lu\n,
-rt_timer_tsc2ns(xntimer_interval(alarm-timer_base)),
-alarm-expiries);
+   priv-nrdata = xnsynch_nsleepers(alarm-synch_base);
+   priv-curr = getheadpq(xnsynch_wait_queue(alarm-synch_base));
+   priv-interval = rt_timer_tsc2ns(xntimer_interval(alarm-timer_base));
+   priv-expiries = alarm-expiries;
 
-#ifdef CONFIG_XENO_OPT_PERVASIVE
-   {
-   xnpholder_t *holder =
-   getheadpq(xnsynch_wait_queue(alarm-synch_base));
-
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, +%s\n, xnthread_name(sleeper));
-   holder =
-   nextpq(xnsynch_wait_queue(alarm-synch_base),
-  holder);
-   }
-   }
-#endif /* CONFIG_XENO_OPT_PERVASIVE */
+   return 0;
+}
 
-   xnlock_put_irqrestore(nklock, s);
+static void *vfile_begin(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
 
-   len = (p - page) - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+   if (priv-nrdata == 0)
+   /* No output beside the header. */
+   return VFILE_SEQ_EMPTY;
 
-   return len;
+   return kmalloc(priv-nrdata * sizeof(struct vfile_data),
+  GFP_KERNEL);
 }
 
-extern xnptree_t __native_ptree;
+static void vfile_end(struct xnvfile_snapshot_iterator *it, void *buf)
+{
+   kfree(buf);
+}
 
-static xnpnode_t __alarm_pnode = {
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   RT_ALARM *alarm = xnvfile_priv(it-vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+
+   if (priv-curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv-curr, plink);
+   priv-curr = 

[Xenomai-git] Philippe Gerum : uitron: convert to vfile

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 5bc6830b08b2484a14539332272ab76cbcfdb634
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=5bc6830b08b2484a14539332272ab76cbcfdb634

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Jun  1 16:47:00 2010 +0200

uitron: convert to vfile

---

 ksrc/skins/uitron/flag.c   |  142 +++-
 ksrc/skins/uitron/mbx.c|  138 +-
 ksrc/skins/uitron/module.c |9 +---
 ksrc/skins/uitron/sem.c|  137 +-
 4 files changed, 291 insertions(+), 135 deletions(-)

diff --git a/ksrc/skins/uitron/flag.c b/ksrc/skins/uitron/flag.c
index c7f3c0d..5538ec9 100644
--- a/ksrc/skins/uitron/flag.c
+++ b/ksrc/skins/uitron/flag.c
@@ -25,65 +25,123 @@ static xnmap_t *ui_flag_idmap;
 
 #ifdef CONFIG_PROC_FS
 
-static int __flag_read_proc(char *page,
-   char **start,
-   off_t off, int count, int *eof, void *data)
+struct vfile_priv {
+   int nrdata;
+   struct xnpholder *curr;
+   unsigned long value;
+};
+
+struct vfile_data {
+   UINT wfmode;
+   UINT waiptn;
+   char name[XNOBJECT_NAME_LEN];
+};
+
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
 {
-   uiflag_t *flag = (uiflag_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   struct uiflag *flag = xnvfile_priv(it-vfile);
 
-   xnlock_get_irqsave(nklock, s);
+   priv-nrdata = xnsynch_nsleepers(flag-synchbase);
+   priv-curr = getheadpq(xnsynch_wait_queue(flag-synchbase));
+   priv-value = flag-flgvalue;
 
-   p += sprintf(p, =0x%x, attr=%s\n, flag-flgvalue,
-flag-flgatr  TA_WMUL ? TA_WMUL : TA_WSGL);
+   return 0;
+}
 
-   if (xnsynch_nsleepers(flag-synchbase)  0) {
-   xnpholder_t *holder;
+static void *vfile_begin(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
 
-   /* Pended flag -- dump waiters. */
+   if (priv-nrdata == 0)
+   /* No output beside the header. */
+   return VFILE_SEQ_EMPTY;
 
-   holder = getheadpq(xnsynch_wait_queue(flag-synchbase));
+   return kmalloc(priv-nrdata * sizeof(struct vfile_data),
+  GFP_KERNEL);
+}
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, +%s\n, xnthread_name(sleeper));
-   holder = nextpq(xnsynch_wait_queue(flag-synchbase), 
holder);
-   }
-   }
+static void vfile_end(struct xnvfile_snapshot_iterator *it, void *buf)
+{
+   kfree(buf);
+}
 
-   xnlock_put_irqrestore(nklock, s);
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   struct uiflag *flag = xnvfile_priv(it-vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+   struct uitask *task;
+
+   priv-value = flag-flgvalue; /* Refresh as we collect. */
 
-   len = (p - page) - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+   if (priv-curr == NULL)
+   return 0;   /* We are done. */
 
-   return len;
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv-curr, plink);
+   priv-curr = nextpq(xnsynch_wait_queue(flag-synchbase),
+   priv-curr);
+
+   /* Collect thread name to be output in -show(). */
+   strncpy(p-name, xnthread_name(thread), sizeof(p-name));
+   task = thread2uitask(thread);
+   p-wfmode = task-wargs.flag.wfmode;
+   p-waiptn = task-wargs.flag.waiptn;
+
+   return 1;
 }
 
-extern xnptree_t __uitron_ptree;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   /* Always dump current event mask value. */
+   xnvfile_printf(it, =0x%lx\n, priv-value);
+   if (priv-nrdata  0)
+   xnvfile_printf(it, \n%10s  %4s  %s\n,
+  WAITPN, WFMODE, WAITER);
+   } else
+   xnvfile_printf(it, 0x%-8x  %4s  %.*s\n,
+  p-waiptn,
+  p-wfmode  TWF_ORW ? OR : AND,
+  (int)sizeof(p-name), p-name);
 
-static xnpnode_t __flag_pnode = {
+   return 0;
+}
 
-   .dir = NULL,
-   .type = flags,
-   .entries = 0,
-   .read_proc = 

[Xenomai-git] Philippe Gerum : vxworks: convert to vfile

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: c63f1afa062690b678eaeb552fe9206003e83b04
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=c63f1afa062690b678eaeb552fe9206003e83b04

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Jun  6 19:06:33 2010 +0200

vxworks: convert to vfile

---

 ksrc/skins/vxworks/module.c  |9 +--
 ksrc/skins/vxworks/msgQLib.c |  148 +
 ksrc/skins/vxworks/semLib.c  |  166 +-
 ksrc/skins/vxworks/wdLib.c   |  142 +---
 4 files changed, 315 insertions(+), 150 deletions(-)

diff --git a/ksrc/skins/vxworks/module.c b/ksrc/skins/vxworks/module.c
index 830df76..632f5d2 100644
--- a/ksrc/skins/vxworks/module.c
+++ b/ksrc/skins/vxworks/module.c
@@ -39,14 +39,7 @@ xntbase_t *wind_tbase;
 
 wind_rholder_t __wind_global_rholder;
 
-#ifdef CONFIG_PROC_FS
-xnptree_t __vxworks_ptree = {
-
-   .dir = NULL,
-   .name = vxworks,
-   .entries = 0,
-};
-#endif /* CONFIG_PROC_FS */
+DEFINE_XNPTREE(__vxworks_ptree, vxworks);
 
 int SKIN_INIT(vxworks)
 {
diff --git a/ksrc/skins/vxworks/msgQLib.c b/ksrc/skins/vxworks/msgQLib.c
index 0acb574..a522c09 100644
--- a/ksrc/skins/vxworks/msgQLib.c
+++ b/ksrc/skins/vxworks/msgQLib.c
@@ -24,69 +24,123 @@ static int msgq_destroy_internal(wind_msgq_t *queue);
 
 #ifdef CONFIG_PROC_FS
 
-static int msgq_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
-{
-   wind_msgq_t *queue = (wind_msgq_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
+struct vfile_priv {
+   int nrdata;
+   struct xnpholder *curr;
+   int flags;
+   unsigned int mlength;
+   int mcount;
+};
 
-   p += sprintf(p, porder=%s:mlength=%u:mcount=%d\n,
-xnsynch_test_flags(queue-synchbase,
-   XNSYNCH_PRIO) ? prio : fifo,
-queue-msg_length, countq(queue-msgq));
+struct vfile_data {
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   xnlock_get_irqsave(nklock, s);
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   wind_msgq_t *q = xnvfile_priv(it-vfile);
 
-   if (xnsynch_nsleepers(queue-synchbase)  0) {
-   xnpholder_t *holder;
+   q = wind_h2obj_active((MSG_Q_ID)q, WIND_MSGQ_MAGIC, wind_msgq_t);
+   if (q == NULL)
+   return -EIDRM;
 
-   /* Pended queue -- dump waiters. */
+   priv-nrdata = xnsynch_nsleepers(q-synchbase);
+   priv-curr = getheadpq(xnsynch_wait_queue(q-synchbase));
+   priv-flags = xnsynch_test_flags(q-synchbase, XNSYNCH_PRIO);
+   priv-mlength = q-msg_length;
+   priv-mcount = countq(q-msgq);
 
-   holder = getheadpq(xnsynch_wait_queue(queue-synchbase));
+   return 0;
+}
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, +%s\n, xnthread_name(sleeper));
-   holder =
-   nextpq(xnsynch_wait_queue(queue-synchbase),
-  holder);
-   }
-   }
+static void *vfile_begin(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
 
-   xnlock_put_irqrestore(nklock, s);
+   if (priv-nrdata == 0)
+   /* No output beside the header. */
+   return VFILE_SEQ_EMPTY;
+
+   return kmalloc(priv-nrdata * sizeof(struct vfile_data),
+  GFP_KERNEL);
+}
 
-   len = (p - page) - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+static void vfile_end(struct xnvfile_snapshot_iterator *it, void *buf)
+{
+   kfree(buf);
+}
 
-   return len;
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   wind_msgq_t *q = xnvfile_priv(it-vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+
+   if (priv-curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv-curr, plink);
+   priv-curr = nextpq(xnsynch_wait_queue(q-synchbase),
+   priv-curr);
+   /* Collect thread name to be output in -show(). */
+   strncpy(p-name, xnthread_name(thread), sizeof(p-name));
+
+   return 1;
 }
 
-extern xnptree_t __vxworks_ptree;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if 

[Xenomai-git] Philippe Gerum : psos: convert to vfile

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: b68692eb289fc4d24b78d2fcb23ec9373dcb1757
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=b68692eb289fc4d24b78d2fcb23ec9373dcb1757

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Jun  7 19:41:23 2010 +0200

psos: convert to vfile

---

 ksrc/skins/psos+/module.c |9 +---
 ksrc/skins/psos+/queue.c  |  146 +++--
 ksrc/skins/psos+/rn.c |  141 ++-
 ksrc/skins/psos+/sem.c|  136 +-
 4 files changed, 294 insertions(+), 138 deletions(-)

diff --git a/ksrc/skins/psos+/module.c b/ksrc/skins/psos+/module.c
index bdba58b..33ac213 100644
--- a/ksrc/skins/psos+/module.c
+++ b/ksrc/skins/psos+/module.c
@@ -52,14 +52,7 @@ xntbase_t *psos_tbase;
 
 psos_rholder_t __psos_global_rholder;
 
-#ifdef CONFIG_PROC_FS
-xnptree_t __psos_ptree = {
-
-   .dir = NULL,
-   .name = psos,
-   .entries = 0,
-};
-#endif /* CONFIG_PROC_FS */
+DEFINE_XNPTREE(__psos_ptree, psos);
 
 void k_fatal(u_long err_code, u_long flags)
 {
diff --git a/ksrc/skins/psos+/queue.c b/ksrc/skins/psos+/queue.c
index 703ca3b..1389b6d 100644
--- a/ksrc/skins/psos+/queue.c
+++ b/ksrc/skins/psos+/queue.c
@@ -31,67 +31,123 @@ static u_long q_destroy_internal(psosqueue_t *queue);
 
 #ifdef CONFIG_PROC_FS
 
-static int msgq_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
-{
-   psosqueue_t *queue = (psosqueue_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
+struct vfile_priv {
+   int nrdata;
+   struct xnpholder *curr;
+   unsigned long maxnum;
+   unsigned long maxlen;
+   int msgcount;
+};
 
-   p += sprintf(p, maxnum=%lu:maxlen=%lu:mcount=%d\n,
-queue-maxnum, queue-maxlen, countq(queue-inq));
+struct vfile_data {
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   xnlock_get_irqsave(nklock, s);
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   psosqueue_t *queue = xnvfile_priv(it-vfile);
 
-   if (xnsynch_nsleepers(queue-synchbase)  0) {
-   xnpholder_t *holder;
+   queue = psos_h2obj_active((u_long)queue, PSOS_QUEUE_MAGIC, psosqueue_t);
+   if (queue == NULL)
+   return -EIDRM;
 
-   /* Pended queue -- dump waiters. */
+   priv-nrdata = xnsynch_nsleepers(queue-synchbase);
+   priv-curr = getheadpq(xnsynch_wait_queue(queue-synchbase));
+   priv-maxnum = queue-maxnum;
+   priv-maxlen = queue-maxlen;
+   priv-msgcount = countq(queue-inq);
 
-   holder = getheadpq(xnsynch_wait_queue(queue-synchbase));
+   return 0;
+}
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, +%s\n, xnthread_name(sleeper));
-   holder =
-   nextpq(xnsynch_wait_queue(queue-synchbase),
-  holder);
-   }
-   }
+static void *vfile_begin(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
 
-   xnlock_put_irqrestore(nklock, s);
+   if (priv-nrdata == 0)
+   /* No output beside the header. */
+   return VFILE_SEQ_EMPTY;
 
-   len = (p - page) - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+   return kmalloc(priv-nrdata * sizeof(struct vfile_data),
+  GFP_KERNEL);
+}
 
-   return len;
+static void vfile_end(struct xnvfile_snapshot_iterator *it, void *buf)
+{
+   kfree(buf);
 }
 
-extern xnptree_t __psos_ptree;
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   psosqueue_t *queue = xnvfile_priv(it-vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+
+   if (priv-curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv-curr, plink);
+   priv-curr = nextpq(xnsynch_wait_queue(queue-synchbase),
+   priv-curr);
+   /* Collect thread name to be output in -show(). */
+   strncpy(p-name, xnthread_name(thread), sizeof(p-name));
+
+   return 1;
+}
 
-static xnpnode_t msgq_pnode = {
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   xnvfile_printf(it, 
+

[Xenomai-git] Philippe Gerum : vrtx: convert to vfile

2010-06-09 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 4aa261c7a22e73e76a6138772af1d7e7f06ce146
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=4aa261c7a22e73e76a6138772af1d7e7f06ce146

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Jun  8 08:43:19 2010 +0200

vrtx: convert to vfile

---

 ksrc/skins/vrtx/event.c  |  149 +++---
 ksrc/skins/vrtx/heap.c   |   75 +--
 ksrc/skins/vrtx/mb.c |  132 +++-
 ksrc/skins/vrtx/module.c |9 +---
 ksrc/skins/vrtx/mx.c |  146 ++---
 ksrc/skins/vrtx/pt.c |   77 ++--
 ksrc/skins/vrtx/queue.c  |  134 -
 ksrc/skins/vrtx/sem.c|  131 +++-
 8 files changed, 557 insertions(+), 296 deletions(-)

diff --git a/ksrc/skins/vrtx/event.c b/ksrc/skins/vrtx/event.c
index d0d30ec..6d5285f 100644
--- a/ksrc/skins/vrtx/event.c
+++ b/ksrc/skins/vrtx/event.c
@@ -27,72 +27,123 @@ static xnqueue_t vrtx_event_q;
 
 #ifdef CONFIG_PROC_FS
 
-static int __event_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
+struct vfile_priv {
+   int nrdata;
+   struct xnpholder *curr;
+   int value;
+};
+
+struct vfile_data {
+   int opt;
+   int mask;
+   char name[XNOBJECT_NAME_LEN];
+};
+
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
 {
-   vrtxevent_t *evgroup = (vrtxevent_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   struct vrtxevent *evgroup = xnvfile_priv(it-vfile);
 
-   xnlock_get_irqsave(nklock, s);
+   priv-nrdata = xnsynch_nsleepers(evgroup-synchbase);
+   priv-curr = getheadpq(xnsynch_wait_queue(evgroup-synchbase));
+   priv-value = evgroup-events;
 
-   p += sprintf(p, =0x%x\n, evgroup-events);
+   return 0;
+}
 
-   if (xnsynch_nsleepers(evgroup-synchbase)  0) {
-   xnpholder_t *holder;
+static void *vfile_begin(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
 
-   /* Pended event -- dump waiters. */
+   if (priv-nrdata == 0)
+   /* No output beside the header. */
+   return VFILE_SEQ_EMPTY;
 
-   holder = getheadpq(xnsynch_wait_queue(evgroup-synchbase));
+   return kmalloc(priv-nrdata * sizeof(struct vfile_data),
+  GFP_KERNEL);
+}
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   vrtxtask_t *task = thread2vrtxtask(sleeper);
-   const char *mode =
-   (task-waitargs.evgroup.
-opt  1) ? all : any;
-   int mask = task-waitargs.evgroup.mask;
-   p += sprintf(p, +%s (mask=0x%x, %s)\n,
-xnthread_name(sleeper), mask, mode);
-   holder =
-   nextpq(xnsynch_wait_queue(evgroup-synchbase),
-  holder);
-   }
-   }
+static void vfile_end(struct xnvfile_snapshot_iterator *it, void *buf)
+{
+   kfree(buf);
+}
 
-   xnlock_put_irqrestore(nklock, s);
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   struct vrtxevent *evgroup = xnvfile_priv(it-vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+   struct vrtxtask *task;
+
+   priv-value = evgroup-events; /* Refresh as we collect. */
+
+   if (priv-curr == NULL)
+   return 0;   /* We are done. */
 
-   len = (p - page) - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv-curr, plink);
+   priv-curr = nextpq(xnsynch_wait_queue(evgroup-synchbase),
+   priv-curr);
 
-   return len;
+   /* Collect thread name to be output in -show(). */
+   strncpy(p-name, xnthread_name(thread), sizeof(p-name));
+   task = thread2vrtxtask(thread);
+   p-opt = task-waitargs.evgroup.opt;
+   p-mask = task-waitargs.evgroup.mask;
+
+   return 1;
 }
 
-extern xnptree_t __vrtx_ptree;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_snapshot_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   /* Always dump current event