[PATCH 1/2] score: Rename _Stack_Free_nothing()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon May 10 17:41:24 UTC 2021


Rename _Stack_Free_nothing() in _Objects_Free_nothing() to make it
reusable for the message queue buffers.

Update #4007.
---
 cpukit/Makefile.am                                     |  2 +-
 cpukit/include/rtems/score/objectimpl.h                |  7 +++++++
 cpukit/include/rtems/score/stackimpl.h                 |  7 -------
 cpukit/include/rtems/score/threadimpl.h                |  2 +-
 cpukit/posix/src/pthreadcreate.c                       |  2 +-
 cpukit/rtems/src/taskconstruct.c                       |  2 +-
 ...stackallocatorfreenothing.c => objectfreenothing.c} | 10 +++++-----
 spec/build/cpukit/librtemscpu.yml                      |  2 +-
 8 files changed, 17 insertions(+), 17 deletions(-)
 rename cpukit/score/src/{stackallocatorfreenothing.c => objectfreenothing.c} (90%)

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index c9600f7242..0178d5d82a 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -867,6 +867,7 @@ librtemscpu_a_SOURCES += score/src/objectallocateunlimited.c
 librtemscpu_a_SOURCES += score/src/objectclose.c
 librtemscpu_a_SOURCES += score/src/objectextendinformation.c
 librtemscpu_a_SOURCES += score/src/objectfree.c
+librtemscpu_a_SOURCES += score/src/objectfreenothing.c
 librtemscpu_a_SOURCES += score/src/objectfreestatic.c
 librtemscpu_a_SOURCES += score/src/objectgetnext.c
 librtemscpu_a_SOURCES += score/src/objectinitializeinformation.c
@@ -931,7 +932,6 @@ librtemscpu_a_SOURCES += score/src/schedulercbsreleasejob.c
 librtemscpu_a_SOURCES += score/src/schedulercbsunblock.c
 librtemscpu_a_SOURCES += score/src/stackallocator.c
 librtemscpu_a_SOURCES += score/src/stackallocatorfree.c
-librtemscpu_a_SOURCES += score/src/stackallocatorfreenothing.c
 librtemscpu_a_SOURCES += score/src/stackallocatorinit.c
 librtemscpu_a_SOURCES += score/src/pheapallocate.c
 librtemscpu_a_SOURCES += score/src/pheapextend.c
diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h
index 54d6f0841b..0c9c85e062 100644
--- a/cpukit/include/rtems/score/objectimpl.h
+++ b/cpukit/include/rtems/score/objectimpl.h
@@ -954,6 +954,13 @@ RTEMS_INLINE_ROUTINE Objects_Control *_Objects_Allocate_with_extend(
   return the_object;
 }
 
+/**
+ * @brief This function does nothing.
+ *
+ * @param ptr is not used.
+ */
+void _Objects_Free_nothing( void *ptr );
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/include/rtems/score/stackimpl.h b/cpukit/include/rtems/score/stackimpl.h
index c261f8bd4f..330fd32be7 100644
--- a/cpukit/include/rtems/score/stackimpl.h
+++ b/cpukit/include/rtems/score/stackimpl.h
@@ -194,13 +194,6 @@ void *_Stack_Allocate( size_t stack_size );
  */
 void _Stack_Free( void *stack_area );
 
-/**
- * @brief This function does nothing.
- *
- * @param stack_area is not used.
- */
-void _Stack_Free_nothing( void *stack_area );
-
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h
index c861e8b119..ba7c159962 100644
--- a/cpukit/include/rtems/score/threadimpl.h
+++ b/cpukit/include/rtems/score/threadimpl.h
@@ -144,7 +144,7 @@ typedef struct {
   /**
    * @brief This member contains the handler to free the stack.
    *
-   * It shall not be NULL.  Use _Stack_Free_nothing() if nothing is to free.
+   * It shall not be NULL.  Use _Objects_Free_nothing() if nothing is to free.
    */
   void ( *stack_free )( void * );
 
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 055d304699..9474d07032 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -221,7 +221,7 @@ int pthread_create(
     config.stack_free = _Stack_Free;
     config.stack_area = _Stack_Allocate( config.stack_size );
   } else {
-    config.stack_free = _Stack_Free_nothing;
+    config.stack_free = _Objects_Free_nothing;
   }
 
   if ( config.stack_area == NULL ) {
diff --git a/cpukit/rtems/src/taskconstruct.c b/cpukit/rtems/src/taskconstruct.c
index e267db2fc5..6e03440aed 100644
--- a/cpukit/rtems/src/taskconstruct.c
+++ b/cpukit/rtems/src/taskconstruct.c
@@ -92,7 +92,7 @@ static rtems_status_code _RTEMS_tasks_Prepare_user_stack(
   if ( config->storage_free != NULL ) {
     thread_config->stack_free = config->storage_free;
   } else {
-    thread_config->stack_free = _Stack_Free_nothing;
+    thread_config->stack_free = _Objects_Free_nothing;
   }
 
   return RTEMS_SUCCESSFUL;
diff --git a/cpukit/score/src/stackallocatorfreenothing.c b/cpukit/score/src/objectfreenothing.c
similarity index 90%
rename from cpukit/score/src/stackallocatorfreenothing.c
rename to cpukit/score/src/objectfreenothing.c
index e341814b0c..0845d4c140 100644
--- a/cpukit/score/src/stackallocatorfreenothing.c
+++ b/cpukit/score/src/objectfreenothing.c
@@ -3,10 +3,10 @@
 /**
  * @file
  *
- * @ingroup RTEMSScoreStack
+ * @ingroup RTEMSScoreObject
  *
  * @brief This source file contains the implementation of
- *   _Stack_Free_nothing().
+ *   _Objects_Free_nothing().
  */
 
 /*
@@ -38,9 +38,9 @@
 #include "config.h"
 #endif
 
-#include <rtems/score/stackimpl.h>
+#include <rtems/score/objectimpl.h>
 
-void _Stack_Free_nothing( void *stack_area )
+void _Objects_Free_nothing( void *ptr )
 {
-  (void) stack_area;
+  (void) ptr;
 }
diff --git a/spec/build/cpukit/librtemscpu.yml b/spec/build/cpukit/librtemscpu.yml
index 21fa6ea787..682032182f 100644
--- a/spec/build/cpukit/librtemscpu.yml
+++ b/spec/build/cpukit/librtemscpu.yml
@@ -1433,6 +1433,7 @@ source:
 - cpukit/score/src/objectclose.c
 - cpukit/score/src/objectextendinformation.c
 - cpukit/score/src/objectfree.c
+- cpukit/score/src/objectfreenothing.c
 - cpukit/score/src/objectfreestatic.c
 - cpukit/score/src/objectgetinfo.c
 - cpukit/score/src/objectgetinfoid.c
@@ -1518,7 +1519,6 @@ source:
 - cpukit/score/src/smpbarrierwait.c
 - cpukit/score/src/stackallocator.c
 - cpukit/score/src/stackallocatorfree.c
-- cpukit/score/src/stackallocatorfreenothing.c
 - cpukit/score/src/stackallocatorinit.c
 - cpukit/score/src/thread.c
 - cpukit/score/src/threadallocateunlimited.c
-- 
2.26.2



More information about the devel mailing list