diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-03 09:19:59 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-04 07:24:30 +0200 |
commit | 876dde7a7dc5c44952bea8503b5a45ebf7f5591c (patch) | |
tree | d631ffd578e1d9917601b7118e091e0eceb8b56b | |
parent | score: Simplify _Objects_Id_to_name() (diff) | |
download | rtems-876dde7a7dc5c44952bea8503b5a45ebf7f5591c.tar.bz2 |
score: Make _Objects_Information_table const
The _Objects_Information_table is statically initialized. So, we can
make it read-only.
-rw-r--r-- | cpukit/sapi/src/exinit.c | 3 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/objectimpl.h | 4 | ||||
-rw-r--r-- | cpukit/score/src/threadget.c | 14 | ||||
-rw-r--r-- | testsuites/sptests/sp43/init.c | 35 |
4 files changed, 5 insertions, 51 deletions
diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c index 69db694b72..7988a5b793 100644 --- a/cpukit/sapi/src/exinit.c +++ b/cpukit/sapi/src/exinit.c @@ -51,7 +51,8 @@ static Objects_Information *_RTEMS_Objects[ OBJECTS_RTEMS_CLASSES_LAST + 1 ]; static Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ]; -Objects_Information **_Objects_Information_table[ OBJECTS_APIS_LAST + 1 ] = { +Objects_Information ** const +_Objects_Information_table[ OBJECTS_APIS_LAST + 1 ] = { NULL, &_Internal_Objects[ 0 ], &_RTEMS_Objects[ 0 ], diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h index 1129daf32f..fe087719b7 100644 --- a/cpukit/score/include/rtems/score/objectimpl.h +++ b/cpukit/score/include/rtems/score/objectimpl.h @@ -213,8 +213,8 @@ extern uint16_t _Objects_Maximum_nodes; * class. From the ID, we can go to one of these information blocks, * and obtain a pointer to the appropriate object control block. */ -extern Objects_Information - **_Objects_Information_table[OBJECTS_APIS_LAST + 1]; +extern Objects_Information ** const +_Objects_Information_table[ OBJECTS_APIS_LAST + 1 ]; /** * This function extends an object class information record. diff --git a/cpukit/score/src/threadget.c b/cpukit/score/src/threadget.c index 45ea55f719..8731ab5d43 100644 --- a/cpukit/score/src/threadget.c +++ b/cpukit/score/src/threadget.c @@ -27,7 +27,6 @@ static Objects_Information *_Thread_Get_objects_information( { uint32_t the_api; uint32_t the_class; - Objects_Information **api_information; the_api = _Objects_Get_API( id ); if ( !_Objects_Is_api_valid( the_api ) ) { @@ -39,18 +38,7 @@ static Objects_Information *_Thread_Get_objects_information( return NULL; } - api_information = _Objects_Information_table[ the_api ]; - /* - * There is no way for this to happen if POSIX is enabled. But there - * is actually a test case in sp43 for this which trips it whether or - * not POSIX is enabled. So in the interest of safety, this is left - * on in all configurations. - */ - if ( !api_information ) { - return NULL; - } - - return api_information[ the_class ]; + return _Objects_Information_table[ the_api ][ the_class ]; } Thread_Control *_Thread_Get( diff --git a/testsuites/sptests/sp43/init.c b/testsuites/sptests/sp43/init.c index 03fe5a5958..a0025353ec 100644 --- a/testsuites/sptests/sp43/init.c +++ b/testsuites/sptests/sp43/init.c @@ -448,23 +448,6 @@ rtems_task Init( ); directive_failed( sc, "rtems_task_set_priority" ); - /* destroy internal API pointer */ - puts( "rtems_task_set_priority - clobber internal API info" ); - tmp = _Objects_Information_table[ api ]; - _Objects_Information_table[ api ] = NULL; - - puts( "rtems_task_set_priority - use valid Idle thread id again" ); - sc = rtems_task_set_priority( - rtems_build_id( class, api, 1, 1 ), - RTEMS_CURRENT_PRIORITY, - &old_priority - ); - fatal_directive_status( sc, RTEMS_INVALID_ID, "rtems_task_set_priority" ); - - /* restore pointer */ - puts( "rtems_task_set_priority - restore internal api info" ); - _Objects_Information_table[ api ] = tmp; - /* destroy internal API thread class pointer */ puts( "rtems_task_set_priority - clobber internal thread class info" ); tmp = _Objects_Information_table[ api ][ class ]; @@ -510,24 +493,6 @@ rtems_task Init( ); fatal_directive_status( sc, RTEMS_INVALID_ID, "rtems_semaphore_obtain" ); - /* - * Invalid POSIX API pointer on get name - */ - { - void *tmp; - tmp = _Objects_Information_table[OBJECTS_POSIX_API]; - _Objects_Information_table[OBJECTS_POSIX_API] = NULL; - - puts( "rtems_object_get_classic_name - bad API pointer - INVALID_ID" ); - sc = rtems_object_get_classic_name( - rtems_build_id( OBJECTS_POSIX_API, OBJECTS_POSIX_THREADS, 1, 1 ), - &tmpName - ); - fatal_directive_status( sc, RTEMS_INVALID_ID, "object_get_classic_name" ); - - _Objects_Information_table[OBJECTS_POSIX_API] = tmp; - } - TEST_END(); rtems_test_exit( 0 ); } |