summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-02-06 23:54:55 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-02-06 23:54:55 +0000
commit9184270ac4ab137526cf15627d925cafcd3b3a52 (patch)
treec600d43831b5893e9fea4806eec6a9522f26057b /cpukit
parent2008-02-06 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-9184270ac4ab137526cf15627d925cafcd3b3a52.tar.bz2
2008-02-06 Joel Sherrill <joel.sherrill@oarcorp.com>
* posix/src/mqueueunlink.c, score/Makefile.am, score/include/rtems/score/object.h, score/inline/rtems/score/object.inl: Enhance _Objects_Namespace_remove() to handle freeing object names which are strings. All changed _Objects_Close() to call _Objects_Namespace_remove(). The resulting code was then moved from inline routines to function calls. * score/src/objectclose.c, score/src/objectnamespaceremove.c: New files.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog11
-rw-r--r--cpukit/posix/src/mqueueunlink.c2
-rw-r--r--cpukit/score/Makefile.am5
-rw-r--r--cpukit/score/include/rtems/score/object.h23
-rw-r--r--cpukit/score/inline/rtems/score/object.inl87
-rw-r--r--cpukit/score/src/objectclose.c32
-rw-r--r--cpukit/score/src/objectnamespaceremove.c36
7 files changed, 122 insertions, 74 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index da121ccc72..7a932274b2 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,5 +1,16 @@
2008-02-06 Joel Sherrill <joel.sherrill@oarcorp.com>
+ * posix/src/mqueueunlink.c, score/Makefile.am,
+ score/include/rtems/score/object.h,
+ score/inline/rtems/score/object.inl: Enhance
+ _Objects_Namespace_remove() to handle freeing object names which are
+ strings. All changed _Objects_Close() to call
+ _Objects_Namespace_remove(). The resulting code was then moved from
+ inline routines to function calls.
+ * score/src/objectclose.c, score/src/objectnamespaceremove.c: New files.
+
+2008-02-06 Joel Sherrill <joel.sherrill@oarcorp.com>
+
* libcsupport/src/printk.c: Added width and padding for %s.
* libmisc/cpuuse/cpuusagereport.c: Support object names that are
strings longer than 4 chanracters.
diff --git a/cpukit/posix/src/mqueueunlink.c b/cpukit/posix/src/mqueueunlink.c
index ff6aec86fe..3213fdbe0b 100644
--- a/cpukit/posix/src/mqueueunlink.c
+++ b/cpukit/posix/src/mqueueunlink.c
@@ -67,8 +67,6 @@ int mq_unlink(
);
the_mq->linked = FALSE;
- if ( the_mq->Object.name.name_p )
- _Workspace_Free( (void *)the_mq->Object.name.name_p );
_POSIX_Message_queue_Namespace_remove( the_mq );
_POSIX_Message_queue_Delete( the_mq );
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index dd5e3fad0d..a3a4d603a5 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -112,13 +112,14 @@ libscore_a_SOURCES += src/heap.c src/heapallocate.c src/heapextend.c \
src/heapresizeblock.c
## OBJECT_C_FILES
-libscore_a_SOURCES += src/object.c src/objectallocate.c \
+libscore_a_SOURCES += src/object.c src/objectallocate.c src/objectclose.c \
src/objectextendinformation.c src/objectfree.c src/objectget.c \
src/objectgetisr.c src/objectgetnext.c src/objectinitializeinformation.c \
src/objectnametoid.c src/objectnametoidstring.c \
src/objectshrinkinformation.c src/objectgetnoprotection.c \
src/objectidtoname.c src/objectgetnameasstring.c src/objectsetname.c \
- src/objectgetinfo.c src/objectgetinfoid.c src/objectapimaximumclass.c
+ src/objectgetinfo.c src/objectgetinfoid.c src/objectapimaximumclass.c \
+ src/objectnamespaceremove.c
## OBJECT_C_FILES only used by ITRON API
if LIBITRON
diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h
index 88450b1b9f..9a7963e4bd 100644
--- a/cpukit/score/include/rtems/score/object.h
+++ b/cpukit/score/include/rtems/score/object.h
@@ -860,6 +860,29 @@ boolean _Objects_Set_name(
const char *name
);
+/**
+ * This function removes the_object from the namespace.
+ *
+ * @param[in] information points to an Object Information Table
+ * @param[in] the_object is a pointer to an object
+ */
+void _Objects_Namespace_remove(
+ Objects_Information *information,
+ Objects_Control *the_object
+);
+
+/**
+ * This function removes the_object control pointer and object name
+ * in the Local Pointer and Local Name Tables.
+ *
+ * @param[in] information points to an Object Information Table
+ * @param[in] the_object is a pointer to an object
+ */
+void _Objects_Close(
+ Objects_Information *information,
+ Objects_Control *the_object
+);
+
/*
* Pieces of object.inl are promoted out to the user
*/
diff --git a/cpukit/score/inline/rtems/score/object.inl b/cpukit/score/inline/rtems/score/object.inl
index e5f30d5c5e..730d8dc7f5 100644
--- a/cpukit/score/inline/rtems/score/object.inl
+++ b/cpukit/score/inline/rtems/score/object.inl
@@ -64,11 +64,11 @@ RTEMS_INLINE_ROUTINE Objects_APIs _Objects_Get_API(
*
* @param[in] id is the object Id to be processed
*/
-RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_class(
+RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_class(
Objects_Id id
)
{
- return (uint32_t )
+ return (uint32_t)
((id >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS);
}
@@ -79,7 +79,7 @@ RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_class(
*
* @return This method returns the node portion of an object ID.
*/
-RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_node(
+RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_node(
Objects_Id id
)
{
@@ -93,7 +93,7 @@ RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_node(
*
* @return This method returns the class portion of the specified object ID.
*/
-RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_index(
+RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_index(
Objects_Id id
)
{
@@ -118,22 +118,6 @@ RTEMS_INLINE_ROUTINE boolean _Objects_Is_api_valid(
}
/**
- * This function returns TRUE if the class is valid.
- *
- * @param[in] the_class is the class portion of an object ID.
- *
- * @return This method returns TRUE if the specified class value is valid
- * and FALSE otherwise.
- */
-RTEMS_INLINE_ROUTINE boolean _Objects_Is_class_valid(
- uint32_t the_class
-)
-{
- /* XXX how do we determine this now? */
- return TRUE; /* the_class && the_class <= OBJECTS_CLASSES_LAST; */
-}
-
-/**
* This function returns TRUE if the node is of the local object, and
* FALSE otherwise.
*
@@ -257,10 +241,11 @@ RTEMS_INLINE_ROUTINE void _Objects_Open(
Objects_Name name
)
{
- uint32_t index;
-
- index = _Objects_Get_index( the_object->id );
- _Objects_Set_local_object( information, index, the_object );
+ _Objects_Set_local_object(
+ information,
+ _Objects_Get_index( the_object->id ),
+ the_object
+ );
the_object->name = name;
}
@@ -279,10 +264,11 @@ RTEMS_INLINE_ROUTINE void _Objects_Open_u32(
uint32_t name
)
{
- uint32_t index;
-
- index = _Objects_Get_index( the_object->id );
- _Objects_Set_local_object( information, index, the_object );
+ _Objects_Set_local_object(
+ information,
+ _Objects_Get_index( the_object->id ),
+ the_object
+ );
/* ASSERT: information->is_string == FALSE */
the_object->name.name_u32 = name;
@@ -302,53 +288,14 @@ RTEMS_INLINE_ROUTINE void _Objects_Open_string(
const char *name
)
{
- uint32_t index;
-
- index = _Objects_Get_index( the_object->id );
- _Objects_Set_local_object( information, index, the_object );
-
- /* information->is_string */
- the_object->name.name_p = name;
-}
-
-/**
- * This function removes the_object control pointer and object name
- * in the Local Pointer and Local Name Tables.
- *
- * @param[in] information points to an Object Information Table
- * @param[in] the_object is a pointer to an object
- */
-RTEMS_INLINE_ROUTINE void _Objects_Close(
- Objects_Information *information,
- Objects_Control *the_object
-)
-{
_Objects_Set_local_object(
information,
_Objects_Get_index( the_object->id ),
- NULL
+ the_object
);
- the_object->name.name_u32 = 0;
- the_object->name.name_p = NULL;
-}
-
-/**
- * This function removes the_object from the namespace.
- *
- * @param[in] information points to an Object Information Table
- * @param[in] the_object is a pointer to an object
- */
-RTEMS_INLINE_ROUTINE void _Objects_Namespace_remove(
- Objects_Information *information,
- Objects_Control *the_object
-)
-{
- /*
- * Clear out either format.
- */
- the_object->name.name_p = NULL;
- the_object->name.name_u32 = 0;
+ /* ASSERT: information->is_string */
+ the_object->name.name_p = name;
}
#endif
diff --git a/cpukit/score/src/objectclose.c b/cpukit/score/src/objectclose.c
new file mode 100644
index 0000000000..e28b8fdda6
--- /dev/null
+++ b/cpukit/score/src/objectclose.c
@@ -0,0 +1,32 @@
+/*
+ * COPYRIGHT (c) 1989-2008.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+#include <rtems/score/wkspace.h>
+
+void _Objects_Close(
+ Objects_Information *information,
+ Objects_Control *the_object
+)
+{
+ _Objects_Set_local_object(
+ information,
+ _Objects_Get_index( the_object->id ),
+ NULL
+ );
+
+ _Objects_Namespace_remove( information, the_object );
+}
diff --git a/cpukit/score/src/objectnamespaceremove.c b/cpukit/score/src/objectnamespaceremove.c
new file mode 100644
index 0000000000..df54d854ac
--- /dev/null
+++ b/cpukit/score/src/objectnamespaceremove.c
@@ -0,0 +1,36 @@
+/*
+ * COPYRIGHT (c) 1989-2008.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+#include <rtems/score/wkspace.h>
+
+void _Objects_Namespace_remove(
+ Objects_Information *information,
+ Objects_Control *the_object
+)
+{
+ /*
+ * If this is a string format name, then free the memory.
+ */
+ if ( information->is_string && the_object->name.name_p )
+ _Workspace_Free( (void *)the_object->name.name_p );
+
+ /*
+ * Clear out either format.
+ */
+ the_object->name.name_p = NULL;
+ the_object->name.name_u32 = 0;
+}