diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-11-25 09:27:06 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-11-25 09:27:06 +0000 |
commit | ce002b161d89c912c7f22da4dba86955251c3afd (patch) | |
tree | 947eb3c9a147e82733232d2c3f23ad21650aee58 /cpukit/score/src | |
parent | 2010-11-24 Gedare Bloom <giddyup44@yahoo.com> (diff) | |
download | rtems-ce002b161d89c912c7f22da4dba86955251c3afd.tar.bz2 |
2010-11-25 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libfs/src/dosfs/fat_file.c, libfs/src/imfs/imfs_debug.c,
libfs/src/imfs/imfs_directory.c, libfs/src/imfs/imfs_getchild.c,
posix/src/killinfo.c, score/inline/rtems/score/schedulerpriority.inl,
score/inline/rtems/score/watchdog.inl, score/src/apiext.c,
score/src/chain.c, score/src/coremsgflushsupp.c,
score/src/coremsginsert.c, score/src/objectshrinkinformation.c,
score/src/schedulerpriorityyield.c,
score/src/threadqdequeuepriority.c,
score/src/threadqenqueuepriority.c,
score/src/threadqextractpriority.c, score/src/threadqfirstfifo.c,
score/src/threadqfirstpriority.c, score/src/threadyieldprocessor.c,
score/src/userextthreadbegin.c, score/src/userextthreadcreate.c,
score/src/userextthreaddelete.c, score/src/userextthreadrestart.c,
score/src/userextthreadstart.c, score/src/userextthreadswitch.c,
score/src/watchdogreportchain.c: Avoid chain API violations.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r-- | cpukit/score/src/apiext.c | 6 | ||||
-rw-r--r-- | cpukit/score/src/chain.c | 19 | ||||
-rw-r--r-- | cpukit/score/src/coremsgflushsupp.c | 13 | ||||
-rw-r--r-- | cpukit/score/src/coremsginsert.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/objectshrinkinformation.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/schedulerpriorityyield.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/threadqdequeuepriority.c | 23 | ||||
-rw-r--r-- | cpukit/score/src/threadqenqueuepriority.c | 4 | ||||
-rw-r--r-- | cpukit/score/src/threadqextractpriority.c | 17 | ||||
-rw-r--r-- | cpukit/score/src/threadqfirstfifo.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/threadqfirstpriority.c | 5 | ||||
-rw-r--r-- | cpukit/score/src/threadyieldprocessor.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/userextthreadbegin.c | 6 | ||||
-rw-r--r-- | cpukit/score/src/userextthreadcreate.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/userextthreaddelete.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/userextthreadrestart.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/userextthreadstart.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/userextthreadswitch.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/watchdogreportchain.c | 2 |
19 files changed, 62 insertions, 53 deletions
diff --git a/cpukit/score/src/apiext.c b/cpukit/score/src/apiext.c index 4531a2d695..a08977113e 100644 --- a/cpukit/score/src/apiext.c +++ b/cpukit/score/src/apiext.c @@ -52,7 +52,7 @@ void _API_extensions_Add( Chain_Node *the_node; API_extensions_Control *the_extension; - for ( the_node = _API_extensions_List.first ; + for ( the_node = _Chain_First( &_API_extensions_List ); !_Chain_Is_tail( &_API_extensions_List, the_node ) ; the_node = the_node->next ) { @@ -74,7 +74,7 @@ void _API_extensions_Run_postdriver( void ) Chain_Node *the_node; API_extensions_Control *the_extension; - for ( the_node = _API_extensions_List.first ; + for ( the_node = _Chain_First( &_API_extensions_List ); !_Chain_Is_tail( &_API_extensions_List, the_node ) ; the_node = the_node->next ) { @@ -100,7 +100,7 @@ void _API_extensions_Run_postswitch( void ) Chain_Node *the_node; API_extensions_Control *the_extension; - for ( the_node = _API_extensions_List.first ; + for ( the_node = _Chain_First( &_API_extensions_List ); !_Chain_Is_tail( &_API_extensions_List, the_node ) ; the_node = the_node->next ) { diff --git a/cpukit/score/src/chain.c b/cpukit/score/src/chain.c index c44d6201a3..85821d4d71 100644 --- a/cpukit/score/src/chain.c +++ b/cpukit/score/src/chain.c @@ -40,14 +40,14 @@ void _Chain_Initialize( size_t node_size ) { - size_t count; - Chain_Node *current; - Chain_Node *next; + size_t count = number_nodes; + Chain_Node *head = _Chain_Head( the_chain ); + Chain_Node *tail = _Chain_Tail( the_chain ); + Chain_Node *current = head; + Chain_Node *next = starting_address; + + head->previous = NULL; - count = number_nodes; - current = _Chain_Head( the_chain ); - the_chain->permanent_null = NULL; - next = starting_address; while ( count-- ) { current->next = next; next->previous = current; @@ -55,6 +55,7 @@ void _Chain_Initialize( next = (Chain_Node *) _Addresses_Add_offset( (void *) next, node_size ); } - current->next = _Chain_Tail( the_chain ); - the_chain->last = current; + + current->next = tail; + tail->previous = current; } diff --git a/cpukit/score/src/coremsgflushsupp.c b/cpukit/score/src/coremsgflushsupp.c index 5a6f00474c..4e15e1a495 100644 --- a/cpukit/score/src/coremsgflushsupp.c +++ b/cpukit/score/src/coremsgflushsupp.c @@ -53,6 +53,7 @@ uint32_t _CORE_message_queue_Flush_support( ) { ISR_Level level; + Chain_Node *inactive_head; Chain_Node *inactive_first; Chain_Node *message_queue_first; Chain_Node *message_queue_last; @@ -86,15 +87,15 @@ uint32_t _CORE_message_queue_Flush_support( */ _ISR_Disable( level ); - inactive_first = the_message_queue->Inactive_messages.first; - message_queue_first = the_message_queue->Pending_messages.first; - message_queue_last = the_message_queue->Pending_messages.last; + inactive_head = _Chain_Head( &the_message_queue->Inactive_messages ); + inactive_first = inactive_head->next;; + message_queue_first = _Chain_First( &the_message_queue->Pending_messages ); + message_queue_last = _Chain_Last( &the_message_queue->Pending_messages ); - the_message_queue->Inactive_messages.first = message_queue_first; + inactive_head->next = message_queue_first; message_queue_last->next = inactive_first; inactive_first->previous = message_queue_last; - message_queue_first->previous = - _Chain_Head( &the_message_queue->Inactive_messages ); + message_queue_first->previous = inactive_head; _Chain_Initialize_empty( &the_message_queue->Pending_messages ); diff --git a/cpukit/score/src/coremsginsert.c b/cpukit/score/src/coremsginsert.c index eaccdc0d1b..d333a5fb55 100644 --- a/cpukit/score/src/coremsginsert.c +++ b/cpukit/score/src/coremsginsert.c @@ -99,7 +99,7 @@ void _CORE_message_queue_Insert_message( the_priority = _CORE_message_queue_Get_message_priority(the_message); the_header = &the_message_queue->Pending_messages; - the_node = the_header->first; + the_node = _Chain_First( the_header ); while ( !_Chain_Is_tail( the_header, the_node ) ) { int this_priority; diff --git a/cpukit/score/src/objectshrinkinformation.c b/cpukit/score/src/objectshrinkinformation.c index 914fe2ac5d..18123fab68 100644 --- a/cpukit/score/src/objectshrinkinformation.c +++ b/cpukit/score/src/objectshrinkinformation.c @@ -69,7 +69,7 @@ void _Objects_Shrink_information( /* * Assume the Inactive chain is never empty at this point */ - the_object = (Objects_Control *) information->Inactive.first; + the_object = (Objects_Control *) _Chain_First( &information->Inactive ); do { index = _Objects_Get_index( the_object->id ); diff --git a/cpukit/score/src/schedulerpriorityyield.c b/cpukit/score/src/schedulerpriorityyield.c index 1a13a4e318..a8740d9065 100644 --- a/cpukit/score/src/schedulerpriorityyield.c +++ b/cpukit/score/src/schedulerpriorityyield.c @@ -67,7 +67,7 @@ void _Scheduler_priority_Yield( _ISR_Flash( level ); if ( _Thread_Is_heir( executing ) ) - _Thread_Heir = (Thread_Control *) ready->first; + _Thread_Heir = (Thread_Control *) _Chain_First( ready ); _Thread_Dispatch_necessary = true; } else if ( !_Thread_Is_heir( executing ) ) diff --git a/cpukit/score/src/threadqdequeuepriority.c b/cpukit/score/src/threadqdequeuepriority.c index 1010d58a58..1a7bc7037a 100644 --- a/cpukit/score/src/threadqdequeuepriority.c +++ b/cpukit/score/src/threadqdequeuepriority.c @@ -50,6 +50,8 @@ Thread_Control *_Thread_queue_Dequeue_priority( ISR_Level level; Thread_Control *the_thread = NULL; /* just to remove warnings */ Thread_Control *new_first_thread; + Chain_Node *head; + Chain_Node *tail; Chain_Node *new_first_node; Chain_Node *new_second_node; Chain_Node *last_node; @@ -61,8 +63,9 @@ Thread_Control *_Thread_queue_Dequeue_priority( index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; index++ ) { if ( !_Chain_Is_empty( &the_thread_queue->Queues.Priority[ index ] ) ) { - the_thread = (Thread_Control *) - the_thread_queue->Queues.Priority[ index ].first; + the_thread = (Thread_Control *) _Chain_First( + &the_thread_queue->Queues.Priority[ index ] + ); goto dequeue; } } @@ -75,13 +78,13 @@ Thread_Control *_Thread_queue_Dequeue_priority( dequeue: the_thread->Wait.queue = NULL; - new_first_node = the_thread->Wait.Block2n.first; + new_first_node = _Chain_First( &the_thread->Wait.Block2n ); new_first_thread = (Thread_Control *) new_first_node; next_node = the_thread->Object.Node.next; previous_node = the_thread->Object.Node.previous; if ( !_Chain_Is_empty( &the_thread->Wait.Block2n ) ) { - last_node = the_thread->Wait.Block2n.last; + last_node = _Chain_Last( &the_thread->Wait.Block2n ); new_second_node = new_first_node->next; previous_node->next = new_first_node; @@ -91,13 +94,13 @@ dequeue: if ( !_Chain_Has_only_one_node( &the_thread->Wait.Block2n ) ) { /* > two threads on 2-n */ - new_second_node->previous = - _Chain_Head( &new_first_thread->Wait.Block2n ); + head = _Chain_Head( &new_first_thread->Wait.Block2n ); + tail = _Chain_Tail( &new_first_thread->Wait.Block2n ); - new_first_thread->Wait.Block2n.first = new_second_node; - new_first_thread->Wait.Block2n.last = last_node; - - last_node->next = _Chain_Tail( &new_first_thread->Wait.Block2n ); + new_second_node->previous = head; + head->next = new_second_node; + tail->previous = last_node; + last_node->next = tail; } } else { previous_node->next = next_node; diff --git a/cpukit/score/src/threadqenqueuepriority.c b/cpukit/score/src/threadqenqueuepriority.c index f2652ea4b0..0d30529e0f 100644 --- a/cpukit/score/src/threadqenqueuepriority.c +++ b/cpukit/score/src/threadqenqueuepriority.c @@ -80,7 +80,7 @@ Thread_blocking_operation_States _Thread_queue_Enqueue_priority ( restart_forward_search: search_priority = PRIORITY_MINIMUM - 1; _ISR_Disable( level ); - search_thread = (Thread_Control *) header->first; + search_thread = (Thread_Control *) _Chain_First( header ); while ( !_Chain_Is_tail( header, (Chain_Node *)search_thread ) ) { search_priority = search_thread->current_priority; if ( priority <= search_priority ) @@ -128,7 +128,7 @@ restart_reverse_search: search_priority = PRIORITY_MAXIMUM + 1; _ISR_Disable( level ); - search_thread = (Thread_Control *) header->last; + search_thread = (Thread_Control *) _Chain_Last( header ); while ( !_Chain_Is_head( header, (Chain_Node *)search_thread ) ) { search_priority = search_thread->current_priority; if ( priority >= search_priority ) diff --git a/cpukit/score/src/threadqextractpriority.c b/cpukit/score/src/threadqextractpriority.c index 706f51e828..d4ddc2aa84 100644 --- a/cpukit/score/src/threadqextractpriority.c +++ b/cpukit/score/src/threadqextractpriority.c @@ -50,6 +50,8 @@ void _Thread_queue_Extract_priority_helper( ) { ISR_Level level; + Chain_Node *head; + Chain_Node *tail; Chain_Node *the_node; Chain_Node *next_node; Chain_Node *previous_node; @@ -73,9 +75,9 @@ void _Thread_queue_Extract_priority_helper( previous_node = the_node->previous; if ( !_Chain_Is_empty( &the_thread->Wait.Block2n ) ) { - new_first_node = the_thread->Wait.Block2n.first; + new_first_node = _Chain_First( &the_thread->Wait.Block2n ); new_first_thread = (Thread_Control *) new_first_node; - last_node = the_thread->Wait.Block2n.last; + last_node = _Chain_Last( &the_thread->Wait.Block2n ); new_second_node = new_first_node->next; previous_node->next = new_first_node; @@ -85,12 +87,13 @@ void _Thread_queue_Extract_priority_helper( if ( !_Chain_Has_only_one_node( &the_thread->Wait.Block2n ) ) { /* > two threads on 2-n */ - new_second_node->previous = - _Chain_Head( &new_first_thread->Wait.Block2n ); - new_first_thread->Wait.Block2n.first = new_second_node; + head = _Chain_Head( &new_first_thread->Wait.Block2n ); + tail = _Chain_Tail( &new_first_thread->Wait.Block2n ); - new_first_thread->Wait.Block2n.last = last_node; - last_node->next = _Chain_Tail( &new_first_thread->Wait.Block2n ); + new_second_node->previous = head; + head->next = new_second_node; + tail->previous = last_node; + last_node->next = tail; } } else { previous_node->next = next_node; diff --git a/cpukit/score/src/threadqfirstfifo.c b/cpukit/score/src/threadqfirstfifo.c index 9163780c76..bde7b45054 100644 --- a/cpukit/score/src/threadqfirstfifo.c +++ b/cpukit/score/src/threadqfirstfifo.c @@ -44,7 +44,7 @@ Thread_Control *_Thread_queue_First_fifo( ) { if ( !_Chain_Is_empty( &the_thread_queue->Queues.Fifo ) ) - return (Thread_Control *) the_thread_queue->Queues.Fifo.first; + return (Thread_Control *) _Chain_First( &the_thread_queue->Queues.Fifo ); return NULL; } diff --git a/cpukit/score/src/threadqfirstpriority.c b/cpukit/score/src/threadqfirstpriority.c index 442a4323b3..e5f4bccfe4 100644 --- a/cpukit/score/src/threadqfirstpriority.c +++ b/cpukit/score/src/threadqfirstpriority.c @@ -49,8 +49,9 @@ Thread_Control *_Thread_queue_First_priority ( index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; index++ ) { if ( !_Chain_Is_empty( &the_thread_queue->Queues.Priority[ index ] ) ) - return (Thread_Control *) - the_thread_queue->Queues.Priority[ index ].first; + return (Thread_Control *) _Chain_First( + &the_thread_queue->Queues.Priority[ index ] + ); } return NULL; } diff --git a/cpukit/score/src/threadyieldprocessor.c b/cpukit/score/src/threadyieldprocessor.c index 633292d3f6..1d3f26e212 100644 --- a/cpukit/score/src/threadyieldprocessor.c +++ b/cpukit/score/src/threadyieldprocessor.c @@ -66,7 +66,7 @@ void _Thread_Yield_processor( void ) _ISR_Flash( level ); if ( _Thread_Is_heir( executing ) ) - _Thread_Heir = (Thread_Control *) ready->first; + _Thread_Heir = (Thread_Control *) _Chain_First( ready ); _Thread_Dispatch_necessary = true; } else if ( !_Thread_Is_heir( executing ) ) diff --git a/cpukit/score/src/userextthreadbegin.c b/cpukit/score/src/userextthreadbegin.c index f71aedf518..9fed82ac4a 100644 --- a/cpukit/score/src/userextthreadbegin.c +++ b/cpukit/score/src/userextthreadbegin.c @@ -31,7 +31,7 @@ void _User_extensions_Thread_begin ( Chain_Node *the_node; User_extensions_Control *the_extension; - for ( the_node = _User_extensions_List.first ; + for ( the_node = _Chain_First( &_User_extensions_List ); !_Chain_Is_tail( &_User_extensions_List, the_node ) ; the_node = the_node->next ) { @@ -49,7 +49,7 @@ void _User_extensions_Thread_exitted ( Chain_Node *the_node; User_extensions_Control *the_extension; - for ( the_node = _User_extensions_List.last ; + for ( the_node = _Chain_Last( &_User_extensions_List ); !_Chain_Is_head( &_User_extensions_List, the_node ) ; the_node = the_node->previous ) { @@ -69,7 +69,7 @@ void _User_extensions_Fatal ( Chain_Node *the_node; User_extensions_Control *the_extension; - for ( the_node = _User_extensions_List.last ; + for ( the_node = _Chain_Last( &_User_extensions_List ); !_Chain_Is_head( &_User_extensions_List, the_node ) ; the_node = the_node->previous ) { diff --git a/cpukit/score/src/userextthreadcreate.c b/cpukit/score/src/userextthreadcreate.c index b7e7e6e855..a2950ee37e 100644 --- a/cpukit/score/src/userextthreadcreate.c +++ b/cpukit/score/src/userextthreadcreate.c @@ -32,7 +32,7 @@ bool _User_extensions_Thread_create ( User_extensions_Control *the_extension; bool status; - for ( the_node = _User_extensions_List.first ; + for ( the_node = _Chain_First( &_User_extensions_List ); !_Chain_Is_tail( &_User_extensions_List, the_node ) ; the_node = the_node->next ) { diff --git a/cpukit/score/src/userextthreaddelete.c b/cpukit/score/src/userextthreaddelete.c index 393580f3ab..39397fea84 100644 --- a/cpukit/score/src/userextthreaddelete.c +++ b/cpukit/score/src/userextthreaddelete.c @@ -31,7 +31,7 @@ void _User_extensions_Thread_delete ( Chain_Node *the_node; User_extensions_Control *the_extension; - for ( the_node = _User_extensions_List.last ; + for ( the_node = _Chain_Last( &_User_extensions_List ); !_Chain_Is_head( &_User_extensions_List, the_node ) ; the_node = the_node->previous ) { diff --git a/cpukit/score/src/userextthreadrestart.c b/cpukit/score/src/userextthreadrestart.c index f159c8bb0e..c2a4d69e6a 100644 --- a/cpukit/score/src/userextthreadrestart.c +++ b/cpukit/score/src/userextthreadrestart.c @@ -31,7 +31,7 @@ void _User_extensions_Thread_restart ( Chain_Node *the_node; User_extensions_Control *the_extension; - for ( the_node = _User_extensions_List.first ; + for ( the_node = _Chain_First( &_User_extensions_List ); !_Chain_Is_tail( &_User_extensions_List, the_node ) ; the_node = the_node->next ) { diff --git a/cpukit/score/src/userextthreadstart.c b/cpukit/score/src/userextthreadstart.c index e6364e158a..0fbe6ab755 100644 --- a/cpukit/score/src/userextthreadstart.c +++ b/cpukit/score/src/userextthreadstart.c @@ -31,7 +31,7 @@ void _User_extensions_Thread_start ( Chain_Node *the_node; User_extensions_Control *the_extension; - for ( the_node = _User_extensions_List.first ; + for ( the_node = _Chain_First( &_User_extensions_List ); !_Chain_Is_tail( &_User_extensions_List, the_node ) ; the_node = the_node->next ) { diff --git a/cpukit/score/src/userextthreadswitch.c b/cpukit/score/src/userextthreadswitch.c index 10ab6b6583..026b56d9de 100644 --- a/cpukit/score/src/userextthreadswitch.c +++ b/cpukit/score/src/userextthreadswitch.c @@ -32,7 +32,7 @@ void _User_extensions_Thread_switch ( Chain_Node *the_node; User_extensions_Switch_control *the_extension_switch; - for ( the_node = _User_extensions_Switches_list.first ; + for ( the_node = _Chain_First( &_User_extensions_Switches_list ); !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ; the_node = the_node->next ) { diff --git a/cpukit/score/src/watchdogreportchain.c b/cpukit/score/src/watchdogreportchain.c index 20a5827f97..8b616914c6 100644 --- a/cpukit/score/src/watchdogreportchain.c +++ b/cpukit/score/src/watchdogreportchain.c @@ -34,7 +34,7 @@ void _Watchdog_Report_chain( _ISR_Disable( level ); printk( "Watchdog Chain: %s %p\n", name, header ); if ( !_Chain_Is_empty( header ) ) { - for ( node = header->first ; + for ( node = _Chain_First( header ) ; node != _Chain_Tail(header) ; node = node->next ) { |