diff options
Diffstat (limited to '')
-rw-r--r-- | cpukit/rtems/src/partdelete.c | 69 |
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; } |