source: rtems/cpukit/rtems/src/partgetbuffer.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.3 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Get Partition Buffer
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
23rtems_status_code rtems_partition_get_buffer(
24  rtems_id   id,
25  void     **buffer
26)
27{
28  Partition_Control *the_partition;
29  ISR_lock_Context   lock_context;
30  void              *the_buffer;
31
32  if ( buffer == NULL ) {
33    return RTEMS_INVALID_ADDRESS;
34  }
35
36  the_partition = _Partition_Get( id, &lock_context );
37
38  if ( the_partition == NULL ) {
39#if defined(RTEMS_MULTIPROCESSING)
40    return _Partition_MP_Get_buffer( id, buffer );
41#else
42    return RTEMS_INVALID_ID;
43#endif
44  }
45
46  _Partition_Acquire_critical( the_partition, &lock_context );
47  the_buffer = _Partition_Allocate_buffer( the_partition );
48
49  if ( the_buffer == NULL ) {
50    _Partition_Release( the_partition, &lock_context );
51    return RTEMS_UNSATISFIED;
52  }
53
54  the_partition->number_of_used_blocks += 1;
55  _Partition_Release( the_partition, &lock_context );
56  *buffer = the_buffer;
57  return RTEMS_SUCCESSFUL;
58}
Note: See TracBrowser for help on using the repository browser.