diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-23 22:57:43 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-23 22:57:43 +0000 |
commit | ce19f1fa3bd9f9760f680ef7839ca136a1c2478a (patch) | |
tree | aa2c0b50ec70dd5c9e8d970aaa7c8deba8fcf330 /cpukit/score/src | |
parent | 2008-01-23 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-ce19f1fa3bd9f9760f680ef7839ca136a1c2478a.tar.bz2 |
2008-01-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* itron/include/rtems/itron/object.h, itron/src/cre_tsk.c,
libblock/src/show_bdbuf.c, libmisc/capture/capture-cli.c,
libmisc/capture/capture.c, libmisc/monitor/mon-manager.c,
libmisc/stackchk/check.c, posix/src/condinit.c,
posix/src/keycreate.c, posix/src/mqueuecreatesupp.c,
posix/src/mqueuedeletesupp.c, posix/src/mqueuenametoid.c,
posix/src/mqueueopen.c, posix/src/mqueueunlink.c,
posix/src/mutexinit.c, posix/src/pbarrierinit.c,
posix/src/prwlockinit.c, posix/src/pspininit.c,
posix/src/pthreadcreate.c, posix/src/pthreadexit.c,
posix/src/semaphorecreatesupp.c, posix/src/semaphorenametoid.c,
posix/src/timercreate.c, rtems/src/barrierident.c,
rtems/src/dpmemident.c, rtems/src/msgqident.c, rtems/src/partident.c,
rtems/src/ratemonident.c, rtems/src/regionident.c,
rtems/src/semident.c, rtems/src/taskident.c, rtems/src/timerident.c,
sapi/src/extensionident.c, score/Makefile.am,
score/include/rtems/score/object.h,
score/inline/rtems/score/object.inl, score/src/apimutexallocate.c,
score/src/objectextendinformation.c,
score/src/objectgetnameasstring.c, score/src/objectmp.c,
score/src/objectnametoid.c: Convert the Objects_Name type from a
simple type to a union of an unsigned 32 bit integer and a pointer.
This should help eliminate weird casts between u32 and pointers in
various places. The APIs now have to explicitly call _u32 or _string
versions of helper routines. This should also simplify things and
eliminate the need for ugly casts in some cases.
* score/src/objectclearname.c, score/src/objectcomparenameraw.c,
score/src/objectcomparenamestring.c, score/src/objectcopynameraw.c,
score/src/objectcopynamestring.c: Removed.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r-- | cpukit/score/src/apimutexallocate.c | 3 | ||||
-rw-r--r-- | cpukit/score/src/objectclearname.c | 50 | ||||
-rw-r--r-- | cpukit/score/src/objectcomparenameraw.c | 61 | ||||
-rw-r--r-- | cpukit/score/src/objectcomparenamestring.c | 57 | ||||
-rw-r--r-- | cpukit/score/src/objectcopynameraw.c | 50 | ||||
-rw-r--r-- | cpukit/score/src/objectcopynamestring.c | 53 | ||||
-rw-r--r-- | cpukit/score/src/objectextendinformation.c | 14 | ||||
-rw-r--r-- | cpukit/score/src/objectgetnameasstring.c | 6 | ||||
-rw-r--r-- | cpukit/score/src/objectmp.c | 4 | ||||
-rw-r--r-- | cpukit/score/src/objectnametoid.c | 18 |
10 files changed, 21 insertions, 295 deletions
diff --git a/cpukit/score/src/apimutexallocate.c b/cpukit/score/src/apimutexallocate.c index 627a33dae4..4d96868cb3 100644 --- a/cpukit/score/src/apimutexallocate.c +++ b/cpukit/score/src/apimutexallocate.c @@ -21,6 +21,7 @@ void _API_Mutex_Allocate( ) { API_Mutex_Control *mutex; + CORE_mutex_Attributes attr = { CORE_MUTEX_NESTING_IS_ERROR, FALSE, @@ -32,7 +33,7 @@ void _API_Mutex_Allocate( _CORE_mutex_Initialize( &mutex->Mutex, &attr, CORE_MUTEX_UNLOCKED ); - _Objects_Open( &_API_Mutex_Information, &mutex->Object, (Objects_Name) 1 ); + _Objects_Open_u32( &_API_Mutex_Information, &mutex->Object, 1 ); *the_mutex = mutex; } diff --git a/cpukit/score/src/objectclearname.c b/cpukit/score/src/objectclearname.c deleted file mode 100644 index f0845810ab..0000000000 --- a/cpukit/score/src/objectclearname.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/system.h> -#include <rtems/score/address.h> -#include <rtems/score/chain.h> -#include <rtems/score/object.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/objectmp.h> -#endif -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/isr.h> - -/*PAGE - * - * _Objects_Clear_name - * - * This method clears the specified name so that no caller can do a name to - * ID/object lookup past this point. - */ - -void _Objects_Clear_name( - void *name, - const size_t length -) -{ - size_t index; - size_t maximum = length / OBJECTS_NAME_ALIGNMENT; - uint32_t *name_ptr = (uint32_t *) name; - - for ( index=0 ; index < maximum ; index++ ) - *name_ptr++ = 0; -} diff --git a/cpukit/score/src/objectcomparenameraw.c b/cpukit/score/src/objectcomparenameraw.c deleted file mode 100644 index 870d55d651..0000000000 --- a/cpukit/score/src/objectcomparenameraw.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/system.h> -#include <rtems/score/address.h> -#include <rtems/score/chain.h> -#include <rtems/score/object.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/objectmp.h> -#endif -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/isr.h> - -/*PAGE - * - * _Objects_Compare_name_raw - * - * XXX - */ - -boolean _Objects_Compare_name_raw( - void *name_1, - void *name_2, - uint16_t length -) -{ -#if 0 - uint32_t *name_1_p = (uint32_t *) name_1; - uint32_t *name_2_p = (uint32_t *) name_2; - uint32_t tmp_length = length / OBJECTS_NAME_ALIGNMENT; -#endif - - if ( name_1 == name_2 ) - return TRUE; - return FALSE; - -#if 0 - while ( tmp_length-- ) - if ( *name_1_p++ != *name_2_p++ ) - return FALSE; - - return TRUE; -#endif -} diff --git a/cpukit/score/src/objectcomparenamestring.c b/cpukit/score/src/objectcomparenamestring.c deleted file mode 100644 index a9b3be1e7b..0000000000 --- a/cpukit/score/src/objectcomparenamestring.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989-2002. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/system.h> -#include <rtems/score/address.h> -#include <rtems/score/chain.h> -#include <rtems/score/object.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/objectmp.h> -#endif -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/isr.h> - -#include <string.h> - -/*PAGE - * - * _Objects_Compare_name_string - * - * This routine compares the name of an object with the specified string. - * - * Input parameters: - * name_1 - one name - * name_2 - other name - * length - maximum length to compare - * - * Output parameters: - * returns - TRUE on a match - */ - -boolean _Objects_Compare_name_string( - void *name_1, - void *name_2, - uint16_t length -) -{ - if ( !strncmp( name_1, name_2, length ) ) - return TRUE; - return FALSE; -} diff --git a/cpukit/score/src/objectcopynameraw.c b/cpukit/score/src/objectcopynameraw.c deleted file mode 100644 index 5534323a4c..0000000000 --- a/cpukit/score/src/objectcopynameraw.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/system.h> -#include <rtems/score/address.h> -#include <rtems/score/chain.h> -#include <rtems/score/object.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/objectmp.h> -#endif -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/isr.h> - -/*PAGE - * - * _Objects_Copy_name_raw - * - * XXX - */ - -void _Objects_Copy_name_raw( - const void *source, - void *destination, - const size_t length -) -{ - uint32_t *source_p = (uint32_t *) source; - uint32_t *destination_p = (uint32_t *) destination; - size_t tmp_length = length / OBJECTS_NAME_ALIGNMENT; - - while ( tmp_length-- ) - *destination_p++ = *source_p++; -} diff --git a/cpukit/score/src/objectcopynamestring.c b/cpukit/score/src/objectcopynamestring.c deleted file mode 100644 index 764e9aa172..0000000000 --- a/cpukit/score/src/objectcopynamestring.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/system.h> -#include <rtems/score/address.h> -#include <rtems/score/chain.h> -#include <rtems/score/object.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/objectmp.h> -#endif -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/isr.h> - -/*PAGE - * - * _Objects_Copy_name_string - * - * XXX - */ - -void _Objects_Copy_name_string( - const void *source, - void *destination, - const size_t length -) -{ - uint8_t *source_p = (uint8_t *) source; - uint8_t *destination_p = (uint8_t *) destination; - - *destination_p = '\0'; - if ( source_p ) { - do { - *destination_p++ = *source_p; - } while ( *source_p++ ); - } -} diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c index 538ab139bb..8db0bf5b9b 100644 --- a/cpukit/score/src/objectextendinformation.c +++ b/cpukit/score/src/objectextendinformation.c @@ -84,7 +84,7 @@ void _Objects_Extend_information( if (index_base >= information->maximum ) { ISR_Level level; void **object_blocks; - Objects_Name *name_table; + void **name_table; uint32_t *inactive_per_block; Objects_Control **local_table; uint32_t maximum; @@ -147,7 +147,7 @@ void _Objects_Extend_information( inactive_per_block = (uint32_t *) _Addresses_Add_offset( object_blocks, block_count * sizeof(void*) ); - name_table = (Objects_Name *) _Addresses_Add_offset( + name_table = (void *) _Addresses_Add_offset( inactive_per_block, block_count * sizeof(uint32_t ) ); local_table = (Objects_Control **) _Addresses_Add_offset( name_table, block_count * sizeof(Objects_Name *) ); @@ -195,7 +195,7 @@ void _Objects_Extend_information( object_blocks[block_count] = NULL; inactive_per_block[block_count] = 0; - name_table[block_count] = NULL; + // name_table[block_count] = NULL; for ( index=index_base ; index < ( information->allocation_size + index_base ); @@ -209,7 +209,7 @@ void _Objects_Extend_information( information->object_blocks = object_blocks; information->inactive_per_block = inactive_per_block; - information->name_table = name_table; + information->name_table = (void *)name_table; information->local_table = local_table; information->maximum = maximum; information->maximum_id = _Objects_Build_id( @@ -253,7 +253,7 @@ void _Objects_Extend_information( information->object_blocks[ block ], (information->allocation_size * information->size) ); - information->name_table[ block ] = name_area; + // information->name_table[ block ] = name_area; /* * Initialize objects .. add to a local chain first. @@ -281,9 +281,7 @@ void _Objects_Extend_information( index ); - the_object->name = (void *) name_area; - - name_area = _Addresses_Add_offset( name_area, information->name_length ); + name_area = (void *)_Addresses_Add_offset( name_area, information->name_length ); _Chain_Append( &information->Inactive, &the_object->Node ); diff --git a/cpukit/score/src/objectgetnameasstring.c b/cpukit/score/src/objectgetnameasstring.c index a8b72c9d98..e19059ffd8 100644 --- a/cpukit/score/src/objectgetnameasstring.c +++ b/cpukit/score/src/objectgetnameasstring.c @@ -35,7 +35,7 @@ char *_Objects_Get_name_as_string( ) { Objects_Information *information; - char *s; + const char *s; char *d; uint32_t i; char lname[5]; @@ -65,9 +65,9 @@ char *_Objects_Get_name_as_string( case OBJECTS_LOCAL: if ( information->is_string ) { - s = the_object->name; + s = the_object->name.name_p; } else { - uint32_t u32_name = (uint32_t) the_object->name; + uint32_t u32_name = (uint32_t) the_object->name.name_u32; lname[ 0 ] = (u32_name >> 24) & 0xff; lname[ 1 ] = (u32_name >> 16) & 0xff; diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c index 1eb678557a..dae942cb63 100644 --- a/cpukit/score/src/objectmp.c +++ b/cpukit/score/src/objectmp.c @@ -192,7 +192,7 @@ Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search ( /* * NOTE: The local node was search (if necessary) by - * _Objects_Name_to_id before this was invoked. + * _Objects_Name_to_id_XXX before this was invoked. */ if ( !_Objects_Is_local_node( node_index ) ) { @@ -239,7 +239,7 @@ void _Objects_MP_Is_remote ( /* * NOTE: The local node was search (if necessary) by - * _Objects_Name_to_id before this was invoked. + * _Objects_Name_to_id_XXX before this was invoked. * * The NODE field of an object id cannot be 0 * because 0 is an invalid node number. diff --git a/cpukit/score/src/objectnametoid.c b/cpukit/score/src/objectnametoid.c index 03e9d1da28..cc523e17b9 100644 --- a/cpukit/score/src/objectnametoid.c +++ b/cpukit/score/src/objectnametoid.c @@ -2,7 +2,7 @@ * Object Handler * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -30,7 +30,7 @@ /*PAGE * - * _Objects_Name_to_id + * _Objects_Name_to_id_u32 * * These kernel routines search the object table(s) for the given * object name and returns the associated object id. @@ -47,9 +47,9 @@ * error code - if unsuccessful */ -Objects_Name_or_id_lookup_errors _Objects_Name_to_id( +Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( Objects_Information *information, - Objects_Name name, + uint32_t name, uint32_t node, Objects_Id *id ) @@ -58,7 +58,8 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id( Objects_Control *the_object; uint32_t index; uint32_t name_length; - Objects_Name_comparators compare_them; + + /* ASSERT: information->is_string == FALSE */ if ( !id ) return OBJECTS_INVALID_ADDRESS; @@ -78,15 +79,12 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id( if ( search_local_node ) { name_length = information->name_length; - if ( information->is_string ) compare_them = _Objects_Compare_name_string; - else compare_them = _Objects_Compare_name_raw; - for ( index = 1; index <= information->maximum; index++ ) { the_object = information->local_table[ index ]; - if ( !the_object || !the_object->name ) + if ( !the_object ) continue; - if ( (*compare_them)( name, the_object->name, name_length ) ) { + if ( name == the_object->name.name_u32 ) { *id = the_object->id; return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL; } |