summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/partdelete.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-20 13:24:11 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-20 16:16:59 +0200
commit0a00b2b5f6d115829f05bbac260ba7c9bc47c9e4 (patch)
treebc25332e7b0f84f2130cfe9163824d76c8037bed /cpukit/rtems/src/partdelete.c
parentmpci: Delete unused region support (diff)
downloadrtems-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/partdelete.c')
-rw-r--r--cpukit/rtems/src/partdelete.c69
1 files changed, 32 insertions, 37 deletions
diff --git a/cpukit/rtems/src/partdelete.c b/cpukit/rtems/src/partdelete.c
index 2df3893b77..972e81eadf 100644
--- a/cpukit/rtems/src/partdelete.c
+++ b/cpukit/rtems/src/partdelete.c
@@ -26,57 +26,52 @@ rtems_status_code rtems_partition_delete(
)
{
Partition_Control *the_partition;
- Objects_Locations location;
ISR_lock_Context lock_context;
_Objects_Allocator_lock();
- the_partition = _Partition_Get( id, &location, &lock_context );
- switch ( location ) {
+ the_partition = _Partition_Get( id, &lock_context );
- case OBJECTS_LOCAL:
- _Partition_Acquire_critical( the_partition, &lock_context );
+ if ( the_partition == NULL ) {
+ _Objects_Allocator_unlock();
- if ( the_partition->number_of_used_blocks == 0 ) {
- _Objects_Close( &_Partition_Information, &the_partition->Object );
#if defined(RTEMS_MULTIPROCESSING)
- if ( _Attributes_Is_global( the_partition->attribute_set ) ) {
+ if ( _Partition_MP_Is_remote( id ) ) {
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ }
+#endif
- _Objects_MP_Close(
- &_Partition_Information,
- the_partition->Object.id
- );
+ return RTEMS_INVALID_ID;
+ }
- _Partition_MP_Send_process_packet(
- PARTITION_MP_ANNOUNCE_DELETE,
- the_partition->Object.id,
- 0, /* Not used */
- 0 /* Not used */
- );
- }
-#endif
+ _Partition_Acquire_critical( the_partition, &lock_context );
- _Partition_Release( the_partition, &lock_context );
- _Partition_Destroy( the_partition );
- _Partition_Free( the_partition );
- _Objects_Allocator_unlock();
- return RTEMS_SUCCESSFUL;
- }
+ if ( the_partition->number_of_used_blocks != 0 ) {
+ _Partition_Release( the_partition, &lock_context );
+ _Objects_Allocator_unlock();
+ return RTEMS_RESOURCE_IN_USE;
+ }
- _Partition_Release( the_partition, &lock_context );
- _Objects_Allocator_unlock();
- return RTEMS_RESOURCE_IN_USE;
+ _Objects_Close( &_Partition_Information, &the_partition->Object );
+ _Partition_Release( the_partition, &lock_context );
#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- _Objects_Allocator_unlock();
- return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
-#endif
+ if ( _Attributes_Is_global( the_partition->attribute_set ) ) {
+ _Objects_MP_Close(
+ &_Partition_Information,
+ the_partition->Object.id
+ );
- case OBJECTS_ERROR:
- break;
+ _Partition_MP_Send_process_packet(
+ PARTITION_MP_ANNOUNCE_DELETE,
+ the_partition->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
}
+#endif
+ _Partition_Destroy( the_partition );
+ _Partition_Free( the_partition );
_Objects_Allocator_unlock();
-
- return RTEMS_INVALID_ID;
+ return RTEMS_SUCCESSFUL;
}