[Xenomai-git] Philippe Gerum : cobalt/kernel: drop "sys" features file

2013-08-10 Thread git repository hosting
Module: xenomai-forge
Branch: master
Commit: 2cc8900f6217dfb1d8c0b4934cc89129dfcff5b1
URL:
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=2cc8900f6217dfb1d8c0b4934cc89129dfcff5b1

Author: Philippe Gerum 
Date:   Wed Aug  7 16:40:26 2013 +0200

cobalt/kernel: drop "sys" features file

This file used to be a kitchen sink although its contents could be
dispatched to better feature-specific places. Move them there instead,
and plug that sink.

---

 include/cobalt/kernel/Makefile.am   |1 -
 include/cobalt/kernel/Makefile.in   |1 -
 include/cobalt/kernel/sched.h   |   25 
 include/cobalt/kernel/shadow.h  |   19 +++-
 include/cobalt/kernel/sys.h |   83 ---
 kernel/cobalt/Makefile  |1 -
 kernel/cobalt/init.c|  177 +++-
 kernel/cobalt/intr.c|2 +-
 kernel/cobalt/rtdm/internal.h   |6 +-
 kernel/cobalt/sched.c   |6 +-
 kernel/cobalt/shadow.c  |8 +-
 kernel/cobalt/sys.c |  259 ---
 kernel/cobalt/thread.c  |1 -
 kernel/drivers/testing/switchtest.c |1 -
 14 files changed, 230 insertions(+), 360 deletions(-)

diff --git a/include/cobalt/kernel/Makefile.am 
b/include/cobalt/kernel/Makefile.am
index 65824ba..e1653da 100644
--- a/include/cobalt/kernel/Makefile.am
+++ b/include/cobalt/kernel/Makefile.am
@@ -26,7 +26,6 @@ noinst_HEADERS =  \
shadow.h\
stat.h  \
synch.h \
-   sys.h   \
thread.h\
timer.h \
trace.h \
diff --git a/include/cobalt/kernel/Makefile.in 
b/include/cobalt/kernel/Makefile.in
index e9d3ed0..e0ed379 100644
--- a/include/cobalt/kernel/Makefile.in
+++ b/include/cobalt/kernel/Makefile.in
@@ -272,7 +272,6 @@ noinst_HEADERS = \
shadow.h\
stat.h  \
synch.h \
-   sys.h   \
thread.h\
timer.h \
trace.h \
diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h
index e6751c4..2606b6c 100644
--- a/include/cobalt/kernel/sched.h
+++ b/include/cobalt/kernel/sched.h
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Sched status flags */
 #define XNRESCHED  0x1000  /* Needs rescheduling */
@@ -112,6 +113,8 @@ struct xnsched {
 
 DECLARE_PER_CPU(struct xnsched, nksched);
 
+extern cpumask_t nkaffinity;
+
 extern struct list_head nkthreadq;
 
 extern int nknrthreads;
@@ -200,6 +203,7 @@ static inline void xnsched_set_self_resched(struct xnsched 
*sched)
 
 /* Set resched flag for the given scheduler. */
 #ifdef CONFIG_SMP
+
 static inline void xnsched_set_resched(struct xnsched *sched)
 {
struct xnsched *current_sched = xnsched_current();
@@ -212,13 +216,34 @@ static inline void xnsched_set_resched(struct xnsched 
*sched)
current_sched->status |= XNRESCHED;
}
 }
+
+#define xnsched_cpus xnarch_machdata.supported_cpus
+
+static inline int xnsched_supported_cpu(int cpu)
+{
+   return cpu_isset(cpu, xnsched_cpus);
+}
+
 #else /* !CONFIG_SMP */
+
 static inline void xnsched_set_resched(struct xnsched *sched)
 {
xnsched_set_self_resched(sched);
 }
+
+#define xnsched_cpus CPU_MASK_ALL
+
+static inline int xnsched_supported_cpu(int cpu)
+{
+   return 1;
+}
+
 #endif /* !CONFIG_SMP */
 
+#define for_each_realtime_cpu(cpu) \
+   for_each_online_cpu(cpu)\
+   if (xnsched_supported_cpu(cpu)) \
+
 void __xnsched_run(struct xnsched *sched);
 
 void __xnsched_run_handler(void);
diff --git a/include/cobalt/kernel/shadow.h b/include/cobalt/kernel/shadow.h
index 6d3a90f..8f5b4cb 100644
--- a/include/cobalt/kernel/shadow.h
+++ b/include/cobalt/kernel/shadow.h
@@ -20,7 +20,6 @@
 #ifndef _COBALT_KERNEL_SHADOW_H
 #define _COBALT_KERNEL_SHADOW_H
 
-#include 
 #include 
 
 struct xnthread;
@@ -32,6 +31,22 @@ struct completion;
 struct module;
 struct xnshadow_ppd;
 
+struct xnpersonality {
+   const char *name;
+   unsigned int magic;
+   int nrcalls;
+   struct xnsyscall *syscalls;
+   atomic_t refcnt;
+   struct {
+   struct xnshadow_ppd *(*attach_process)(void);
+   void (*detach_process)(struct xnshadow_ppd *ppd);
+   struct xnpersonality *(*map_thread)(struct xnthread *thread);
+   struct xnpersonality *(*exit_thread)(struct xnthread *thread);
+   struct xnpersonality *(*finalize_thread)(struct xnthread 
*thread);
+   } ops;
+   struct module *module;
+};
+
 static inline struct xnthread *xnshadow_current(void)
 {
return ipipe_current_threadinfo()->thread;
@@ -107,4 +122,6 @@ xnshadow_push_personality(struct xnthread *thread,
 void xnshadow_pop_personality(struct xnthread *thread,
  struct xnpersonality *prev);
 
+extern struct xnpersonalit

[Xenomai-git] Philippe Gerum : cobalt/kernel: drop "sys" features file

2013-08-10 Thread git repository hosting
Module: xenomai-forge
Branch: next
Commit: 2cc8900f6217dfb1d8c0b4934cc89129dfcff5b1
URL:
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=2cc8900f6217dfb1d8c0b4934cc89129dfcff5b1

Author: Philippe Gerum 
Date:   Wed Aug  7 16:40:26 2013 +0200

cobalt/kernel: drop "sys" features file

This file used to be a kitchen sink although its contents could be
dispatched to better feature-specific places. Move them there instead,
and plug that sink.

---

 include/cobalt/kernel/Makefile.am   |1 -
 include/cobalt/kernel/Makefile.in   |1 -
 include/cobalt/kernel/sched.h   |   25 
 include/cobalt/kernel/shadow.h  |   19 +++-
 include/cobalt/kernel/sys.h |   83 ---
 kernel/cobalt/Makefile  |1 -
 kernel/cobalt/init.c|  177 +++-
 kernel/cobalt/intr.c|2 +-
 kernel/cobalt/rtdm/internal.h   |6 +-
 kernel/cobalt/sched.c   |6 +-
 kernel/cobalt/shadow.c  |8 +-
 kernel/cobalt/sys.c |  259 ---
 kernel/cobalt/thread.c  |1 -
 kernel/drivers/testing/switchtest.c |1 -
 14 files changed, 230 insertions(+), 360 deletions(-)

diff --git a/include/cobalt/kernel/Makefile.am 
b/include/cobalt/kernel/Makefile.am
index 65824ba..e1653da 100644
--- a/include/cobalt/kernel/Makefile.am
+++ b/include/cobalt/kernel/Makefile.am
@@ -26,7 +26,6 @@ noinst_HEADERS =  \
shadow.h\
stat.h  \
synch.h \
-   sys.h   \
thread.h\
timer.h \
trace.h \
diff --git a/include/cobalt/kernel/Makefile.in 
b/include/cobalt/kernel/Makefile.in
index e9d3ed0..e0ed379 100644
--- a/include/cobalt/kernel/Makefile.in
+++ b/include/cobalt/kernel/Makefile.in
@@ -272,7 +272,6 @@ noinst_HEADERS = \
shadow.h\
stat.h  \
synch.h \
-   sys.h   \
thread.h\
timer.h \
trace.h \
diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h
index e6751c4..2606b6c 100644
--- a/include/cobalt/kernel/sched.h
+++ b/include/cobalt/kernel/sched.h
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Sched status flags */
 #define XNRESCHED  0x1000  /* Needs rescheduling */
@@ -112,6 +113,8 @@ struct xnsched {
 
 DECLARE_PER_CPU(struct xnsched, nksched);
 
+extern cpumask_t nkaffinity;
+
 extern struct list_head nkthreadq;
 
 extern int nknrthreads;
@@ -200,6 +203,7 @@ static inline void xnsched_set_self_resched(struct xnsched 
*sched)
 
 /* Set resched flag for the given scheduler. */
 #ifdef CONFIG_SMP
+
 static inline void xnsched_set_resched(struct xnsched *sched)
 {
struct xnsched *current_sched = xnsched_current();
@@ -212,13 +216,34 @@ static inline void xnsched_set_resched(struct xnsched 
*sched)
current_sched->status |= XNRESCHED;
}
 }
+
+#define xnsched_cpus xnarch_machdata.supported_cpus
+
+static inline int xnsched_supported_cpu(int cpu)
+{
+   return cpu_isset(cpu, xnsched_cpus);
+}
+
 #else /* !CONFIG_SMP */
+
 static inline void xnsched_set_resched(struct xnsched *sched)
 {
xnsched_set_self_resched(sched);
 }
+
+#define xnsched_cpus CPU_MASK_ALL
+
+static inline int xnsched_supported_cpu(int cpu)
+{
+   return 1;
+}
+
 #endif /* !CONFIG_SMP */
 
+#define for_each_realtime_cpu(cpu) \
+   for_each_online_cpu(cpu)\
+   if (xnsched_supported_cpu(cpu)) \
+
 void __xnsched_run(struct xnsched *sched);
 
 void __xnsched_run_handler(void);
diff --git a/include/cobalt/kernel/shadow.h b/include/cobalt/kernel/shadow.h
index 6d3a90f..8f5b4cb 100644
--- a/include/cobalt/kernel/shadow.h
+++ b/include/cobalt/kernel/shadow.h
@@ -20,7 +20,6 @@
 #ifndef _COBALT_KERNEL_SHADOW_H
 #define _COBALT_KERNEL_SHADOW_H
 
-#include 
 #include 
 
 struct xnthread;
@@ -32,6 +31,22 @@ struct completion;
 struct module;
 struct xnshadow_ppd;
 
+struct xnpersonality {
+   const char *name;
+   unsigned int magic;
+   int nrcalls;
+   struct xnsyscall *syscalls;
+   atomic_t refcnt;
+   struct {
+   struct xnshadow_ppd *(*attach_process)(void);
+   void (*detach_process)(struct xnshadow_ppd *ppd);
+   struct xnpersonality *(*map_thread)(struct xnthread *thread);
+   struct xnpersonality *(*exit_thread)(struct xnthread *thread);
+   struct xnpersonality *(*finalize_thread)(struct xnthread 
*thread);
+   } ops;
+   struct module *module;
+};
+
 static inline struct xnthread *xnshadow_current(void)
 {
return ipipe_current_threadinfo()->thread;
@@ -107,4 +122,6 @@ xnshadow_push_personality(struct xnthread *thread,
 void xnshadow_pop_personality(struct xnthread *thread,
  struct xnpersonality *prev);
 
+extern struct xnpersonality