source: rtems/cpukit/rtems/src/regiondelete.c @ 572cb624

5
Last change on this file since 572cb624 was 572cb624, checked in by Sebastian Huber <sebastian.huber@…>, on 04/07/16 at 14:48:30

score: Simplify _Objects_Get_no_protection()

This functions supports only local objects. Thus, drop the location
parameter which was unused by all callers.

Remove superfluous includes from Classic Region implementation.

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Delete Region
5 *  @ingroup ClassicRegion
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
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/regionimpl.h>
22
23rtems_status_code rtems_region_delete(
24  rtems_id id
25)
26{
27  rtems_status_code  status;
28  Region_Control    *the_region;
29
30  _Objects_Allocator_lock();
31  _RTEMS_Lock_allocator();
32
33  the_region = _Region_Get( id );
34
35  if ( the_region != NULL ) {
36    if ( the_region->number_of_used_blocks != 0 ) {
37      status = RTEMS_RESOURCE_IN_USE;
38    } else {
39      _Objects_Close( &_Region_Information, &the_region->Object );
40      _Region_Free( the_region );
41      status = RTEMS_SUCCESSFUL;
42    }
43  } else {
44    status = RTEMS_INVALID_ID;
45  }
46
47  _RTEMS_Unlock_allocator();
48  _Objects_Allocator_unlock();
49  return status;
50}
Note: See TracBrowser for help on using the repository browser.