From ee710ef483b76ebbd54cdc8fac05a228d9ef30ff Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 17 May 2016 15:11:16 +0200 Subject: score: Delete unused _Objects_Get() Update #2555. --- cpukit/score/Makefile.am | 2 +- cpukit/score/include/rtems/score/object.h | 2 +- cpukit/score/include/rtems/score/objectimpl.h | 116 ++++---------------------- cpukit/score/src/objectget.c | 80 ------------------ 4 files changed, 18 insertions(+), 182 deletions(-) delete mode 100644 cpukit/score/src/objectget.c diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index ac2f0b5cce..0fe78dad00 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -210,7 +210,7 @@ libscore_a_SOURCES += src/heap.c src/heapallocate.c src/heapextend.c \ ## OBJECT_C_FILES libscore_a_SOURCES += src/objectallocate.c src/objectclose.c \ - src/objectextendinformation.c src/objectfree.c src/objectget.c \ + src/objectextendinformation.c src/objectfree.c \ src/objectgetisr.c src/objectgetnext.c src/objectinitializeinformation.c \ src/objectnametoid.c src/objectnametoidstring.c \ src/objectshrinkinformation.c src/objectgetnoprotection.c \ diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h index c2acb2dbaa..6789c61fea 100644 --- a/cpukit/score/include/rtems/score/object.h +++ b/cpukit/score/include/rtems/score/object.h @@ -289,7 +289,7 @@ typedef struct { /** * The following defines the constant which may be used - * with _Objects_Get to manipulate the calling task. + * to manipulate the calling task. */ #define OBJECTS_ID_OF_SELF ((Objects_Id) 0) diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h index fe087719b7..4049bdcfe0 100644 --- a/cpukit/score/include/rtems/score/objectimpl.h +++ b/cpukit/score/include/rtems/score/objectimpl.h @@ -110,7 +110,7 @@ typedef enum { /** * This enumerated type lists the locations which may be returned - * by _Objects_Get. These codes indicate the success of locating + * by _Objects_Get_isr_disable. These codes indicate the success of locating * an object with the specified ID. */ typedef enum { @@ -405,45 +405,33 @@ Objects_Control *_Objects_Allocate( Objects_Information *information ); * @code * rtems_status_code some_delete( rtems_id id ) * { - * rtems_status_code sc; * Some_Control *some; - * Objects_Locations location; * * // The object allocator mutex protects the executing thread from * // asynchronous thread restart and deletion. * _Objects_Allocator_lock(); * - * // This will disable thread dispatching, so this starts a thread dispatch - * // critical section. + * // Get the object under protection of the object allocator mutex. * some = (Semaphore_Control *) - * _Objects_Get( &_Some_Information, id, &location ); - * - * switch ( location ) { - * case OBJECTS_LOCAL: - * // After the object close an object get with this identifier will - * // fail. - * _Objects_Close( &_Some_Information, &some->Object ); + * _Objects_Get_no_protection( id, &_Some_Information ); * - * _Some_Delete( some ); + * if ( some == NULL ) { + * _Objects_Allocator_unlock(); + * return RTEMS_INVALID_ID; + * } * - * // This enables thread dispatching, so the thread dispatch critical - * // section ends here. - * _Objects_Put( &some->Object ); + * // After the object close an object get with this identifier will + * // fail. + * _Objects_Close( &_Some_Information, &some->Object ); * - * // Thread dispatching is enabled. The object free is only protected - * // by the object allocator mutex. - * _Objects_Free( &_Some_Information, &some->Object ); + * _Some_Delete( some ); * - * sc = RTEMS_SUCCESSFUL; - * break; - * default: - * sc = RTEMS_INVALID_ID; - * break; - * } + * // Thread dispatching is enabled. The object free is only protected + * // by the object allocator mutex. + * _Objects_Free( &_Some_Information, &some->Object ); * * _Objects_Allocator_unlock(); - * - * return sc; + * return RTEMS_SUCCESSFUL; * } * @endcode */ @@ -554,38 +542,6 @@ Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( Objects_Name *name ); -/** - * @brief Maps object ids to object control blocks. - * - * This function maps object ids to object control blocks. - * If id corresponds to a local object, then it returns - * the_object control pointer which maps to id and location - * is set to OBJECTS_LOCAL. If the object class supports global - * objects and the object id is global and resides on a remote - * node, then location is set to OBJECTS_REMOTE, and the_object - * is undefined. Otherwise, location is set to OBJECTS_ERROR - * and the_object is undefined. - * - * @param[in] information points to an object class information block. - * @param[in] id is the Id of the object whose name we are locating. - * @param[in] location will contain an indication of success or failure. - * - * @retval This method returns one of the values from the - * @ref Objects_Name_or_id_lookup_errors enumeration to indicate - * successful or failure. On success @a id will contain the Id of - * the requested object. - * - * @note _Objects_Get returns with dispatching disabled for - * local and remote objects. _Objects_Get_isr_disable returns with - * dispatching disabled for remote objects and interrupts for local - * objects. - */ -Objects_Control *_Objects_Get ( - Objects_Information *information, - Objects_Id id, - Objects_Locations *location -); - /** * @brief Maps object ids to object control blocks. * @@ -607,11 +563,6 @@ Objects_Control *_Objects_Get ( * @ref Objects_Name_or_id_lookup_errors enumeration to indicate * successful or failure. On success @a name will contain the name of * the requested object. - * - * @note _Objects_Get returns with dispatching disabled for - * local and remote objects. _Objects_Get_isr_disable returns with - * dispatchng disabled for remote objects and interrupts for local - * objects. */ Objects_Control *_Objects_Get_isr_disable( Objects_Information *information, @@ -667,11 +618,6 @@ Objects_Control *_Objects_Get_local( * @ref Objects_Name_or_id_lookup_errors enumeration to indicate * successful or failure. On success @a id will contain the Id of * the requested object. - * - * @note _Objects_Get returns with dispatching disabled for - * local and remote objects. _Objects_Get_isr_disable returns with - * dispatching disabled for remote objects and interrupts for local - * objects. */ Objects_Control *_Objects_Get_no_protection( Objects_Id id, @@ -679,8 +625,7 @@ Objects_Control *_Objects_Get_no_protection( ); /** - * Like @ref _Objects_Get, but is used to find "next" open - * object. + * Gets the next open object after the specified object identifier. * * Locks the object allocator mutex in case a next object exists. * @@ -1059,35 +1004,6 @@ RTEMS_INLINE_ROUTINE void _Objects_Open_string( ); } -/** - * @brief Puts back an object obtained with _Objects_Get(). - * - * This function decrements the thread dispatch disable level. The - * _Thread_Dispatch() is called if the level reaches zero. - */ -RTEMS_INLINE_ROUTINE void _Objects_Put( - Objects_Control *the_object -) -{ - (void) the_object; - _Thread_Enable_dispatch(); -} - -/** - * @brief Puts back an object obtained with _Objects_Get(). - * - * This function decrements the thread dispatch disable level. The - * _Thread_Dispatch() is not called if the level reaches zero, thus a thread - * dispatch will not take place immediately on the current processor. - */ -RTEMS_INLINE_ROUTINE void _Objects_Put_without_thread_dispatch( - Objects_Control *the_object -) -{ - (void) the_object; - _Thread_Unnest_dispatch(); -} - /** * @brief Locks the object allocator mutex. * diff --git a/cpukit/score/src/objectget.c b/cpukit/score/src/objectget.c deleted file mode 100644 index 276c96094c..0000000000 --- a/cpukit/score/src/objectget.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * @file - * - * @brief Get Object - * @ingroup Score - */ - -/* - * 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.org/license/LICENSE. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -Objects_Control *_Objects_Get( - Objects_Information *information, - Objects_Id id, - Objects_Locations *location -) -{ - Objects_Control *the_object; - uint32_t index; - - /* - * Extract the index portion of an Id in a way that produces a valid - * index for objects within this class and an invalid value for objects - * outside this class. - * - * If the Id matches the api, class, and node but index portion is 0, - * then the subtraction will underflow and the addition of 1 will - * result in a 0 index. The zeroth element in the local_table is - * always NULL. - * - * If the Id is valid but the object has not been created yet, then - * the local_table entry will be NULL. - */ - index = id - information->minimum_id + 1; - - /* - * If the index is less than maximum, then it is OK to use it to - * index into the local_table array. - */ - if ( index <= information->maximum ) { - _Thread_Disable_dispatch(); - if ( (the_object = information->local_table[ index ]) != NULL ) { - *location = OBJECTS_LOCAL; - return the_object; - } - - /* - * Valid Id for this API, Class and Node but the object has not - * been allocated yet. - */ - _Thread_Enable_dispatch(); - *location = OBJECTS_ERROR; - return NULL; - } - - /* - * Object Id is not within this API and Class on this node. So - * it may be global in a multiprocessing system. But it is clearly - * invalid on a single processor system. - */ - -#if defined(RTEMS_MULTIPROCESSING) - *location = _Objects_MP_Is_remote( information, id ); -#else - *location = OBJECTS_ERROR; -#endif - - return NULL; -} -- cgit v1.2.3