[rtems commit] rtems: Move _Partition_Is_buffer_size_aligned()
Sebastian Huber
sebh at rtems.org
Tue Nov 24 06:40:41 UTC 2020
Module: rtems
Branch: master
Commit: 1eafefbf4c42cc83c2167722774955071eaea099
Changeset: http://git.rtems.org/rtems/commit/?id=1eafefbf4c42cc83c2167722774955071eaea099
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Oct 14 10:29:19 2020 +0200
rtems: Move _Partition_Is_buffer_size_aligned()
It is only used by rtems_partition_create(). Move code directly into
the directive which called the inline function. Add a comment.
---
cpukit/include/rtems/rtems/partimpl.h | 7 -------
cpukit/rtems/src/partcreate.c | 7 ++++++-
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/cpukit/include/rtems/rtems/partimpl.h b/cpukit/include/rtems/rtems/partimpl.h
index 0d15d1e..b9d57ae 100644
--- a/cpukit/include/rtems/rtems/partimpl.h
+++ b/cpukit/include/rtems/rtems/partimpl.h
@@ -34,13 +34,6 @@ extern "C" {
* @{
*/
-RTEMS_INLINE_ROUTINE bool _Partition_Is_buffer_size_aligned(
- uint32_t buffer_size
-)
-{
- return (buffer_size % CPU_SIZEOF_POINTER) == 0;
-}
-
RTEMS_INLINE_ROUTINE bool _Partition_Is_buffer_area_aligned(
const void *starting_address
)
diff --git a/cpukit/rtems/src/partcreate.c b/cpukit/rtems/src/partcreate.c
index 9d4c7df..1e471d3 100644
--- a/cpukit/rtems/src/partcreate.c
+++ b/cpukit/rtems/src/partcreate.c
@@ -58,8 +58,13 @@ rtems_status_code rtems_partition_create(
if ( length < buffer_size )
return RTEMS_INVALID_SIZE;
- if ( !_Partition_Is_buffer_size_aligned( buffer_size ) )
+ /*
+ * Ensure that the buffer size is an integral multiple of the pointer size so
+ * that each buffer begin meets the chain node alignment.
+ */
+ if ( buffer_size % CPU_SIZEOF_POINTER != 0 ) {
return RTEMS_INVALID_SIZE;
+ }
if ( buffer_size < sizeof( Chain_Node ) )
return RTEMS_INVALID_SIZE;
More information about the vc
mailing list