[Xenomai-git] Philippe Gerum : nucleus/queue: remove support for generic queues
Module: xenomai-forge Branch: master Commit: 8a6fd498c51e35a3d9a6f9c7dbd3318ef789f5e6 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=8a6fd498c51e35a3d9a6f9c7dbd3318ef789f5e6 Author: Philippe Gerum Date: Sun Jan 1 16:46:03 2012 +0100 nucleus/queue: remove support for generic queues No in-tree client since the pSOS emulator moved to userland. --- include/cobalt/nucleus/module.h | 15 include/cobalt/nucleus/queue.h | 138 --- kernel/cobalt/nucleus/module.c | 33 - 3 files changed, 0 insertions(+), 186 deletions(-) diff --git a/include/cobalt/nucleus/module.h b/include/cobalt/nucleus/module.h index 3fa83c8..e0167b5 100644 --- a/include/cobalt/nucleus/module.h +++ b/include/cobalt/nucleus/module.h @@ -23,21 +23,6 @@ #include #include -#define XNMOD_GHOLDER_REALLOC 128 /* Realloc count */ -#define XNMOD_GHOLDER_THRESHOLD 64 /* Safety threshold */ - -#ifdef __cplusplus -extern "C" { -#endif - -void xnmod_alloc_glinks(xnqueue_t *freehq); - -#ifdef __cplusplus -} -#endif - -extern xnqueue_t xnmod_glink_queue; - extern u_long xnmod_sysheap_size; #endif /* !_XENO_NUCLEUS_MODULE_H */ diff --git a/include/cobalt/nucleus/queue.h b/include/cobalt/nucleus/queue.h index e94f8c3..35b7747 100644 --- a/include/cobalt/nucleus/queue.h +++ b/include/cobalt/nucleus/queue.h @@ -461,142 +461,4 @@ static inline int emptypq_p(xnpqueue_t *pqslot) return emptyq_p(&pqslot->pqueue); } -/* Generic prioritized element holder */ - -typedef struct xngholder { - - xnpholder_t glink; - void *data; - -} xngholder_t; - -static inline void initgh(xngholder_t *holder, void *data) -{ - inith(&holder->glink.plink); - holder->data = data; -} - -/* Generic element queue */ - -typedef struct xngqueue { - - xnpqueue_t gqueue; - xnqueue_t *freehq; - void (*starvation) (xnqueue_t *); - int threshold; - -} xngqueue_t; - -static inline void initgq(xngqueue_t *gqslot, - xnqueue_t *freehq, - void (*starvation) (xnqueue_t *), - int threshold) -{ - initpq(&gqslot->gqueue); - gqslot->freehq = freehq; - gqslot->starvation = starvation; - gqslot->threshold = threshold; -} - -static inline xngholder_t *allocgh(xngqueue_t *gqslot) -{ - if (countq(gqslot->freehq) < gqslot->threshold) - gqslot->starvation(gqslot->freehq); - - return (xngholder_t *)getq(gqslot->freehq); -} - -static inline void *removegh(xngqueue_t *gqslot, xngholder_t *holder) -{ - removepq(&gqslot->gqueue, &holder->glink); - appendq(gqslot->freehq, &holder->glink.plink); - return holder->data; -} - -static inline void insertgqf(xngqueue_t *gqslot, void *data, int prio) -{ - xngholder_t *holder = allocgh(gqslot); - holder->data = data; - return insertpqf(&gqslot->gqueue, &holder->glink, prio); -} - -static inline void insertgql(xngqueue_t *gqslot, void *data, int prio) -{ - xngholder_t *holder = allocgh(gqslot); - holder->data = data; - insertpql(&gqslot->gqueue, &holder->glink, prio); -} - -static inline void appendgq(xngqueue_t *gqslot, void *data) -{ - xngholder_t *holder = allocgh(gqslot); - holder->data = data; - appendpq(&gqslot->gqueue, &holder->glink); -} - -static inline void prependgq(xngqueue_t *gqslot, void *data) -{ - xngholder_t *holder = allocgh(gqslot); - holder->data = data; - prependpq(&gqslot->gqueue, &holder->glink); -} - -static inline xngholder_t *getheadgq(xngqueue_t *gqslot) -{ - return (xngholder_t *)getheadpq(&gqslot->gqueue); -} - -static inline xngholder_t *nextgq(xngqueue_t *gqslot, xngholder_t *holder) -{ - return (xngholder_t *)nextpq(&gqslot->gqueue, &holder->glink); -} - -static inline void *getgq(xngqueue_t *gqslot) -{ - xngholder_t *holder = getheadgq(gqslot); - - if (!holder) - return NULL; - - appendq(gqslot->freehq, &getpq(&gqslot->gqueue)->plink); - - return holder->data; -} - -static inline xngholder_t *popgq(xngqueue_t *gqslot, xngholder_t *holder) -{ - xngholder_t *nextholder = nextgq(gqslot, holder); - removegh(gqslot, holder); - return nextholder; -} - -static inline xngholder_t *findgq(xngqueue_t *gqslot, void *data) -{ - xnholder_t *holder; - - for (holder = gqslot->gqueue.pqueue.head.next; -holder != &gqslot->gqueue.pqueue.head; holder = holder->next) { - if (((xngholder_t *)holder)->data == data) - return (xngholder_t *)holder; - } - - return NULL; -} - -static inline void *removegq(xngqueue_t *gqslot, void *data) -{ - xngholder_t *holder = findgq(gqslot, data); - return holder ? removegh(gqslot, holder) : NULL; -} - -static inline int countgq(xngqueue_t *gqslot) -{ - return countpq(&gqslot->gqueue); -} - -static inline int emptygq_p(xngq
[Xenomai-git] Philippe Gerum : nucleus/queue: remove support for generic queues
Module: xenomai-forge Branch: master Commit: b30cb530072e195fc0d9f9c0d7dffb2ccec6ec86 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=b30cb530072e195fc0d9f9c0d7dffb2ccec6ec86 Author: Philippe Gerum Date: Sun Jan 1 16:46:03 2012 +0100 nucleus/queue: remove support for generic queues No in-tree client since the pSOS emulator moved to userland. --- include/cobalt/nucleus/module.h | 15 include/cobalt/nucleus/queue.h | 138 --- kernel/cobalt/nucleus/module.c | 33 - 3 files changed, 0 insertions(+), 186 deletions(-) diff --git a/include/cobalt/nucleus/module.h b/include/cobalt/nucleus/module.h index 3fa83c8..e0167b5 100644 --- a/include/cobalt/nucleus/module.h +++ b/include/cobalt/nucleus/module.h @@ -23,21 +23,6 @@ #include #include -#define XNMOD_GHOLDER_REALLOC 128 /* Realloc count */ -#define XNMOD_GHOLDER_THRESHOLD 64 /* Safety threshold */ - -#ifdef __cplusplus -extern "C" { -#endif - -void xnmod_alloc_glinks(xnqueue_t *freehq); - -#ifdef __cplusplus -} -#endif - -extern xnqueue_t xnmod_glink_queue; - extern u_long xnmod_sysheap_size; #endif /* !_XENO_NUCLEUS_MODULE_H */ diff --git a/include/cobalt/nucleus/queue.h b/include/cobalt/nucleus/queue.h index e94f8c3..35b7747 100644 --- a/include/cobalt/nucleus/queue.h +++ b/include/cobalt/nucleus/queue.h @@ -461,142 +461,4 @@ static inline int emptypq_p(xnpqueue_t *pqslot) return emptyq_p(&pqslot->pqueue); } -/* Generic prioritized element holder */ - -typedef struct xngholder { - - xnpholder_t glink; - void *data; - -} xngholder_t; - -static inline void initgh(xngholder_t *holder, void *data) -{ - inith(&holder->glink.plink); - holder->data = data; -} - -/* Generic element queue */ - -typedef struct xngqueue { - - xnpqueue_t gqueue; - xnqueue_t *freehq; - void (*starvation) (xnqueue_t *); - int threshold; - -} xngqueue_t; - -static inline void initgq(xngqueue_t *gqslot, - xnqueue_t *freehq, - void (*starvation) (xnqueue_t *), - int threshold) -{ - initpq(&gqslot->gqueue); - gqslot->freehq = freehq; - gqslot->starvation = starvation; - gqslot->threshold = threshold; -} - -static inline xngholder_t *allocgh(xngqueue_t *gqslot) -{ - if (countq(gqslot->freehq) < gqslot->threshold) - gqslot->starvation(gqslot->freehq); - - return (xngholder_t *)getq(gqslot->freehq); -} - -static inline void *removegh(xngqueue_t *gqslot, xngholder_t *holder) -{ - removepq(&gqslot->gqueue, &holder->glink); - appendq(gqslot->freehq, &holder->glink.plink); - return holder->data; -} - -static inline void insertgqf(xngqueue_t *gqslot, void *data, int prio) -{ - xngholder_t *holder = allocgh(gqslot); - holder->data = data; - return insertpqf(&gqslot->gqueue, &holder->glink, prio); -} - -static inline void insertgql(xngqueue_t *gqslot, void *data, int prio) -{ - xngholder_t *holder = allocgh(gqslot); - holder->data = data; - insertpql(&gqslot->gqueue, &holder->glink, prio); -} - -static inline void appendgq(xngqueue_t *gqslot, void *data) -{ - xngholder_t *holder = allocgh(gqslot); - holder->data = data; - appendpq(&gqslot->gqueue, &holder->glink); -} - -static inline void prependgq(xngqueue_t *gqslot, void *data) -{ - xngholder_t *holder = allocgh(gqslot); - holder->data = data; - prependpq(&gqslot->gqueue, &holder->glink); -} - -static inline xngholder_t *getheadgq(xngqueue_t *gqslot) -{ - return (xngholder_t *)getheadpq(&gqslot->gqueue); -} - -static inline xngholder_t *nextgq(xngqueue_t *gqslot, xngholder_t *holder) -{ - return (xngholder_t *)nextpq(&gqslot->gqueue, &holder->glink); -} - -static inline void *getgq(xngqueue_t *gqslot) -{ - xngholder_t *holder = getheadgq(gqslot); - - if (!holder) - return NULL; - - appendq(gqslot->freehq, &getpq(&gqslot->gqueue)->plink); - - return holder->data; -} - -static inline xngholder_t *popgq(xngqueue_t *gqslot, xngholder_t *holder) -{ - xngholder_t *nextholder = nextgq(gqslot, holder); - removegh(gqslot, holder); - return nextholder; -} - -static inline xngholder_t *findgq(xngqueue_t *gqslot, void *data) -{ - xnholder_t *holder; - - for (holder = gqslot->gqueue.pqueue.head.next; -holder != &gqslot->gqueue.pqueue.head; holder = holder->next) { - if (((xngholder_t *)holder)->data == data) - return (xngholder_t *)holder; - } - - return NULL; -} - -static inline void *removegq(xngqueue_t *gqslot, void *data) -{ - xngholder_t *holder = findgq(gqslot, data); - return holder ? removegh(gqslot, holder) : NULL; -} - -static inline int countgq(xngqueue_t *gqslot) -{ - return countpq(&gqslot->gqueue); -} - -static inline int emptygq_p(xngq