forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -1,3 +1,21 @@
|
||||
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.
|
||||
|
||||
2010-11-24 Gedare Bloom <giddyup44@yahoo.com>
|
||||
|
||||
PR 1647/cpukit
|
||||
|
||||
@@ -926,7 +926,7 @@ _hash_search(
|
||||
)
|
||||
{
|
||||
uint32_t mod = (key1) % FAT_HASH_MODULE;
|
||||
rtems_chain_node *the_node = ((rtems_chain_control *)((hash) + mod))->first;
|
||||
rtems_chain_node *the_node = rtems_chain_first(hash + mod);
|
||||
|
||||
for ( ; !rtems_chain_is_tail((hash) + mod, the_node) ; )
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ void IMFS_dump_directory(
|
||||
|
||||
the_chain = &the_directory->info.directory.Entries;
|
||||
|
||||
for ( the_node = the_chain->first;
|
||||
for ( the_node = rtems_chain_first( the_chain );
|
||||
!rtems_chain_is_tail( the_chain, the_node );
|
||||
the_node = the_node->next ) {
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ ssize_t imfs_dir_read(
|
||||
return 0;
|
||||
|
||||
/* Move to the first of the desired directory entries */
|
||||
the_node = the_chain->first;
|
||||
the_node = rtems_chain_first( the_chain );
|
||||
|
||||
bytes_transferred = 0;
|
||||
first_entry = iop->offset;
|
||||
@@ -263,7 +263,7 @@ int imfs_dir_fstat(
|
||||
|
||||
/* Run through the chain and count the number of directory entries */
|
||||
/* that are subordinate to this directory node */
|
||||
for ( the_node = the_chain->first ;
|
||||
for ( the_node = rtems_chain_first( the_chain );
|
||||
!rtems_chain_is_tail( the_chain, the_node ) ;
|
||||
the_node = the_node->next ) {
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ IMFS_jnode_t *IMFS_find_match_in_dir(
|
||||
|
||||
the_chain = &directory->info.directory.Entries;
|
||||
|
||||
for ( the_node = the_chain->first;
|
||||
for ( the_node = rtems_chain_first( the_chain );
|
||||
!rtems_chain_is_tail( the_chain, the_node );
|
||||
the_node = the_node->next ) {
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ int killinfo(
|
||||
|
||||
the_chain = &_POSIX_signals_Wait_queue.Queues.Fifo;
|
||||
|
||||
for ( the_node = the_chain->first ;
|
||||
for ( the_node = _Chain_First( the_chain );
|
||||
!_Chain_Is_tail( the_chain, the_node ) ;
|
||||
the_node = the_node->next ) {
|
||||
|
||||
|
||||
@@ -138,10 +138,10 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_priority_Ready_queue_first(
|
||||
Chain_Control *the_ready_queue
|
||||
)
|
||||
{
|
||||
uint32_t index = _Priority_bit_map_Get_highest();
|
||||
Priority_Control index = _Priority_bit_map_Get_highest();
|
||||
|
||||
if ( !_Chain_Is_empty( &the_ready_queue[ index ] ) )
|
||||
return (Thread_Control *) the_ready_queue[ index ].first;
|
||||
return (Thread_Control *) _Chain_First( &the_ready_queue[ index ] );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ RTEMS_INLINE_ROUTINE Watchdog_Control *_Watchdog_First(
|
||||
)
|
||||
{
|
||||
|
||||
return ( (Watchdog_Control *) header->first );
|
||||
return ( (Watchdog_Control *) _Chain_First( header ) );
|
||||
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ RTEMS_INLINE_ROUTINE Watchdog_Control *_Watchdog_Last(
|
||||
)
|
||||
{
|
||||
|
||||
return ( (Watchdog_Control *) header->last );
|
||||
return ( (Watchdog_Control *) _Chain_Last( header ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 ) )
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 ) )
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user