Module: xenomai-forge Branch: master Commit: 5e1a2188421afbc73b7500c503622f962bd2eb0b URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=5e1a2188421afbc73b7500c503622f962bd2eb0b
Author: Philippe Gerum <r...@xenomai.org> Date: Sat Sep 7 18:13:01 2013 +0200 cobalt/sched: fix naming of schedqueue helpers --- include/cobalt/kernel/sched-rt.h | 8 +++--- include/cobalt/kernel/schedqueue.h | 34 ++++++++++++++++---------------- kernel/cobalt/sched-rt.c | 6 ++-- kernel/cobalt/sched-sporadic.c | 2 +- kernel/cobalt/sched-tp.c | 16 +++++++------- kernel/cobalt/sched-weak.c | 12 +++++----- kernel/cobalt/sched.c | 38 ++++++++++++++++++------------------ 7 files changed, 58 insertions(+), 58 deletions(-) diff --git a/include/cobalt/kernel/sched-rt.h b/include/cobalt/kernel/sched-rt.h index 7f08bf2..1b49be9 100644 --- a/include/cobalt/kernel/sched-rt.h +++ b/include/cobalt/kernel/sched-rt.h @@ -52,22 +52,22 @@ extern struct xnsched_class xnsched_class_rt; static inline void __xnsched_rt_requeue(struct xnthread *thread) { - sched_insertqlf(&thread->sched->rt.runnable, thread); + xnsched_addq(&thread->sched->rt.runnable, thread); } static inline void __xnsched_rt_enqueue(struct xnthread *thread) { - sched_insertqff(&thread->sched->rt.runnable, thread); + xnsched_addq_tail(&thread->sched->rt.runnable, thread); } static inline void __xnsched_rt_dequeue(struct xnthread *thread) { - sched_removeq(&thread->sched->rt.runnable, thread); + xnsched_delq(&thread->sched->rt.runnable, thread); } static inline struct xnthread *__xnsched_rt_pick(struct xnsched *sched) { - return sched_getq(&sched->rt.runnable); + return xnsched_getq(&sched->rt.runnable); } static inline void __xnsched_rt_setparam(struct xnthread *thread, diff --git a/include/cobalt/kernel/schedqueue.h b/include/cobalt/kernel/schedqueue.h index 36bf590..cbbef96 100644 --- a/include/cobalt/kernel/schedqueue.h +++ b/include/cobalt/kernel/schedqueue.h @@ -49,21 +49,21 @@ struct xnsched_mlq { struct xnthread; -void sched_initq(struct xnsched_mlq *q, - int loprio, int hiprio); +void xnsched_initq(struct xnsched_mlq *q, + int loprio, int hiprio); -void sched_insertqff(struct xnsched_mlq *q, - struct xnthread *thread); +void xnsched_addq(struct xnsched_mlq *q, + struct xnthread *thread); -void sched_insertqlf(struct xnsched_mlq *q, - struct xnthread *thread); +void xnsched_addq_tail(struct xnsched_mlq *q, + struct xnthread *thread); -void sched_removeq(struct xnsched_mlq *q, - struct xnthread *thread); +void xnsched_delq(struct xnsched_mlq *q, + struct xnthread *thread); -struct xnthread *sched_getq(struct xnsched_mlq *q); +struct xnthread *xnsched_getq(struct xnsched_mlq *q); -static inline int sched_emptyq_p(struct xnsched_mlq *q) +static inline int xnsched_emptyq_p(struct xnsched_mlq *q) { return q->himap == 0; } @@ -74,12 +74,12 @@ typedef struct xnsched_mlq xnsched_queue_t; typedef struct list_head xnsched_queue_t; -#define sched_initq(__q, __minp, __maxp) INIT_LIST_HEAD(__q) -#define sched_emptyq_p(__q) list_empty(__q) -#define sched_insertqlf(__q, __t) list_add_prilf(__t, __q, cprio, rlink) -#define sched_insertqff(__q, __t) list_add_priff(__t, __q, cprio, rlink) -#define sched_removeq(__q, __t) list_del(&(__t)->rlink) -#define sched_getq(__q) \ +#define xnsched_initq(__q, __minp, __maxp) INIT_LIST_HEAD(__q) +#define xnsched_emptyq_p(__q) list_empty(__q) +#define xnsched_addq(__q, __t) list_add_prilf(__t, __q, cprio, rlink) +#define xnsched_addq_tail(__q, __t) list_add_priff(__t, __q, cprio, rlink) +#define xnsched_delq(__q, __t) list_del(&(__t)->rlink) +#define xnsched_getq(__q) \ ({ \ struct xnthread *__t = NULL; \ if (!list_empty(__q)) \ @@ -89,6 +89,6 @@ typedef struct list_head xnsched_queue_t; #endif /* !CONFIG_XENO_OPT_SCALABLE_SCHED */ -struct xnthread *sched_findq(xnsched_queue_t *q, int prio); +struct xnthread *xnsched_findq(xnsched_queue_t *q, int prio); #endif /* !_COBALT_KERNEL_SCHEDQUEUE_H */ diff --git a/kernel/cobalt/sched-rt.c b/kernel/cobalt/sched-rt.c index 3ec8f89..c92b0a0 100644 --- a/kernel/cobalt/sched-rt.c +++ b/kernel/cobalt/sched-rt.c @@ -23,7 +23,7 @@ static void xnsched_rt_init(struct xnsched *sched) { - sched_initq(&sched->rt.runnable, + xnsched_initq(&sched->rt.runnable, XNSCHED_RT_MIN_PRIO, XNSCHED_RT_MAX_PRIO); } @@ -58,7 +58,7 @@ static void xnsched_rt_rotate(struct xnsched *sched, { struct xnthread *thread, *curr; - if (sched_emptyq_p(&sched->rt.runnable)) + if (xnsched_emptyq_p(&sched->rt.runnable)) return; /* No runnable thread in this class. */ curr = sched->curr; @@ -66,7 +66,7 @@ static void xnsched_rt_rotate(struct xnsched *sched, if (p->rt.prio == XNSCHED_RUNPRIO) thread = curr; else { - thread = sched_findq(&sched->rt.runnable, p->rt.prio); + thread = xnsched_findq(&sched->rt.runnable, p->rt.prio); if (thread == NULL) return; } diff --git a/kernel/cobalt/sched-sporadic.c b/kernel/cobalt/sched-sporadic.c index 2041087..44438ab 100644 --- a/kernel/cobalt/sched-sporadic.c +++ b/kernel/cobalt/sched-sporadic.c @@ -354,7 +354,7 @@ static struct xnthread *xnsched_sporadic_pick(struct xnsched *sched) { struct xnthread *curr = sched->curr, *next; - next = sched_getq(&sched->rt.runnable); + next = xnsched_getq(&sched->rt.runnable); if (next == NULL) goto swap_budgets; diff --git a/kernel/cobalt/sched-tp.c b/kernel/cobalt/sched-tp.c index 6d87d7b..165ae1d 100644 --- a/kernel/cobalt/sched-tp.c +++ b/kernel/cobalt/sched-tp.c @@ -92,10 +92,10 @@ static void xnsched_tp_init(struct xnsched *sched) * are valid RT priorities. TP is actually a subset of RT. */ for (n = 0; n < CONFIG_XENO_OPT_SCHED_TP_NRPART; n++) - sched_initq(&tp->partitions[n].runnable, - XNSCHED_RT_MIN_PRIO, XNSCHED_RT_MAX_PRIO); - sched_initq(&tp->idle.runnable, - XNSCHED_RT_MIN_PRIO, XNSCHED_RT_MAX_PRIO); + xnsched_initq(&tp->partitions[n].runnable, + XNSCHED_RT_MIN_PRIO, XNSCHED_RT_MAX_PRIO); + xnsched_initq(&tp->idle.runnable, + XNSCHED_RT_MIN_PRIO, XNSCHED_RT_MAX_PRIO); tp->tps = NULL; tp->gps = NULL; @@ -174,17 +174,17 @@ static void xnsched_tp_forget(struct xnthread *thread) static void xnsched_tp_enqueue(struct xnthread *thread) { - sched_insertqff(&thread->tps->runnable, thread); + xnsched_addq_tail(&thread->tps->runnable, thread); } static void xnsched_tp_dequeue(struct xnthread *thread) { - sched_removeq(&thread->tps->runnable, thread); + xnsched_delq(&thread->tps->runnable, thread); } static void xnsched_tp_requeue(struct xnthread *thread) { - sched_insertqlf(&thread->tps->runnable, thread); + xnsched_addq(&thread->tps->runnable, thread); } static struct xnthread *xnsched_tp_pick(struct xnsched *sched) @@ -193,7 +193,7 @@ static struct xnthread *xnsched_tp_pick(struct xnsched *sched) if (!xntimer_running_p(&sched->tp.tf_timer)) return NULL; - return sched_getq(&sched->tp.tps->runnable); + return xnsched_getq(&sched->tp.tps->runnable); } static void xnsched_tp_migrate(struct xnthread *thread, struct xnsched *sched) diff --git a/kernel/cobalt/sched-weak.c b/kernel/cobalt/sched-weak.c index 3b0479d..72b22a3 100644 --- a/kernel/cobalt/sched-weak.c +++ b/kernel/cobalt/sched-weak.c @@ -20,28 +20,28 @@ static void xnsched_weak_init(struct xnsched *sched) { - sched_initq(&sched->weak.runnable, - XNSCHED_WEAK_MIN_PRIO, XNSCHED_WEAK_MAX_PRIO); + xnsched_initq(&sched->weak.runnable, + XNSCHED_WEAK_MIN_PRIO, XNSCHED_WEAK_MAX_PRIO); } static void xnsched_weak_requeue(struct xnthread *thread) { - sched_insertqlf(&thread->sched->weak.runnable, thread); + xnsched_addq(&thread->sched->weak.runnable, thread); } static void xnsched_weak_enqueue(struct xnthread *thread) { - sched_insertqff(&thread->sched->weak.runnable, thread); + xnsched_addq_tail(&thread->sched->weak.runnable, thread); } static void xnsched_weak_dequeue(struct xnthread *thread) { - sched_removeq(&thread->sched->weak.runnable, thread); + xnsched_delq(&thread->sched->weak.runnable, thread); } static struct xnthread *xnsched_weak_pick(struct xnsched *sched) { - return sched_getq(&sched->weak.runnable); + return xnsched_getq(&sched->weak.runnable); } void xnsched_weak_setparam(struct xnthread *thread, diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c index ab26ab1..af7bc34 100644 --- a/kernel/cobalt/sched.c +++ b/kernel/cobalt/sched.c @@ -484,7 +484,7 @@ void xnsched_migrate_passive(struct xnthread *thread, struct xnsched *sched) #ifdef CONFIG_XENO_OPT_SCALABLE_SCHED -void sched_initq(struct xnsched_mlq *q, int loprio, int hiprio) +void xnsched_initq(struct xnsched_mlq *q, int loprio, int hiprio) { int prio; @@ -500,7 +500,7 @@ void sched_initq(struct xnsched_mlq *q, int loprio, int hiprio) INIT_LIST_HEAD(q->heads + prio); } -static inline int indexmlq(struct xnsched_mlq *q, int prio) +static inline int get_qindex(struct xnsched_mlq *q, int prio) { XENO_BUGON(NUCLEUS, prio < q->loprio || prio > q->hiprio); /* @@ -514,12 +514,12 @@ static inline int indexmlq(struct xnsched_mlq *q, int prio) return q->hiprio - prio; } -static struct list_head *addmlq(struct xnsched_mlq *q, int prio) +static struct list_head *add_q(struct xnsched_mlq *q, int prio) { struct list_head *head; int hi, lo, idx; - idx = indexmlq(q, prio); + idx = get_qindex(q, prio); head = q->heads + idx; q->elems++; @@ -534,20 +534,20 @@ static struct list_head *addmlq(struct xnsched_mlq *q, int prio) return head; } -void sched_insertqlf(struct xnsched_mlq *q, struct xnthread *thread) +void xnsched_addq(struct xnsched_mlq *q, struct xnthread *thread) { - struct list_head *head = addmlq(q, thread->cprio); + struct list_head *head = add_q(q, thread->cprio); list_add(&thread->rlink, head); } -void sched_insertqff(struct xnsched_mlq *q, struct xnthread *thread) +void xnsched_addq_tail(struct xnsched_mlq *q, struct xnthread *thread) { - struct list_head *head = addmlq(q, thread->cprio); + struct list_head *head = add_q(q, thread->cprio); list_add_tail(&thread->rlink, head); } -static void removemlq(struct xnsched_mlq *q, - struct list_head *entry, int idx) +static void del_q(struct xnsched_mlq *q, + struct list_head *entry, int idx) { struct list_head *head; int hi, lo; @@ -565,19 +565,19 @@ static void removemlq(struct xnsched_mlq *q, } } -void sched_removeq(struct xnsched_mlq *q, struct xnthread *thread) +void xnsched_delq(struct xnsched_mlq *q, struct xnthread *thread) { - removemlq(q, &thread->rlink, indexmlq(q, thread->cprio)); + del_q(q, &thread->rlink, get_qindex(q, thread->cprio)); } -static inline int ffsmlq(struct xnsched_mlq *q) +static inline int ffs_q(struct xnsched_mlq *q) { int hi = ffnz(q->himap); int lo = ffnz(q->lomap[hi]); return hi * BITS_PER_LONG + lo; /* Result is undefined if none set. */ } -struct xnthread *sched_getq(struct xnsched_mlq *q) +struct xnthread *xnsched_getq(struct xnsched_mlq *q) { struct xnthread *thread; struct list_head *head; @@ -586,21 +586,21 @@ struct xnthread *sched_getq(struct xnsched_mlq *q) if (q->elems == 0) return NULL; - idx = ffsmlq(q); + idx = ffs_q(q); head = q->heads + idx; XENO_BUGON(NUCLEUS, list_empty(head)); thread = list_first_entry(head, struct xnthread, rlink); - removemlq(q, &thread->rlink, idx); + del_q(q, &thread->rlink, idx); return thread; } -struct xnthread *sched_findq(struct xnsched_mlq *q, int prio) +struct xnthread *xnsched_findq(struct xnsched_mlq *q, int prio) { struct list_head *head; int idx; - idx = indexmlq(q, prio); + idx = get_qindex(q, prio); head = q->heads + idx; if (list_empty(head)) return NULL; @@ -610,7 +610,7 @@ struct xnthread *sched_findq(struct xnsched_mlq *q, int prio) #else /* !CONFIG_XENO_OPT_SCALABLE_SCHED */ -struct xnthread *sched_findq(struct list_head *q, int prio) +struct xnthread *xnsched_findq(struct list_head *q, int prio) { struct xnthread *thread; _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git