From ab5aeb1be1e7f501388cf4c8915f98efaaef754a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 10 May 2021 09:21:03 +0200 Subject: score: Rename _Stack_Free_nothing() 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 +- cpukit/score/src/objectfreenothing.c | 46 ++++++++++++++++++++++++++++ cpukit/score/src/stackallocatorfreenothing.c | 46 ---------------------------- spec/build/cpukit/librtemscpu.yml | 2 +- 9 files changed, 58 insertions(+), 58 deletions(-) create mode 100644 cpukit/score/src/objectfreenothing.c delete mode 100644 cpukit/score/src/stackallocatorfreenothing.c 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/objectfreenothing.c b/cpukit/score/src/objectfreenothing.c new file mode 100644 index 0000000000..0845d4c140 --- /dev/null +++ b/cpukit/score/src/objectfreenothing.c @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSScoreObject + * + * @brief This source file contains the implementation of + * _Objects_Free_nothing(). + */ + +/* + * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +void _Objects_Free_nothing( void *ptr ) +{ + (void) ptr; +} diff --git a/cpukit/score/src/stackallocatorfreenothing.c b/cpukit/score/src/stackallocatorfreenothing.c deleted file mode 100644 index e341814b0c..0000000000 --- a/cpukit/score/src/stackallocatorfreenothing.c +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: BSD-2-Clause */ - -/** - * @file - * - * @ingroup RTEMSScoreStack - * - * @brief This source file contains the implementation of - * _Stack_Free_nothing(). - */ - -/* - * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -void _Stack_Free_nothing( void *stack_area ) -{ - (void) stack_area; -} 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 -- cgit v1.2.3