RTEMS
partdelete.c
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 1989-2014.
10  * On-Line Applications Research Corporation (OAR).
11  *
12  * The license and distribution terms for this file may be
13  * found in the file LICENSE in this distribution or at
14  * http://www.rtems.org/license/LICENSE.
15  */
16 
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
21 #include <rtems/rtems/partimpl.h>
22 #include <rtems/rtems/attrimpl.h>
23 
25  rtems_id id
26 )
27 {
28  Partition_Control *the_partition;
29  ISR_lock_Context lock_context;
30 
32  the_partition = _Partition_Get( id, &lock_context );
33 
34  if ( the_partition == NULL ) {
36 
37 #if defined(RTEMS_MULTIPROCESSING)
38  if ( _Partition_MP_Is_remote( id ) ) {
40  }
41 #endif
42 
43  return RTEMS_INVALID_ID;
44  }
45 
46  _Partition_Acquire_critical( the_partition, &lock_context );
47 
48  if ( the_partition->number_of_used_blocks != 0 ) {
49  _Partition_Release( the_partition, &lock_context );
51  return RTEMS_RESOURCE_IN_USE;
52  }
53 
54  _Objects_Close( &_Partition_Information, &the_partition->Object );
55  _Partition_Release( the_partition, &lock_context );
56 
57 #if defined(RTEMS_MULTIPROCESSING)
58  if ( _Attributes_Is_global( the_partition->attribute_set ) ) {
59  _Objects_MP_Close(
61  the_partition->Object.id
62  );
63 
64  _Partition_MP_Send_process_packet(
65  PARTITION_MP_ANNOUNCE_DELETE,
66  the_partition->Object.id,
67  0, /* Not used */
68  0 /* Not used */
69  );
70  }
71 #endif
72 
73  _Partition_Destroy( the_partition );
74  _Partition_Free( the_partition );
76  return RTEMS_SUCCESSFUL;
77 }
static __inline__ void _Objects_Allocator_unlock(void)
Unlocks the object allocator mutex.
Definition: objectimpl.h:846
Objects_Control Object
Definition: partdata.h:39
Objects_Information _Partition_Information
The Classic Partition objects information.
Definition: part.c:47
This status code indicates that the object still had resources in use.
Definition: status.h:149
rtems_status_code rtems_partition_delete(rtems_id id)
Deletes the specified partition.
Definition: partdelete.c:24
static __inline__ void _Objects_Allocator_lock(void)
Locks the object allocator mutex.
Definition: objectimpl.h:834
This status code indicates successful completion.
Definition: status.h:86
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
uintptr_t number_of_used_blocks
Definition: partdata.h:51
rtems_attribute attribute_set
Definition: partdata.h:49
This status code indicates that an object identifier was invalid.
Definition: status.h:106
Classic Attributes Implementation.
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
Classic Partition Manager Implementation.
This status code indicates that the operation was illegal on a remote object.
Definition: status.h:177
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
static __inline__ void _Partition_Free(Partition_Control *the_partition)
Frees a partition control block to the inactive chain of free partition control blocks.
Definition: partimpl.h:172
void _Objects_Close(const Objects_Information *information, Objects_Control *the_object)
Closes object.
Definition: objectclose.c:23
Objects_Id id
Definition: objectdata.h:43