diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-14 10:26:53 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-11-24 07:38:41 +0100 |
commit | a61e221d04a1df5d113606ad2c2c978e2c578655 (patch) | |
tree | 28beb873f713d8f2d13439574b1c70d025e409fa /cpukit/rtems/src | |
parent | rtems: Move _Partition_Is_buffer_valid() (diff) | |
download | rtems-a61e221d04a1df5d113606ad2c2c978e2c578655.tar.bz2 |
rtems: Move _Partition_Is_buffer_on_boundary()
It is used only by rtems_partition_return_buffer(). Make the PTCB the
first parameter. Rename to _Partition_Is_address_on_buffer_boundary().
Diffstat (limited to 'cpukit/rtems/src')
-rw-r--r-- | cpukit/rtems/src/partreturnbuffer.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cpukit/rtems/src/partreturnbuffer.c b/cpukit/rtems/src/partreturnbuffer.c index 08cbf9ecee..6d7b71a7e5 100644 --- a/cpukit/rtems/src/partreturnbuffer.c +++ b/cpukit/rtems/src/partreturnbuffer.c @@ -24,6 +24,21 @@ #include <rtems/score/address.h> #include <rtems/score/chainimpl.h> +static bool _Partition_Is_address_on_buffer_boundary( + const Partition_Control *the_partition, + const void *the_buffer +) +{ + intptr_t offset; + + offset = _Addresses_Subtract( + the_buffer, + the_partition->starting_address + ); + + return ( offset % the_partition->buffer_size ) == 0; +} + static bool _Partition_Is_address_a_buffer_begin( const Partition_Control *the_partition, const void *the_buffer @@ -36,7 +51,7 @@ static bool _Partition_Is_address_a_buffer_begin( ending = _Addresses_Add_offset( starting, the_partition->length ); return _Addresses_Is_in_range( the_buffer, starting, ending ) - && _Partition_Is_buffer_on_boundary( the_buffer, the_partition ); + && _Partition_Is_address_on_buffer_boundary( the_partition, the_buffer ); } static void _Partition_Free_buffer( |