I'm fine with both of these v2 patches.
On Tue, Apr 6, 2021 at 8:07 AM Sebastian Huber <sebastian.hu...@embedded-brains.de> wrote: > > Replace Objects_Name_or_id_lookup_errors with new Status_Control codes. > Get rid of the _Status_Object_name_errors_to_status lookup table. > --- > cpukit/Makefile.am | 1 - > cpukit/include/rtems/rtems/statusimpl.h | 8 ---- > cpukit/include/rtems/score/objectimpl.h | 44 ++++---------------- > cpukit/include/rtems/score/objectmp.h | 8 ++-- > cpukit/include/rtems/score/status.h | 12 ++++++ > cpukit/rtems/src/rtemsnametoid.c | 4 +- > cpukit/rtems/src/rtemsobjectgetclassicname.c | 4 +- > cpukit/rtems/src/status.c | 31 -------------- > cpukit/rtems/src/taskconstruct.c | 4 ++ > cpukit/score/src/objectidtoname.c | 10 ++--- > cpukit/score/src/objectmp.c | 10 ++--- > cpukit/score/src/objectnametoid.c | 10 ++--- > spec/build/cpukit/librtemscpu.yml | 1 - > 13 files changed, 46 insertions(+), 101 deletions(-) > delete mode 100644 cpukit/rtems/src/status.c > > diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am > index 5c74ad0e32..d6b636bf2a 100644 > --- a/cpukit/Makefile.am > +++ b/cpukit/Makefile.am > @@ -785,7 +785,6 @@ librtemscpu_a_SOURCES += rtems/src/semrelease.c > librtemscpu_a_SOURCES += rtems/src/semsetpriority.c > librtemscpu_a_SOURCES += rtems/src/signalcatch.c > librtemscpu_a_SOURCES += rtems/src/signalsend.c > -librtemscpu_a_SOURCES += rtems/src/status.c > librtemscpu_a_SOURCES += rtems/src/statustext.c > librtemscpu_a_SOURCES += rtems/src/statustoerrno.c > librtemscpu_a_SOURCES += rtems/src/systemeventreceive.c > diff --git a/cpukit/include/rtems/rtems/statusimpl.h > b/cpukit/include/rtems/rtems/statusimpl.h > index 070c612202..f1944179e9 100644 > --- a/cpukit/include/rtems/rtems/statusimpl.h > +++ b/cpukit/include/rtems/rtems/statusimpl.h > @@ -36,14 +36,6 @@ extern "C" { > * @{ > */ > > -/** > - * @brief Status Object Name Errors to Status Array > - * > - * This array is used to map SuperCore Object Handler return > - * codes to Classic API status codes. > - */ > -extern const rtems_status_code _Status_Object_name_errors_to_status[]; > - > RTEMS_INLINE_ROUTINE rtems_status_code _Status_Get( > Status_Control status > ) > diff --git a/cpukit/include/rtems/score/objectimpl.h > b/cpukit/include/rtems/score/objectimpl.h > index 8ba8189976..54d6f0841b 100644 > --- a/cpukit/include/rtems/score/objectimpl.h > +++ b/cpukit/include/rtems/score/objectimpl.h > @@ -189,36 +189,6 @@ unsigned int _Objects_API_maximum_class( > */ > Objects_Control *_Objects_Allocate( Objects_Information *information ); > > -/** > - * This function implements the common portion of the object > - * identification directives. This directive returns the object > - * id associated with name. If more than one object of this class > - * is named name, then the object to which the id belongs is > - * arbitrary. Node indicates the extent of the search for the > - * id of the object named name. If the object class supports global > - * objects, then the search can be limited to a particular node > - * or allowed to encompass all nodes. > - */ > -typedef enum { > - OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL, > - OBJECTS_INVALID_NAME, > - OBJECTS_INVALID_ADDRESS, > - OBJECTS_INVALID_ID, > - OBJECTS_INVALID_NODE > -} Objects_Name_or_id_lookup_errors; > - > -/** > - * This macro defines the first entry in the > - * @ref Objects_Name_or_id_lookup_errors enumerated list. > - */ > -#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL > - > -/** > - * This macro defines the last entry in the > - * @ref Objects_Name_or_id_lookup_errors enumerated list. > - */ > -#define OBJECTS_NAME_ERRORS_LAST OBJECTS_INVALID_NODE > - > /** > * @brief Searches an object of the specified class with the specified name > on > * the specified set of nodes. > @@ -233,12 +203,12 @@ typedef enum { > * operation was successful. > * @param information is the pointer to an object class information block. > * > - * @retval OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL The operations was > successful. > - * @retval OBJECTS_INVALID_ADDRESS The id parameter was NULL. > - * @retval OBJECTS_INVALID_NAME No object exists with the specified name on > the > + * @retval STATUS_SUCCESSFUL The operations was successful. > + * @retval STATUS_INVALID_ADDRESS The id parameter was NULL. > + * @retval STATUS_INVALID_NAME No object exists with the specified name on > the > * specified node set. > */ > -Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( > +Status_Control _Objects_Name_to_id_u32( > uint32_t name, > uint32_t node, > Objects_Id *id, > @@ -282,13 +252,13 @@ Objects_Control *_Objects_Get_by_name( > * @param id is the Id of the object whose name we are locating. > * @param[out] name will contain the name of the object, if found. > * > - * @retval OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL The operation succeeded. @a > name > + * @retval STATUS_SUCCESSFUL The operation succeeded. @a name > * contains the name of the object. > - * @retval OBJECTS_INVALID_ID The id is invalid, the operation failed. > + * @retval STATUS_INVALID_ID The id is invalid, the operation failed. > * > * @note This function currently does not support string names. > */ > -Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( > +Status_Control _Objects_Id_to_name ( > Objects_Id id, > Objects_Name *name > ); > diff --git a/cpukit/include/rtems/score/objectmp.h > b/cpukit/include/rtems/score/objectmp.h > index 4f41fefe40..9107e2b3b6 100644 > --- a/cpukit/include/rtems/score/objectmp.h > +++ b/cpukit/include/rtems/score/objectmp.h > @@ -143,12 +143,12 @@ void _Objects_MP_Close ( > * @param nodes_to_search Indicates the set of nodes to search. > * @param[out] the_id will contain the Id of the object if found. > * > - * @retval OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL The lookup was successful. > - * @retval OBJECTS_INVALID_NODE The number of nodes is bigger than the > + * @retval STATUS_SUCCESSFUL The lookup was successful. > + * @retval STATUS_INVALID_NODE The number of nodes is bigger than the > * objects maximum nodes value. > - * @retval OBJECTS_INVALID_NAME There is no global object with this name. > + * @retval STATUS_INVALID_NAME There is no global object with this name. > */ > -Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search ( > +Status_Control _Objects_MP_Global_name_search ( > const Objects_Information *information, > Objects_Name the_name, > uint32_t nodes_to_search, > diff --git a/cpukit/include/rtems/score/status.h > b/cpukit/include/rtems/score/status.h > index a1c3c84b4d..ba3910d40d 100644 > --- a/cpukit/include/rtems/score/status.h > +++ b/cpukit/include/rtems/score/status.h > @@ -51,6 +51,10 @@ extern "C" { > typedef enum { > STATUS_CLASSIC_INCORRECT_STATE = 14, > STATUS_CLASSIC_INTERNAL_ERROR = 25, > + STATUS_CLASSIC_INVALID_ADDRESS = 9, > + STATUS_CLASSIC_INVALID_ID = 4, > + STATUS_CLASSIC_INVALID_NAME = 3, > + STATUS_CLASSIC_INVALID_NODE = 21, > STATUS_CLASSIC_INVALID_NUMBER = 10, > STATUS_CLASSIC_INVALID_PRIORITY = 19, > STATUS_CLASSIC_INVALID_SIZE = 8, > @@ -102,6 +106,14 @@ typedef enum { > STATUS_BUILD( STATUS_CLASSIC_INCORRECT_STATE, EINVAL ), > STATUS_INTERRUPTED = > STATUS_BUILD( STATUS_CLASSIC_INTERNAL_ERROR, EINTR ), > + STATUS_INVALID_ADDRESS = > + STATUS_BUILD( STATUS_CLASSIC_INVALID_ADDRESS, EFAULT ), > + STATUS_INVALID_ID = > + STATUS_BUILD( STATUS_CLASSIC_INVALID_ID, EINVAL ), > + STATUS_INVALID_NODE = > + STATUS_BUILD( STATUS_CLASSIC_INVALID_NODE, EINVAL ), > + STATUS_INVALID_NAME = > + STATUS_BUILD( STATUS_CLASSIC_INVALID_NAME, EINVAL ), > STATUS_INVALID_NUMBER = > STATUS_BUILD( STATUS_CLASSIC_INVALID_NUMBER, EINVAL ), > STATUS_INVALID_PRIORITY = > diff --git a/cpukit/rtems/src/rtemsnametoid.c > b/cpukit/rtems/src/rtemsnametoid.c > index d9b374bc3c..5f04ce5153 100644 > --- a/cpukit/rtems/src/rtemsnametoid.c > +++ b/cpukit/rtems/src/rtemsnametoid.c > @@ -48,9 +48,9 @@ rtems_status_code _RTEMS_Name_to_id( > const Objects_Information *information > ) > { > - Objects_Name_or_id_lookup_errors status; > + Status_Control status; > > status = _Objects_Name_to_id_u32( name, node, id, information ); > > - return _Status_Object_name_errors_to_status[ status ]; > + return _Status_Get( status ); > } > diff --git a/cpukit/rtems/src/rtemsobjectgetclassicname.c > b/cpukit/rtems/src/rtemsobjectgetclassicname.c > index 52d4f8474b..315d4266f2 100644 > --- a/cpukit/rtems/src/rtemsobjectgetclassicname.c > +++ b/cpukit/rtems/src/rtemsobjectgetclassicname.c > @@ -29,7 +29,7 @@ rtems_status_code rtems_object_get_classic_name( > rtems_name *name > ) > { > - Objects_Name_or_id_lookup_errors status; > + Status_Control status; > Objects_Name name_u; > > if ( !name ) > @@ -38,5 +38,5 @@ rtems_status_code rtems_object_get_classic_name( > status = _Objects_Id_to_name( id, &name_u ); > > *name = name_u.name_u32; > - return _Status_Object_name_errors_to_status[ status ]; > + return _Status_Get( status ); > } > diff --git a/cpukit/rtems/src/status.c b/cpukit/rtems/src/status.c > deleted file mode 100644 > index a4aebd2c05..0000000000 > --- a/cpukit/rtems/src/status.c > +++ /dev/null > @@ -1,31 +0,0 @@ > -/** > - * @file > - * > - * @ingroup RTEMSImplClassic > - * > - * @brief This source file contains the definition of > - * ::_Status_Object_name_errors_to_status. > - */ > - > -/* COPYRIGHT (c) 1989-2013. > - * 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. > - */ > - > -#include <rtems/rtems/statusimpl.h> > - > -const rtems_status_code _Status_Object_name_errors_to_status[] = { > - /** This maps OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL to RTEMS_SUCCESSFUL. */ > - RTEMS_SUCCESSFUL, > - /** This maps OBJECTS_INVALID_NAME to RTEMS_INVALID_NAME. */ > - RTEMS_INVALID_NAME, > - /** This maps OBJECTS_INVALID_ADDRESS to RTEMS_INVALID_ADDRESS. */ > - RTEMS_INVALID_ADDRESS, > - /** This maps OBJECTS_INVALID_ID to RTEMS_INVALID_ID. */ > - RTEMS_INVALID_ID, > - /** This maps OBJECTS_INVALID_NODE to RTEMS_INVALID_NODE. */ > - RTEMS_INVALID_NODE > -}; > diff --git a/cpukit/rtems/src/taskconstruct.c > b/cpukit/rtems/src/taskconstruct.c > index 2cddb448f6..a39db3a7ae 100644 > --- a/cpukit/rtems/src/taskconstruct.c > +++ b/cpukit/rtems/src/taskconstruct.c > @@ -43,6 +43,10 @@ > > STATUS_ASSERT( INCORRECT_STATE ); > STATUS_ASSERT( INTERNAL_ERROR ); > +STATUS_ASSERT( INVALID_ADDRESS ); > +STATUS_ASSERT( INVALID_ID ); > +STATUS_ASSERT( INVALID_NAME ); > +STATUS_ASSERT( INVALID_NODE ); > STATUS_ASSERT( INVALID_NUMBER ); > STATUS_ASSERT( INVALID_PRIORITY ); > STATUS_ASSERT( INVALID_SIZE ); > diff --git a/cpukit/score/src/objectidtoname.c > b/cpukit/score/src/objectidtoname.c > index a959636870..f35f59f8d1 100644 > --- a/cpukit/score/src/objectidtoname.c > +++ b/cpukit/score/src/objectidtoname.c > @@ -22,7 +22,7 @@ > > #include <rtems/score/threadimpl.h> > > -Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( > +Status_Control _Objects_Id_to_name ( > Objects_Id id, > Objects_Name *name > ) > @@ -40,10 +40,10 @@ Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( > > information = _Objects_Get_information_id( tmpId ); > if ( !information ) > - return OBJECTS_INVALID_ID; > + return STATUS_INVALID_ID; > > if ( _Objects_Has_string_name( information ) ) > - return OBJECTS_INVALID_ID; > + return STATUS_INVALID_ID; > > the_object = _Objects_Get( > tmpId, > @@ -51,9 +51,9 @@ Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( > information > ); > if ( !the_object ) > - return OBJECTS_INVALID_ID; > + return STATUS_INVALID_ID; > > *name = the_object->name; > _ISR_lock_ISR_enable( &lock_context ); > - return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL; > + return STATUS_SUCCESSFUL; > } > diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c > index b44ef65e94..f3ecbbf7b2 100644 > --- a/cpukit/score/src/objectmp.c > +++ b/cpukit/score/src/objectmp.c > @@ -293,19 +293,19 @@ void _Objects_MP_Close ( > } > } > > -Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search( > +Status_Control _Objects_MP_Global_name_search( > const Objects_Information *information, > Objects_Name the_name, > uint32_t nodes_to_search, > Objects_Id *the_id > ) > { > - Objects_Name_or_id_lookup_errors status; > + Status_Control status; > Objects_MP_Control *the_global_object; > ISR_lock_Context lock_context; > > if ( nodes_to_search > _Objects_Maximum_nodes ) { > - return OBJECTS_INVALID_NODE; > + return STATUS_INVALID_NODE; > } > > _Objects_MP_Global_acquire( &lock_context ); > @@ -336,9 +336,9 @@ Objects_Name_or_id_lookup_errors > _Objects_MP_Global_name_search( > if ( the_global_object != NULL ) { > *the_id = the_global_object->id; > _Assert( the_global_object->name.name_u32 != 0 ); > - status = OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL; > + status = STATUS_SUCCESSFUL; > } else { > - status = OBJECTS_INVALID_NAME; > + status = STATUS_INVALID_NAME; > } > > _Objects_MP_Global_release( &lock_context ); > diff --git a/cpukit/score/src/objectnametoid.c > b/cpukit/score/src/objectnametoid.c > index c70410d955..063cf36398 100644 > --- a/cpukit/score/src/objectnametoid.c > +++ b/cpukit/score/src/objectnametoid.c > @@ -27,7 +27,7 @@ static bool _Objects_Is_local_node_search( uint32_t node ) > return node == OBJECTS_SEARCH_LOCAL_NODE || _Objects_Is_local_node( node ); > } > > -Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( > +Status_Control _Objects_Name_to_id_u32( > uint32_t name, > uint32_t node, > Objects_Id *id, > @@ -41,7 +41,7 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( > _Assert( !_Objects_Has_string_name( information ) ); > > if ( id == NULL ) { > - return OBJECTS_INVALID_ADDRESS; > + return STATUS_INVALID_ADDRESS; > } > > if ( > @@ -61,19 +61,19 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( > if ( the_object != NULL && name == the_object->name.name_u32 ) { > *id = the_object->id; > _Assert( name != 0 ); > - return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL; > + return STATUS_SUCCESSFUL; > } > } > } > > #if defined(RTEMS_MULTIPROCESSING) > if ( _Objects_Is_local_node_search( node ) ) { > - return OBJECTS_INVALID_NAME; > + return STATUS_INVALID_NAME; > } > > name_for_mp.name_u32 = name; > return _Objects_MP_Global_name_search( information, name_for_mp, node, id > ); > #else > - return OBJECTS_INVALID_NAME; > + return STATUS_INVALID_NAME; > #endif > } > diff --git a/spec/build/cpukit/librtemscpu.yml > b/spec/build/cpukit/librtemscpu.yml > index a08cbb96e1..4ed91562f8 100644 > --- a/spec/build/cpukit/librtemscpu.yml > +++ b/spec/build/cpukit/librtemscpu.yml > @@ -1280,7 +1280,6 @@ source: > - cpukit/rtems/src/semsetpriority.c > - cpukit/rtems/src/signalcatch.c > - cpukit/rtems/src/signalsend.c > -- cpukit/rtems/src/status.c > - cpukit/rtems/src/statustext.c > - cpukit/rtems/src/statustoerrno.c > - cpukit/rtems/src/systemeventreceive.c > -- > 2.26.2 > > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel