diff options
-rw-r--r-- | cpukit/ChangeLog | 16 | ||||
-rw-r--r-- | cpukit/posix/src/cond.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/key.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/mqueuenametoid.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/mutex.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/pbarrier.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/prwlock.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/pspin.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/pthread.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/ptimer.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/semaphorenametoid.c | 2 | ||||
-rw-r--r-- | cpukit/rtems/src/rtemsobjectgetapiclassname.c | 26 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/object.h | 2 | ||||
-rw-r--r-- | cpukit/score/src/objectgetnameasstring.c | 9 | ||||
-rw-r--r-- | cpukit/score/src/objectnametoidstring.c | 22 | ||||
-rw-r--r-- | cpukit/score/src/objectsetname.c | 23 |
16 files changed, 59 insertions, 73 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index efbad93542..eab0f7c0ba 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,19 @@ +2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com> + + * posix/src/cond.c, posix/src/key.c, posix/src/mqueuenametoid.c, + posix/src/mutex.c, posix/src/pbarrier.c, posix/src/prwlock.c, + posix/src/pspin.c, posix/src/pthread.c, posix/src/ptimer.c, + posix/src/semaphorenametoid.c: Add option for all POSIX objects + whether named or unnamed to have a string name. If the API does + not directly support having a name, then the user must explicitly + assign it using rtems_object_set_name(). + * rtems/src/rtemsobjectgetapiclassname.c: Improved testability. + * score/include/rtems/score/object.h, + score/src/objectgetnameasstring.c, score/src/objectnametoidstring.c, + score/src/objectsetname.c: Modifications required to pass testing of + recently modified object name operations. Also eliminated + multiprocessing related code that was not reachable. + 2008-01-31 Jennifer Averett <jennifer.averett@OARcorp.com> * posix/src/timersettime.c: Fix to remove warning. diff --git a/cpukit/posix/src/cond.c b/cpukit/posix/src/cond.c index f99d617638..d120f4faf0 100644 --- a/cpukit/posix/src/cond.c +++ b/cpukit/posix/src/cond.c @@ -48,8 +48,8 @@ void _POSIX_Condition_variables_Manager_initialization( maximum_condition_variables, /* maximum objects of this class */ sizeof( POSIX_Condition_variables_Control ), /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - 0 /* maximum length of each object's name */ + TRUE, /* TRUE if names for this object are strings */ + _POSIX_PATH_MAX /* maximum length of each object's name */ #if defined(RTEMS_MULTIPROCESSING) , FALSE, /* TRUE if this is a global object class */ diff --git a/cpukit/posix/src/key.c b/cpukit/posix/src/key.c index a5052127f2..3b4776817b 100644 --- a/cpukit/posix/src/key.c +++ b/cpukit/posix/src/key.c @@ -42,8 +42,8 @@ void _POSIX_Key_Manager_initialization( maximum_keys, /* maximum objects of this class */ sizeof( POSIX_Keys_Control ), /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - 0 /* maximum length of each object's name */ + TRUE, /* TRUE if names for this object are strings */ + _POSIX_PATH_MAX /* maximum length of each object's name */ #if defined(RTEMS_MULTIPROCESSING) , FALSE, /* TRUE if this is a global object class */ diff --git a/cpukit/posix/src/mqueuenametoid.c b/cpukit/posix/src/mqueuenametoid.c index bc74e7d182..06b3964683 100644 --- a/cpukit/posix/src/mqueuenametoid.c +++ b/cpukit/posix/src/mqueuenametoid.c @@ -64,7 +64,7 @@ int _POSIX_Message_queue_Name_to_id( return ENAMETOOLONG; status = _Objects_Name_to_id_string( - &_POSIX_Message_queue_Information, name, 0, id ); + &_POSIX_Message_queue_Information, name, id ); if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL ) return 0; diff --git a/cpukit/posix/src/mutex.c b/cpukit/posix/src/mutex.c index de0d35e7d7..1e41e4f7f2 100644 --- a/cpukit/posix/src/mutex.c +++ b/cpukit/posix/src/mutex.c @@ -49,8 +49,8 @@ void _POSIX_Mutex_Manager_initialization( maximum_mutexes, /* maximum objects of this class */ sizeof( POSIX_Mutex_Control ), /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - 0 /* maximum length of each object's name */ + TRUE, /* TRUE if names for this object are strings */ + _POSIX_PATH_MAX /* maximum length of each object's name */ #if defined(RTEMS_MULTIPROCESSING) , FALSE, /* TRUE if this is a global object class */ diff --git a/cpukit/posix/src/pbarrier.c b/cpukit/posix/src/pbarrier.c index 1b1c285b09..05b0f9d801 100644 --- a/cpukit/posix/src/pbarrier.c +++ b/cpukit/posix/src/pbarrier.c @@ -49,8 +49,8 @@ void _POSIX_Barrier_Manager_initialization( OBJECTS_POSIX_BARRIERS, /* object class */ maximum_barriers, /* maximum objects of this class */ sizeof( POSIX_Barrier_Control ),/* size of this object's control block */ - FALSE, /* TRUE if the name is a string */ - 0 /* maximum length of an object name */ + TRUE, /* TRUE if the name is a string */ + _POSIX_PATH_MAX /* maximum length of each object's name */ #if defined(RTEMS_MULTIPROCESSING) , FALSE, /* TRUE if this is a global object class */ diff --git a/cpukit/posix/src/prwlock.c b/cpukit/posix/src/prwlock.c index 37197a88b0..5d4cf0b474 100644 --- a/cpukit/posix/src/prwlock.c +++ b/cpukit/posix/src/prwlock.c @@ -37,8 +37,8 @@ void _POSIX_RWLock_Manager_initialization( OBJECTS_POSIX_SPINLOCKS, /* object class */ maximum_rwlocks, /* maximum objects of this class */ sizeof( POSIX_RWLock_Control ), /* size of this object's control block */ - FALSE, /* TRUE if the name is a string */ - 0 /* maximum length of an object name */ + TRUE, /* TRUE if the name is a string */ + _POSIX_PATH_MAX /* maximum length of each object's name */ #if defined(RTEMS_MULTIPROCESSING) , FALSE, /* TRUE if this is a global object class */ diff --git a/cpukit/posix/src/pspin.c b/cpukit/posix/src/pspin.c index 4a1379de27..fd2dfc51a8 100644 --- a/cpukit/posix/src/pspin.c +++ b/cpukit/posix/src/pspin.c @@ -49,8 +49,8 @@ void _POSIX_Spinlock_Manager_initialization( OBJECTS_POSIX_SPINLOCKS, /* object class */ maximum_spinlocks, /* maximum objects of this class */ sizeof( POSIX_Spinlock_Control ),/* size of this object's control block */ - FALSE, /* TRUE if the name is a string */ - 0 /* maximum length of an object name */ + TRUE, /* TRUE if the name is a string */ + _POSIX_PATH_MAX /* maximum length of each object's name */ #if defined(RTEMS_MULTIPROCESSING) , FALSE, /* TRUE if this is a global object class */ diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c index 4504a616a4..840aabc891 100644 --- a/cpukit/posix/src/pthread.c +++ b/cpukit/posix/src/pthread.c @@ -339,8 +339,8 @@ void _POSIX_Threads_Manager_initialization( maximum_pthreads, /* maximum objects of this class */ sizeof( Thread_Control ), /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - 0 /* maximum length of each object's name */ + TRUE, /* TRUE if names for this object are strings */ + _POSIX_PATH_MAX /* maximum length of each object's name */ #if defined(RTEMS_MULTIPROCESSING) , FALSE, /* TRUE if this is a global object class */ diff --git a/cpukit/posix/src/ptimer.c b/cpukit/posix/src/ptimer.c index 70af834e67..570646e906 100644 --- a/cpukit/posix/src/ptimer.c +++ b/cpukit/posix/src/ptimer.c @@ -57,7 +57,7 @@ void _POSIX_Timer_Manager_initialization ( int maximum_timers ) maximum_timers, /* maximum objects of this class */ sizeof( POSIX_Timer_Control ), /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ + TRUE, /* TRUE if names for this object are strings */ _POSIX_PATH_MAX /* maximum length of each object's name */ #if defined(RTEMS_MULTIPROCESSING) , diff --git a/cpukit/posix/src/semaphorenametoid.c b/cpukit/posix/src/semaphorenametoid.c index 071745c3d5..4acee37ce6 100644 --- a/cpukit/posix/src/semaphorenametoid.c +++ b/cpukit/posix/src/semaphorenametoid.c @@ -49,7 +49,7 @@ int _POSIX_Semaphore_Name_to_id( return EINVAL; status = _Objects_Name_to_id_string( - &_POSIX_Semaphore_Information, name, 0, (Objects_Id*)id ); + &_POSIX_Semaphore_Information, name, (Objects_Id*)id ); if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL ) return 0; diff --git a/cpukit/rtems/src/rtemsobjectgetapiclassname.c b/cpukit/rtems/src/rtemsobjectgetapiclassname.c index ebf36339d7..0b99e83e49 100644 --- a/cpukit/rtems/src/rtemsobjectgetapiclassname.c +++ b/cpukit/rtems/src/rtemsobjectgetapiclassname.c @@ -77,26 +77,20 @@ const char *rtems_object_get_api_class_name( const rtems_assoc_t *api_assoc; const rtems_assoc_t *class_assoc; - switch (the_api) { - case OBJECTS_INTERNAL_API: - api_assoc = rtems_object_api_internal_assoc; - break; - case OBJECTS_CLASSIC_API: - api_assoc = rtems_object_api_classic_assoc; - break; + if ( the_api == OBJECTS_INTERNAL_API ) + api_assoc = rtems_object_api_internal_assoc; + else if ( the_api == OBJECTS_CLASSIC_API ) + api_assoc = rtems_object_api_classic_assoc; #ifdef RTEMS_POSIX_API - case OBJECTS_POSIX_API: - api_assoc = rtems_object_api_posix_assoc; - break; + else if ( the_api == OBJECTS_POSIX_API ) + api_assoc = rtems_object_api_posix_assoc; #endif #ifdef RTEMS_ITRON_API - case OBJECTS_ITRON_API: - api_assoc = rtems_object_api_itron_assoc; - break; + else if ( the_api == OBJECTS_ITRON_API ) + api_assoc = rtems_object_api_itron_assoc; #endif - default: - return "BAD API"; - } + else + return "BAD API"; class_assoc = rtems_assoc_ptr_by_local( api_assoc, the_class ); if ( class_assoc ) return class_assoc->name; diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h index 7ea986c6ec..88450b1b9f 100644 --- a/cpukit/score/include/rtems/score/object.h +++ b/cpukit/score/include/rtems/score/object.h @@ -625,7 +625,6 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( * * @param[in] information points to an object class information block. * @param[in] name is the name of the object to find. - * @param[in] node is the set of nodes to search. * @param[in] id will contain the Id if the search is successful. * * @return This method returns one of the values from the @@ -636,7 +635,6 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string( Objects_Information *information, const char *name, - uint32_t node, Objects_Id *id ); diff --git a/cpukit/score/src/objectgetnameasstring.c b/cpukit/score/src/objectgetnameasstring.c index 71c10370f0..ac70a5035d 100644 --- a/cpukit/score/src/objectgetnameasstring.c +++ b/cpukit/score/src/objectgetnameasstring.c @@ -34,7 +34,7 @@ char *_Objects_Get_name_as_string( char *name ) { - Objects_Information *information; + Objects_Information *information; const char *s; char *d; uint32_t i; @@ -77,8 +77,11 @@ char *_Objects_Get_name_as_string( s = lname; } - for ( i=0, d=name ; i<(length-1) && *s ; i++, s++, d++ ) { - *d = (!isprint(*s)) ? '*' : *s; + d = name; + if ( s ) { + for ( i=0 ; i<(length-1) && *s ; i++, s++, d++ ) { + *d = (isprint(*s)) ? *s : '*'; + } } *d = '\0'; diff --git a/cpukit/score/src/objectnametoidstring.c b/cpukit/score/src/objectnametoidstring.c index 2ab5d7e0c2..ffffe5819d 100644 --- a/cpukit/score/src/objectnametoidstring.c +++ b/cpukit/score/src/objectnametoidstring.c @@ -40,7 +40,6 @@ * Input parameters: * information - object information * name - user defined object name - * node - node indentifier (0 indicates any node) * id - address of return ID * * Output parameters: @@ -52,11 +51,9 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string( Objects_Information *information, const char *name, - uint32_t node, Objects_Id *id ) { - boolean search_local_node; Objects_Control *the_object; uint32_t index; uint32_t name_length; @@ -72,16 +69,7 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string( if ( !name ) return OBJECTS_INVALID_NAME; - search_local_node = FALSE; - - if ( information->maximum != 0 && - (node == OBJECTS_SEARCH_ALL_NODES || - node == OBJECTS_SEARCH_LOCAL_NODE || - _Objects_Is_local_node( node ) - )) - search_local_node = TRUE; - - if ( search_local_node ) { + if ( information->maximum != 0 ) { name_length = information->name_length; for ( index = 1; index <= information->maximum; index++ ) { @@ -99,13 +87,5 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string( } } -#if defined(RTEMS_MULTIPROCESSING) - if ( _Objects_Is_local_node( node ) || node == OBJECTS_SEARCH_LOCAL_NODE ) - return OBJECTS_INVALID_NAME; - - name_for_mp.name_p = name; - return _Objects_MP_Global_name_search( information, name_for_mp, node, id ); -#else return OBJECTS_INVALID_NAME; -#endif } diff --git a/cpukit/score/src/objectsetname.c b/cpukit/score/src/objectsetname.c index 455b4b51c3..727b9836eb 100644 --- a/cpukit/score/src/objectsetname.c +++ b/cpukit/score/src/objectsetname.c @@ -47,26 +47,21 @@ boolean _Objects_Set_name( if ( !d ) return FALSE; - if ( the_object->name.name_p ) + if ( the_object->name.name_p ) { _Workspace_Free( (void *)the_object->name.name_p ); - - the_object->name.name_p = NULL; + the_object->name.name_p = NULL; + } strncpy( d, name, length ); the_object->name.name_p = d; } else { - uint32_t name_u32 = 0; - char lname[5] = " "; - int i; - - for ( i=0 ; i<4 && i<length ; i++ ) - lname[ i ] = s[ i ]; + the_object->name.name_u32 = _Objects_Build_name( + ((0<length) ? s[ 0 ] : ' '), + ((1<length) ? s[ 1 ] : ' '), + ((2<length) ? s[ 2 ] : ' '), + ((3<length) ? s[ 3 ] : ' ') + ); - name_u32 |= ((uint32_t)lname[ 0 ] << 24); - name_u32 |= ((uint32_t)lname[ 1 ] << 16); - name_u32 |= ((uint32_t)lname[ 2 ] << 8); - name_u32 |= (uint32_t)lname[ 3 ]; - the_object->name.name_u32 = name_u32; } return TRUE; |