summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-18 07:25:23 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-18 15:36:58 +0100
commitc904df573396d95957dc79b242b3a76911063089 (patch)
treebe6406676689018e8af8a929b6a4ef5284f94c70 /cpukit/posix/include
parentsptests/sptls02: Use GNU++11 (diff)
downloadrtems-c904df573396d95957dc79b242b3a76911063089.tar.bz2
score: Add _Objects_Get_by_name()
Replace _Objects_Name_to_id_string() with _Objects_Get_by_name() since all users of this function are interested in the object itself and not the identifier. Use the object allocator lock to protect the search. Update #2555.
Diffstat (limited to 'cpukit/posix/include')
-rw-r--r--cpukit/posix/include/rtems/posix/mqueueimpl.h21
-rw-r--r--cpukit/posix/include/rtems/posix/posixapi.h31
-rw-r--r--cpukit/posix/include/rtems/posix/semaphoreimpl.h20
3 files changed, 33 insertions, 39 deletions
diff --git a/cpukit/posix/include/rtems/posix/mqueueimpl.h b/cpukit/posix/include/rtems/posix/mqueueimpl.h
index 6646fa2c65..cf0f76af32 100644
--- a/cpukit/posix/include/rtems/posix/mqueueimpl.h
+++ b/cpukit/posix/include/rtems/posix/mqueueimpl.h
@@ -246,17 +246,20 @@ _POSIX_Message_queue_Get_fd_interrupt_disable(
lock_context
);
}
-
-/**
- * @see _POSIX_Name_to_id().
- */
-RTEMS_INLINE_ROUTINE int _POSIX_Message_queue_Name_to_id(
- const char *name,
- Objects_Id *id,
- size_t *len
+
+RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *
+_POSIX_Message_queue_Get_by_name(
+ const char *name,
+ size_t *name_length_p,
+ Objects_Get_by_name_error *error
)
{
- return _POSIX_Name_to_id( &_POSIX_Message_queue_Information, name, id, len );
+ return (POSIX_Message_queue_Control *) _Objects_Get_by_name(
+ &_POSIX_Message_queue_Information,
+ name,
+ name_length_p,
+ error
+ );
}
#ifdef __cplusplus
diff --git a/cpukit/posix/include/rtems/posix/posixapi.h b/cpukit/posix/include/rtems/posix/posixapi.h
index 8fee7a4f32..0348e28e16 100644
--- a/cpukit/posix/include/rtems/posix/posixapi.h
+++ b/cpukit/posix/include/rtems/posix/posixapi.h
@@ -20,6 +20,7 @@
#define _RTEMS_POSIX_POSIXAPI_H
#include <rtems/config.h>
+#include <rtems/score/assert.h>
#include <rtems/score/objectimpl.h>
/**
@@ -48,27 +49,15 @@ typedef enum {
*/
void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno );
-/**
- * @brief Queries the object identifier @a id for a @a name.
- *
- * @param[in] information Object information.
- * @param[in] name Zero terminated name string to look up.
- * @param[out] id Pointer for identifier. The pointer must be valid.
- * @param[out] len Pointer for string length. The pointer must be valid.
- *
- * @retval 0 Successful operation.
- * @retval EINVAL The @a name pointer is @c NULL or the @a name string has
- * zero length.
- * @retval ENAMETOOLONG The @a name string length is greater than or equal to
- * @c NAME_MAX.
- * @retval ENOENT Found no corresponding identifier.
- */
-int _POSIX_Name_to_id(
- Objects_Information *information,
- const char *name,
- Objects_Id *id,
- size_t *len
-);
+extern const int _POSIX_Get_by_name_error_table[ 3 ];
+
+RTEMS_INLINE_ROUTINE int _POSIX_Get_by_name_error(
+ Objects_Get_by_name_error error
+)
+{
+ _Assert( (size_t) error < RTEMS_ARRAY_SIZE( _POSIX_Get_by_name_error_table ) );
+ return _POSIX_Get_by_name_error_table[ error ];
+}
/** @} */
diff --git a/cpukit/posix/include/rtems/posix/semaphoreimpl.h b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
index fe5ee44034..8608e6f33d 100644
--- a/cpukit/posix/include/rtems/posix/semaphoreimpl.h
+++ b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
@@ -163,17 +163,19 @@ RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Namespace_remove (
_Objects_Namespace_remove(
&_POSIX_Semaphore_Information, &the_semaphore->Object );
}
-
-/**
- * @see _POSIX_Name_to_id().
- */
-RTEMS_INLINE_ROUTINE int _POSIX_Semaphore_Name_to_id(
- const char *name,
- Objects_Id *id,
- size_t *len
+
+RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get_by_name(
+ const char *name,
+ size_t *name_length_p,
+ Objects_Get_by_name_error *error
)
{
- return _POSIX_Name_to_id( &_POSIX_Semaphore_Information, name, id, len );
+ return (POSIX_Semaphore_Control *) _Objects_Get_by_name(
+ &_POSIX_Semaphore_Information,
+ name,
+ name_length_p,
+ error
+ );
}
#ifdef __cplusplus