From ce19f1fa3bd9f9760f680ef7839ca136a1c2478a Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 23 Jan 2008 22:57:43 +0000 Subject: 2008-01-23 Joel Sherrill * 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. --- cpukit/score/include/rtems/score/object.h | 98 ++++++++++--------------------- 1 file changed, 31 insertions(+), 67 deletions(-) (limited to 'cpukit/score/include/rtems/score/object.h') diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h index 9b328a67a3..7ed0a8300b 100644 --- a/cpukit/score/include/rtems/score/object.h +++ b/cpukit/score/include/rtems/score/object.h @@ -33,7 +33,12 @@ extern "C" { * The following type defines the control block used to manage * object names. */ -typedef void * Objects_Name; +typedef union { + /** This is a pointer to a string name. */ + const char *name_p; + /** This is the actual 32-bit "raw" integer name. */ + uint32_t name_u32; +} Objects_Name; /** * Space for object names is allocated in multiples of this. @@ -337,7 +342,8 @@ typedef struct { /** This points to the table of local objects. */ Objects_Control **local_table; /** This points to the table of local object names. */ - Objects_Name *name_table; + /* XXX should be safe to remove this field */ + uint32_t **name_table; /** This is the chain of inactive control blocks. */ Chain_Control Inactive; /** This is the number of objects on the Inactive list. */ @@ -532,69 +538,6 @@ void _Objects_Free( Objects_Control *the_object ); -/** - * This method zeroes out the name. - * - * @param[in] name points to the name to be zeroed out. - * @param[in] length is the length of the object name field. - */ -void _Objects_Clear_name( - void *name, - const size_t length -); - -/** - * This method copies a string style object name from source to destination. - * - * @param[in] source is the source name to copy. - * @param[in] destination is the destination of the copy. - * @param[in] length is the number of bytes to copy. - */ -void _Objects_Copy_name_string( - const void *source, - void *destination, - const size_t length -); - -/** - * This method copies a raw style object name from source to destination. - * - * @param[in] source is the source name to copy. - * @param[in] destination is the destination of the copy. - * @param[in] length is the number of bytes to copy. - */ -void _Objects_Copy_name_raw( - const void *source, - void *destination, - const size_t length -); - -/** - * This method compares two string style object names. - * - * @param[in] name_1 is the left hand name to compare. - * @param[in] name_2 is the right hand name to compare. - * @param[in] length is the length of the names to compare. - */ -boolean _Objects_Compare_name_string( - void *name_1, - void *name_2, - uint16_t length -); - -/** - * This method compares two raw style object names. - * - * @param[in] name_1 is the left hand name to compare. - * @param[in] name_2 is the right hand name to compare. - * @param[in] length is the length of the names to compare. - */ -boolean _Objects_Compare_name_raw( - void *name_1, - void *name_2, - uint16_t length -); - /** * This function implements the common portion of the object * identification directives. This directive returns the object @@ -637,9 +580,30 @@ typedef enum { * successful or failure. On success @a id will contain the Id of * the requested object. */ -Objects_Name_or_id_lookup_errors _Objects_Name_to_id( +Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( + Objects_Information *information, + uint32_t name, + uint32_t node, + Objects_Id *id +); + +/** + * This method converts an object name to an Id. It performs a look up + * using the object information block for this object class. + * + * @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 + * @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. + */ +Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string( Objects_Information *information, - Objects_Name name, + const char *name, uint32_t node, Objects_Id *id ); -- cgit v1.2.3