Module: xenomai-forge
Branch: rtdm-api-waitqueues
Commit: a6ecec5367449107f5b1fd6ec81303be3b44c468
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=a6ecec5367449107f5b1fd6ec81303be3b44c468

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Apr 15 17:53:36 2014 +0200

cobalt/thread: drop typedefs for non-opaque aggregates

---

 include/cobalt/kernel/rtdm/driver.h |    2 +-
 include/cobalt/kernel/thread.h      |    5 ++---
 kernel/cobalt/posix/clock.c         |    2 +-
 kernel/cobalt/posix/cond.c          |    8 ++++----
 kernel/cobalt/posix/mutex.c         |    6 +++---
 kernel/cobalt/posix/select.c        |    2 +-
 kernel/cobalt/registry.c            |    2 +-
 kernel/cobalt/rtdm/drvlib.c         |    8 ++++----
 kernel/cobalt/sched.c               |    2 +-
 kernel/cobalt/select.c              |    2 +-
 kernel/cobalt/thread.c              |   28 ++++++++++++++--------------
 kernel/drivers/ipc/bufp.c           |    4 ++--
 kernel/drivers/testing/switchtest.c |    2 +-
 13 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/driver.h 
b/include/cobalt/kernel/rtdm/driver.h
index dc8f2f3..bfd3fab 100644
--- a/include/cobalt/kernel/rtdm/driver.h
+++ b/include/cobalt/kernel/rtdm/driver.h
@@ -1052,7 +1052,7 @@ static inline void 
rtdm_timer_stop_in_handler(rtdm_timer_t *timer)
  * @{
  */
 
-typedef xnthread_t rtdm_task_t;
+typedef struct xnthread rtdm_task_t;
 
 /**
  * Real-time task procedure
diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h
index dd9ee68..b28400b 100644
--- a/include/cobalt/kernel/thread.h
+++ b/include/cobalt/kernel/thread.h
@@ -60,8 +60,7 @@ struct xnthread_wait_context {
        int posted;
 };
 
-typedef struct xnthread {
-
+struct xnthread {
        struct xnarchtcb tcb;           /* Architecture-dependent block */
 
        unsigned long state;            /* Thread state flags */
@@ -174,7 +173,7 @@ typedef struct xnthread {
 #endif
        /** Exit event for joining the thread. */
        struct xnsynch join_synch;
-} xnthread_t;
+};
 
 #define xnthread_name(thread)               ((thread)->name)
 #define xnthread_clear_name(thread)        do { *(thread)->name = 0; } while(0)
diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index 8eeb6d7..12bbaad 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -245,7 +245,7 @@ int cobalt_clock_nanosleep(clockid_t clock_id, int flags,
                           struct timespec __user *u_rmt)
 {
        struct timespec rqt, rmt, *rmtp = NULL;
-       xnthread_t *cur;
+       struct xnthread *cur;
        xnsticks_t rem;
        int err = 0;
        spl_t s;
diff --git a/kernel/cobalt/posix/cond.c b/kernel/cobalt/posix/cond.c
index b68a1df..73f3971 100644
--- a/kernel/cobalt/posix/cond.c
+++ b/kernel/cobalt/posix/cond.c
@@ -252,7 +252,7 @@ static inline int pthread_cond_destroy(struct 
cobalt_cond_shadow *cnd)
        return 0;
 }
 
-static inline int cobalt_cond_timedwait_prologue(xnthread_t *cur,
+static inline int cobalt_cond_timedwait_prologue(struct xnthread *cur,
                                                 struct cobalt_cond *cond,
                                                 struct cobalt_mutex *mutex,
                                                 int timed,
@@ -329,7 +329,7 @@ static inline int cobalt_cond_timedwait_prologue(xnthread_t 
*cur,
        return err;
 }
 
-static inline int cobalt_cond_timedwait_epilogue(xnthread_t *cur,
+static inline int cobalt_cond_timedwait_epilogue(struct xnthread *cur,
                                                 struct cobalt_cond *cond,
                                                 struct cobalt_mutex *mutex)
 {
@@ -410,7 +410,7 @@ int cobalt_cond_wait_prologue(struct cobalt_cond_shadow 
__user *u_cnd,
                              unsigned int timed,
                              struct timespec __user *u_ts)
 {
-       xnthread_t *cur = xnshadow_current();
+       struct xnthread *cur = xnshadow_current();
        struct cobalt_cond *cnd;
        struct cobalt_mutex *mx;
        struct mutex_dat *datp;
@@ -473,7 +473,7 @@ int cobalt_cond_wait_prologue(struct cobalt_cond_shadow 
__user *u_cnd,
 int cobalt_cond_wait_epilogue(struct cobalt_cond_shadow __user *u_cnd,
                              struct cobalt_mutex_shadow __user *u_mx)
 {
-       xnthread_t *cur = xnshadow_current();
+       struct xnthread *cur = xnshadow_current();
        struct cobalt_cond *cnd;
        struct cobalt_mutex *mx;
        xnhandle_t handle;
diff --git a/kernel/cobalt/posix/mutex.c b/kernel/cobalt/posix/mutex.c
index 78b6a2c..11f6c78 100644
--- a/kernel/cobalt/posix/mutex.c
+++ b/kernel/cobalt/posix/mutex.c
@@ -131,7 +131,7 @@ cobalt_mutex_destroy_inner(xnhandle_t handle, struct 
cobalt_kqueues *q)
        xnfree(mutex);
 }
 
-static inline int cobalt_mutex_acquire(xnthread_t *cur,
+static inline int cobalt_mutex_acquire(struct xnthread *cur,
                                       struct cobalt_mutex *mutex,
                                       int timed,
                                       const struct timespec __user *u_ts)
@@ -216,7 +216,7 @@ static inline
 int cobalt_mutex_timedlock_break(struct cobalt_mutex *mutex,
                                 int timed, const struct timespec __user *u_ts)
 {
-       xnthread_t *cur = xnsched_current_thread();
+       struct xnthread *cur = xnsched_current_thread();
        int ret;
 
        /* We need a valid thread handle for the fast lock. */
@@ -359,7 +359,7 @@ int cobalt_mutex_destroy(struct cobalt_mutex_shadow __user 
*u_mx)
 
 int cobalt_mutex_trylock(struct cobalt_mutex_shadow __user *u_mx)
 {
-       xnthread_t *cur = xnsched_current_thread();
+       struct xnthread *cur = xnsched_current_thread();
        struct cobalt_mutex *mutex;
        xnhandle_t handle;
        spl_t s;
diff --git a/kernel/cobalt/posix/select.c b/kernel/cobalt/posix/select.c
index 6741331..e88439a 100644
--- a/kernel/cobalt/posix/select.c
+++ b/kernel/cobalt/posix/select.c
@@ -125,8 +125,8 @@ int cobalt_select(int nfds,
        xnticks_t timeout = XN_INFINITE;
        xntmode_t mode = XN_RELATIVE;
        struct xnselector *selector;
+       struct xnthread *thread;
        struct timeval tv;
-       xnthread_t *thread;
        size_t fds_size;
        int i, err;
 
diff --git a/kernel/cobalt/registry.c b/kernel/cobalt/registry.c
index 47d5451..9c84d7c 100644
--- a/kernel/cobalt/registry.c
+++ b/kernel/cobalt/registry.c
@@ -735,7 +735,7 @@ int xnregistry_bind(const char *key, xnticks_t timeout, int 
timeout_mode,
                    xnhandle_t *phandle)
 {
        struct xnobject *object;
-       xnthread_t *thread;
+       struct xnthread *thread;
        int ret = 0, info;
        spl_t s;
 
diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c
index 0ac47dd..33ca350 100644
--- a/kernel/cobalt/rtdm/drvlib.c
+++ b/kernel/cobalt/rtdm/drvlib.c
@@ -401,7 +401,7 @@ int rtdm_task_sleep_abs(nanosecs_abs_t wakeup_time, enum 
rtdm_timer_mode mode);
 
 int __rtdm_task_sleep(xnticks_t timeout, xntmode_t mode)
 {
-       xnthread_t *thread = xnsched_current_thread();
+       struct xnthread *thread = xnsched_current_thread();
 
        if (!XENO_ASSERT(RTDM, !xnsched_unblockable_p()))
                return -EPERM;
@@ -945,7 +945,7 @@ EXPORT_SYMBOL_GPL(rtdm_event_wait);
 int rtdm_event_timedwait(rtdm_event_t *event, nanosecs_rel_t timeout,
                         rtdm_toseq_t *timeout_seq)
 {
-       xnthread_t *thread;
+       struct xnthread *thread;
        spl_t s;
        int err = 0;
 
@@ -1224,7 +1224,7 @@ EXPORT_SYMBOL_GPL(rtdm_sem_down);
 int rtdm_sem_timeddown(rtdm_sem_t *sem, nanosecs_rel_t timeout,
                       rtdm_toseq_t *timeout_seq)
 {
-       xnthread_t *thread;
+       struct xnthread *thread;
        spl_t s;
        int err = 0;
 
@@ -1513,7 +1513,7 @@ EXPORT_SYMBOL_GPL(rtdm_mutex_lock);
 int rtdm_mutex_timedlock(rtdm_mutex_t *mutex, nanosecs_rel_t timeout,
                         rtdm_toseq_t *timeout_seq)
 {
-       xnthread_t *curr_thread = xnsched_current_thread();
+       struct xnthread *curr_thread = xnsched_current_thread();
        spl_t s;
        int err = 0;
 
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 47d2f13..f2aef48 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -614,7 +614,7 @@ struct xnthread *xnsched_findq(struct list_head *q, int 
prio)
 #endif /* !CONFIG_XENO_OPT_SCALABLE_SCHED */
 
 static inline void switch_context(struct xnsched *sched,
-                                 xnthread_t *prev, xnthread_t *next)
+                                 struct xnthread *prev, struct xnthread *next)
 {
 #ifdef CONFIG_XENO_HW_UNLOCKED_SWITCH
        sched->last = prev;
diff --git a/kernel/cobalt/select.c b/kernel/cobalt/select.c
index c94bfa8..d7fedc7 100644
--- a/kernel/cobalt/select.c
+++ b/kernel/cobalt/select.c
@@ -330,7 +330,7 @@ int xnselect(struct xnselector *selector,
             xnticks_t timeout, xntmode_t timeout_mode)
 {
        unsigned i, not_empty = 0;
-       xnthread_t *thread;
+       struct xnthread *thread;
        spl_t s;
 
        if ((unsigned) nfds > __FD_SETSIZE)
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index e2152ba..25cc353 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -49,7 +49,7 @@ static DECLARE_WAIT_QUEUE_HEAD(nkjoinq);
 
 static void timeout_handler(struct xntimer *timer)
 {
-       struct xnthread *thread = container_of(timer, xnthread_t, rtimer);
+       struct xnthread *thread = container_of(timer, struct xnthread, rtimer);
 
        xnthread_set_info(thread, XNTIMEO);     /* Interrupts are off. */
        xnthread_resume(thread, XNDELAY);
@@ -57,7 +57,7 @@ static void timeout_handler(struct xntimer *timer)
 
 static void periodic_handler(struct xntimer *timer)
 {
-       struct xnthread *thread = container_of(timer, xnthread_t, ptimer);
+       struct xnthread *thread = container_of(timer, struct xnthread, ptimer);
        /*
         * Prevent unwanted round-robin, and do not wake up threads
         * blocked on a resource.
@@ -304,7 +304,7 @@ char *xnthread_format_status(unsigned long status, char 
*buf, int size)
        return buf;
 }
 
-xnticks_t xnthread_get_timeout(xnthread_t *thread, xnticks_t ns)
+xnticks_t xnthread_get_timeout(struct xnthread *thread, xnticks_t ns)
 {
        struct xntimer *timer;
        xnticks_t timeout;
@@ -327,7 +327,7 @@ xnticks_t xnthread_get_timeout(xnthread_t *thread, 
xnticks_t ns)
 }
 EXPORT_SYMBOL_GPL(xnthread_get_timeout);
 
-xnticks_t xnthread_get_period(xnthread_t *thread)
+xnticks_t xnthread_get_period(struct xnthread *thread)
 {
        xnticks_t period = 0;
        /*
@@ -394,7 +394,7 @@ static inline void release_fpu(struct xnthread *thread)
 
 void xnthread_switch_fpu(struct xnsched *sched)
 {
-       xnthread_t *curr = sched->curr;
+       struct xnthread *curr = sched->curr;
 
        if (!xnthread_test_state(curr, XNFPU))
                return;
@@ -657,7 +657,7 @@ int xnthread_start(struct xnthread *thread,
 EXPORT_SYMBOL_GPL(xnthread_start);
 
 /**
- * @fn void xnthread_set_mode(xnthread_t *thread,int clrmask,int setmask)
+ * @fn void xnthread_set_mode(struct xnthread *thread,int clrmask,int setmask)
  * @brief Change a thread's control mode.
  *
  * Change the control mode of a given thread. The control mode affects
@@ -694,7 +694,7 @@ EXPORT_SYMBOL_GPL(xnthread_start);
  * @note Setting @a clrmask and @a setmask to zero leads to a nop,
  * only returning the previous mode if @a mode_r is a valid address.
  */
-int xnthread_set_mode(xnthread_t *thread, int clrmask, int setmask)
+int xnthread_set_mode(struct xnthread *thread, int clrmask, int setmask)
 {
        struct xnthread *curr = xnsched_current_thread();
        unsigned long oldmode;
@@ -735,7 +735,7 @@ int xnthread_set_mode(xnthread_t *thread, int clrmask, int 
setmask)
 EXPORT_SYMBOL_GPL(xnthread_set_mode);
 
 /**
- * @fn void xnthread_suspend(xnthread_t *thread, int mask,xnticks_t timeout, 
xntmode_t timeout_mode,struct xnsynch *wchan)
+ * @fn void xnthread_suspend(struct xnthread *thread, int mask,xnticks_t 
timeout, xntmode_t timeout_mode,struct xnsynch *wchan)
  * @brief Suspend a thread.
  *
  * Suspends the execution of a thread according to a given suspensive
@@ -792,7 +792,7 @@ EXPORT_SYMBOL_GPL(xnthread_set_mode);
  *
  * @remark Tags: isr-allowed, might-switch.
  */
-void xnthread_suspend(xnthread_t *thread, int mask,
+void xnthread_suspend(struct xnthread *thread, int mask,
                      xnticks_t timeout, xntmode_t timeout_mode,
                      struct xnsynch *wchan)
 {
@@ -1105,7 +1105,7 @@ unlock_and_exit:
 EXPORT_SYMBOL_GPL(xnthread_resume);
 
 /**
- * @fn int xnthread_unblock(xnthread_t *thread)
+ * @fn int xnthread_unblock(struct xnthread *thread)
  * @brief Unblock a thread.
  *
  * Breaks the thread out of any wait it is currently in.  This call
@@ -1128,7 +1128,7 @@ EXPORT_SYMBOL_GPL(xnthread_resume);
  *
  * @remark Tags: isr-allowed.
  */
-int xnthread_unblock(xnthread_t *thread)
+int xnthread_unblock(struct xnthread *thread)
 {
        int ret = 1;
        spl_t s;
@@ -1178,7 +1178,7 @@ int xnthread_unblock(xnthread_t *thread)
 EXPORT_SYMBOL_GPL(xnthread_unblock);
 
 /**
- * @fn int xnthread_set_periodic(xnthread_t *thread,xnticks_t idate, xntmode_t 
timeout_mode, xnticks_t period)
+ * @fn int xnthread_set_periodic(struct xnthread *thread,xnticks_t idate, 
xntmode_t timeout_mode, xnticks_t period)
  * @brief Make a thread periodic.
  *
  * Make a thread periodic by programming its first release point and
@@ -1216,7 +1216,7 @@ EXPORT_SYMBOL_GPL(xnthread_unblock);
  *
  * @remark Tags: none.
  */
-int xnthread_set_periodic(xnthread_t *thread, xnticks_t idate,
+int xnthread_set_periodic(struct xnthread *thread, xnticks_t idate,
                          xntmode_t timeout_mode, xnticks_t period)
 {
        int ret = 0;
@@ -1302,7 +1302,7 @@ EXPORT_SYMBOL_GPL(xnthread_set_periodic);
 int xnthread_wait_period(unsigned long *overruns_r)
 {
        unsigned long overruns = 0;
-       xnthread_t *thread;
+       struct xnthread *thread;
        xnticks_t now;
        int err = 0;
        spl_t s;
diff --git a/kernel/drivers/ipc/bufp.c b/kernel/drivers/ipc/bufp.c
index 4363c68..b54ecb8 100644
--- a/kernel/drivers/ipc/bufp.c
+++ b/kernel/drivers/ipc/bufp.c
@@ -167,7 +167,7 @@ static ssize_t __bufp_readbuf(struct bufp_socket *sk,
 {
        struct bufp_wait_context wait, *bufwc;
        struct rtipc_wait_context *wc;
-       xnthread_t *waiter;
+       struct xnthread *waiter;
        rtdm_toseq_t toseq;
        ssize_t len, ret;
        size_t rbytes, n;
@@ -412,7 +412,7 @@ static ssize_t __bufp_writebuf(struct bufp_socket *rsk,
 {
        struct bufp_wait_context wait, *bufwc;
        struct rtipc_wait_context *wc;
-       xnthread_t *waiter;
+       struct xnthread *waiter;
        rtdm_toseq_t toseq;
        ssize_t len, ret;
        size_t wbytes, n;
diff --git a/kernel/drivers/testing/switchtest.c 
b/kernel/drivers/testing/switchtest.c
index f48c4e2..0090c5f 100644
--- a/kernel/drivers/testing/switchtest.c
+++ b/kernel/drivers/testing/switchtest.c
@@ -16,7 +16,7 @@ typedef struct {
        struct rttst_swtest_task base;
        rtdm_event_t rt_synch;
        struct semaphore nrt_synch;
-       xnthread_t ktask;          /* For kernel-space real-time tasks. */
+       struct xnthread ktask;          /* For kernel-space real-time tasks. */
        unsigned last_switch;
 } rtswitch_task_t;
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to