diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-08-02 16:22:31 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-08-05 09:30:33 +0200 |
commit | 40dcafaf80a29c20d74594853a8ff04441eabd9c (patch) | |
tree | 1541f69ee011198bd995f38069a2b1300fc4de76 /cpukit/score/src | |
parent | rbtree: Rename find header in find control (diff) | |
download | rtems-40dcafaf80a29c20d74594853a8ff04441eabd9c.tar.bz2 |
Add and use RTEMS_CONTAINER_OF()
Diffstat (limited to 'cpukit/score/src')
-rw-r--r-- | cpukit/score/src/resourceiterate.c | 6 | ||||
-rw-r--r-- | cpukit/score/src/schedulerchangeroot.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/scheduleredf.c | 10 | ||||
-rw-r--r-- | cpukit/score/src/threadq.c | 12 | ||||
-rw-r--r-- | cpukit/score/src/threadqdequeue.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/threadqfirst.c | 5 |
6 files changed, 19 insertions, 18 deletions
diff --git a/cpukit/score/src/resourceiterate.c b/cpukit/score/src/resourceiterate.c index 26f923491d..ac8b8b037c 100644 --- a/cpukit/score/src/resourceiterate.c +++ b/cpukit/score/src/resourceiterate.c @@ -16,14 +16,12 @@ static Resource_Control *_Resource_Rival_head_to_resource( Chain_Node *head ) { - return (Resource_Control *) - ( (char *) head - offsetof( Resource_Control, Rivals.Head.Node ) ); + return RTEMS_CONTAINER_OF( head, Resource_Control, Rivals.Head.Node ); } static Resource_Node *_Resource_Resource_tail_to_rival( Chain_Node *tail ) { - return (Resource_Node *) - ( (char *) tail - offsetof( Resource_Node, Resources.Tail.Node ) ); + return RTEMS_CONTAINER_OF( tail, Resource_Node, Resources.Tail.Node ); } void _Resource_Iterate( diff --git a/cpukit/score/src/schedulerchangeroot.c b/cpukit/score/src/schedulerchangeroot.c index eba852ba5e..f731117b4c 100644 --- a/cpukit/score/src/schedulerchangeroot.c +++ b/cpukit/score/src/schedulerchangeroot.c @@ -32,7 +32,7 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Set_root_visitor( Thread_Control *root = ctx->root; Thread_Control *needs_help = root; Thread_Control *offers_help = - _Thread_Resource_node_to_thread( resource_node ); + THREAD_RESOURCE_NODE_TO_THREAD( resource_node ); const Scheduler_Control *scheduler = _Scheduler_Get_own( offers_help ); Thread_Control *needs_help_too; diff --git a/cpukit/score/src/scheduleredf.c b/cpukit/score/src/scheduleredf.c index 01b5244cf6..6dfa288999 100644 --- a/cpukit/score/src/scheduleredf.c +++ b/cpukit/score/src/scheduleredf.c @@ -25,10 +25,12 @@ int _Scheduler_EDF_Compare( const RBTree_Node* n2 ) { - Priority_Control value1 = _RBTree_Container_of - (n1,Scheduler_EDF_Node,Node)->thread->current_priority; - Priority_Control value2 = _RBTree_Container_of - (n2,Scheduler_EDF_Node,Node)->thread->current_priority; + Scheduler_EDF_Node *edf1 = + RTEMS_CONTAINER_OF( n1, Scheduler_EDF_Node, Node ); + Scheduler_EDF_Node *edf2 = + RTEMS_CONTAINER_OF( n2, Scheduler_EDF_Node, Node ); + Priority_Control value1 = edf1->thread->current_priority; + Priority_Control value2 = edf2->thread->current_priority; /* * This function compares only numbers for the red-black tree, diff --git a/cpukit/score/src/threadq.c b/cpukit/score/src/threadq.c index 0ffbfada09..b146ad410c 100644 --- a/cpukit/score/src/threadq.c +++ b/cpukit/score/src/threadq.c @@ -20,19 +20,19 @@ #include <rtems/score/threadqimpl.h> #include <rtems/score/chainimpl.h> -#include <rtems/score/scheduler.h> - #include <rtems/score/rbtreeimpl.h> +#include <rtems/score/scheduler.h> +#include <rtems/score/threadimpl.h> int _Thread_queue_Compare_priority( const RBTree_Node *left, const RBTree_Node *right ) { - Priority_Control left_priority = _RBTree_Container_of - (left,Thread_Control,RBNode)->current_priority; - Priority_Control right_priority = _RBTree_Container_of - (right,Thread_Control,RBNode)->current_priority; + Priority_Control left_priority = + THREAD_RBTREE_NODE_TO_THREAD( left )->current_priority; + Priority_Control right_priority = + THREAD_RBTREE_NODE_TO_THREAD( right )->current_priority; /* * SuperCore priorities use lower numbers to indicate greater importance. diff --git a/cpukit/score/src/threadqdequeue.c b/cpukit/score/src/threadqdequeue.c index d745ef29e3..e364aa91e8 100644 --- a/cpukit/score/src/threadqdequeue.c +++ b/cpukit/score/src/threadqdequeue.c @@ -50,7 +50,7 @@ Thread_Control *_Thread_queue_Dequeue( first = _RBTree_Get( &the_thread_queue->Queues.Priority, RBT_LEFT ); if ( first ) { - the_thread = _RBTree_Container_of( first, Thread_Control, RBNode ); + the_thread = THREAD_RBTREE_NODE_TO_THREAD( first ); } } diff --git a/cpukit/score/src/threadqfirst.c b/cpukit/score/src/threadqfirst.c index 39f7c3f5b3..5d97ae156d 100644 --- a/cpukit/score/src/threadqfirst.c +++ b/cpukit/score/src/threadqfirst.c @@ -18,9 +18,10 @@ #include "config.h" #endif +#include <rtems/score/threadqimpl.h> #include <rtems/score/chainimpl.h> #include <rtems/score/isrlevel.h> -#include <rtems/score/threadqimpl.h> +#include <rtems/score/threadimpl.h> Thread_Control *_Thread_queue_First( Thread_queue_Control *the_thread_queue @@ -41,7 +42,7 @@ Thread_Control *_Thread_queue_First( first = _RBTree_First( &the_thread_queue->Queues.Priority, RBT_LEFT ); if ( first ) - thread = _RBTree_Container_of( first, Thread_Control, RBNode ); + thread = THREAD_RBTREE_NODE_TO_THREAD( first ); } _ISR_Enable( level ); |