diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-14 10:25:59 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-11-24 07:38:41 +0100 |
commit | 2572a3f1c058c4e63cadf274752a52358f76e069 (patch) | |
tree | 8cf5bbbc13cb4568e9ae4104ac3de2ba71684a44 /cpukit/rtems/src | |
parent | libtest: Fix undefined setjmp() behaviour (diff) | |
download | rtems-2572a3f1c058c4e63cadf274752a52358f76e069.tar.bz2 |
rtems: Move _Partition_Is_buffer_valid()
It is used only in one place. Make the PTCB the first parameter.
Rename it to _Partition_Is_address_a_buffer_begin().
Diffstat (limited to 'cpukit/rtems/src')
-rw-r--r-- | cpukit/rtems/src/partreturnbuffer.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/cpukit/rtems/src/partreturnbuffer.c b/cpukit/rtems/src/partreturnbuffer.c index 9afda8f85e..08cbf9ecee 100644 --- a/cpukit/rtems/src/partreturnbuffer.c +++ b/cpukit/rtems/src/partreturnbuffer.c @@ -21,8 +21,24 @@ #endif #include <rtems/rtems/partimpl.h> +#include <rtems/score/address.h> #include <rtems/score/chainimpl.h> +static bool _Partition_Is_address_a_buffer_begin( + const Partition_Control *the_partition, + const void *the_buffer +) +{ + void *starting; + void *ending; + + starting = the_partition->starting_address; + 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 ); +} + static void _Partition_Free_buffer( Partition_Control *the_partition, void *the_buffer @@ -51,7 +67,7 @@ rtems_status_code rtems_partition_return_buffer( _Partition_Acquire_critical( the_partition, &lock_context ); - if ( !_Partition_Is_buffer_valid( buffer, the_partition ) ) { + if ( !_Partition_Is_address_a_buffer_begin( the_partition, buffer ) ) { _Partition_Release( the_partition, &lock_context ); return RTEMS_INVALID_ADDRESS; } |