source: rtems/cpukit/rtems/src/partgetbuffer.c @ e980b219

4.104.114.84.95
Last change on this file since e980b219 was e980b219, checked in by Joel Sherrill <joel.sherrill@…>, on 05/06/04 at 19:21:40

2004-05-06 Joel Sherrill <joel@…>

PR 618/rtems

  • rtems/include/rtems/rtems/status.h, rtems/src/clockget.c, rtems/src/clockset.c, rtems/src/dpmemcreate.c, rtems/src/dpmemexternal2internal.c, rtems/src/dpmeminternal2external.c, rtems/src/eventmp.c, rtems/src/eventreceive.c, rtems/src/eventsend.c, rtems/src/msgqbroadcast.c, rtems/src/msgqcreate.c, rtems/src/msgqflush.c, rtems/src/msgqgetnumberpending.c, rtems/src/msgqreceive.c, rtems/src/msgqsubmit.c, rtems/src/partcreate.c, rtems/src/partdelete.c, rtems/src/partgetbuffer.c, rtems/src/ratemoncancel.c, rtems/src/ratemoncreate.c, rtems/src/ratemondelete.c, rtems/src/ratemongetstatus.c, rtems/src/ratemonident.c, rtems/src/ratemonperiod.c, rtems/src/regioncreate.c, rtems/src/regiondelete.c, rtems/src/regionextend.c, rtems/src/regiongetsegment.c, rtems/src/regiongetsegmentsize.c, rtems/src/regionreturnsegment.c, rtems/src/semcreate.c, rtems/src/semdelete.c, rtems/src/semflush.c, rtems/src/semident.c, rtems/src/taskcreate.c, rtems/src/taskgetnote.c, rtems/src/taskmode.c, rtems/src/taskrestart.c, rtems/src/taskresume.c, rtems/src/tasksetnote.c, rtems/src/tasksuspend.c, rtems/src/taskvariableadd.c, rtems/src/taskvariabledelete.c, rtems/src/taskvariableget.c, rtems/src/taskwakewhen.c, rtems/src/timercreate.c, rtems/src/timerdelete.c, rtems/src/timerfireafter.c, rtems/src/timerfirewhen.c, rtems/src/timerserverfireafter.c, rtems/src/timerserverfirewhen.c, score/include/rtems/score/object.h, score/src/coretodvalidate.c, score/src/objectnametoid.c: Add NULL checks.
  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  Partition Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/rtems/status.h>
17#include <rtems/rtems/support.h>
18#include <rtems/score/address.h>
19#include <rtems/score/object.h>
20#include <rtems/rtems/part.h>
21#include <rtems/score/thread.h>
22#include <rtems/score/sysstate.h>
23
24/*PAGE
25 *
26 *  rtems_partition_get_buffer
27 *
28 *  This directive will obtain a buffer from a buffer partition.
29 *
30 *  Input parameters:
31 *    id     - partition id
32 *    buffer - pointer to buffer address
33 *
34 *  Output parameters:
35 *    buffer            - pointer to buffer address filled in
36 *    RTEMS_SUCCESSFUL - if successful
37 *    error code        - if unsuccessful
38 */
39
40rtems_status_code rtems_partition_get_buffer(
41  Objects_Id   id,
42  void       **buffer
43)
44{
45  register Partition_Control *the_partition;
46  Objects_Locations           location;
47  void                       *the_buffer;
48
49  if ( !buffer )
50    return RTEMS_INVALID_ADDRESS;
51
52  the_partition = _Partition_Get( id, &location );
53  switch ( location ) {
54    case OBJECTS_REMOTE:
55#if defined(RTEMS_MULTIPROCESSING)
56      _Thread_Executing->Wait.return_argument = buffer;
57      return(
58        _Partition_MP_Send_request_packet(
59          PARTITION_MP_GET_BUFFER_REQUEST,
60          id,
61          0           /* Not used */
62        )
63      );
64#endif
65
66    case OBJECTS_ERROR:
67      return RTEMS_INVALID_ID;
68
69    case OBJECTS_LOCAL:
70      the_buffer = _Partition_Allocate_buffer( the_partition );
71      if ( the_buffer ) {
72        the_partition->number_of_used_blocks += 1;
73        _Thread_Enable_dispatch();
74        *buffer = the_buffer;
75        return RTEMS_SUCCESSFUL;
76      }
77      _Thread_Enable_dispatch();
78      return RTEMS_UNSATISFIED;
79  }
80
81  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
82}
Note: See TracBrowser for help on using the repository browser.