source: rtems/cpukit/rtems/src/partdelete.c @ b2de426

5
Last change on this file since b2de426 was 0a00b2b, checked in by Sebastian Huber <sebastian.huber@…>, on 05/20/16 at 11:24:11

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.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Delete Partition
5 *  @ingroup ClassicPart
6 */
7
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#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/rtems/partimpl.h>
22#include <rtems/rtems/attrimpl.h>
23
24rtems_status_code rtems_partition_delete(
25  rtems_id id
26)
27{
28  Partition_Control *the_partition;
29  ISR_lock_Context   lock_context;
30
31  _Objects_Allocator_lock();
32  the_partition = _Partition_Get( id, &lock_context );
33
34  if ( the_partition == NULL ) {
35    _Objects_Allocator_unlock();
36
37#if defined(RTEMS_MULTIPROCESSING)
38    if ( _Partition_MP_Is_remote( id ) ) {
39      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
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 );
50    _Objects_Allocator_unlock();
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(
60      &_Partition_Information,
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 );
75  _Objects_Allocator_unlock();
76  return RTEMS_SUCCESSFUL;
77}
Note: See TracBrowser for help on using the repository browser.