diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 13:24:11 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 16:16:59 +0200 |
commit | 0a00b2b5f6d115829f05bbac260ba7c9bc47c9e4 (patch) | |
tree | bc25332e7b0f84f2130cfe9163824d76c8037bed /cpukit/rtems/src/partgetbuffer.c | |
parent | mpci: Delete unused region support (diff) | |
download | rtems-0a00b2b5f6d115829f05bbac260ba7c9bc47c9e4.tar.bz2 |
rtems: Remove location from _Partition_Get()
Use _Objects_Get_local() for _Partition_Get() to get rid of the location
parameter. Move remote object handling to partition MPCI support.
Diffstat (limited to 'cpukit/rtems/src/partgetbuffer.c')
-rw-r--r-- | cpukit/rtems/src/partgetbuffer.c | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/cpukit/rtems/src/partgetbuffer.c b/cpukit/rtems/src/partgetbuffer.c index 39cac5e7b5..42b1b07d25 100644 --- a/cpukit/rtems/src/partgetbuffer.c +++ b/cpukit/rtems/src/partgetbuffer.c @@ -26,45 +26,33 @@ rtems_status_code rtems_partition_get_buffer( ) { Partition_Control *the_partition; - Objects_Locations location; ISR_lock_Context lock_context; void *the_buffer; - if ( !buffer ) + if ( buffer == NULL ) { return RTEMS_INVALID_ADDRESS; + } - the_partition = _Partition_Get( id, &location, &lock_context ); - switch ( location ) { - - case OBJECTS_LOCAL: - _Partition_Acquire_critical( the_partition, &lock_context ); - - the_buffer = _Partition_Allocate_buffer( the_partition ); - if ( the_buffer != NULL ) { - the_partition->number_of_used_blocks += 1; - _Partition_Release( the_partition, &lock_context ); - *buffer = the_buffer; - return RTEMS_SUCCESSFUL; - } - - _Partition_Release( the_partition, &lock_context ); - return RTEMS_UNSATISFIED; + the_partition = _Partition_Get( id, &lock_context ); + if ( the_partition == NULL ) { #if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: - _Thread_Executing->Wait.return_argument = buffer; - return( - _Partition_MP_Send_request_packet( - PARTITION_MP_GET_BUFFER_REQUEST, - id, - 0 /* Not used */ - ) - ); + return _Partition_MP_Get_buffer( id, buffer ); +#else + return RTEMS_INVALID_ID; #endif + } + + _Partition_Acquire_critical( the_partition, &lock_context ); + the_buffer = _Partition_Allocate_buffer( the_partition ); - case OBJECTS_ERROR: - break; + if ( the_buffer == NULL ) { + _Partition_Release( the_partition, &lock_context ); + return RTEMS_UNSATISFIED; } - return RTEMS_INVALID_ID; + the_partition->number_of_used_blocks += 1; + _Partition_Release( the_partition, &lock_context ); + *buffer = the_buffer; + return RTEMS_SUCCESSFUL; } |