summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-31 16:15:34 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-31 16:15:34 +0000
commit74d0cb441aee70c3bc87032fbac23ea4b7437b8b (patch)
tree167bdb4ddccfb3a3c65b1b590348bde2af8dba0c /cpukit/score
parent2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-74d0cb441aee70c3bc87032fbac23ea4b7437b8b.tar.bz2
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.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/include/rtems/score/object.h2
-rw-r--r--cpukit/score/src/objectgetnameasstring.c9
-rw-r--r--cpukit/score/src/objectnametoidstring.c22
-rw-r--r--cpukit/score/src/objectsetname.c23
4 files changed, 16 insertions, 40 deletions
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;