source: rtems/cpukit/score/src/objectgetnoprotection.c @ d7c3883

4.115
Last change on this file since d7c3883 was 4ff7e0f, checked in by Joel Sherrill <joel.sherrill@…>, on 01/09/08 at 20:49:44

2008-01-09 Joel Sherrill <joel.sherrill@…>

  • score/src/objectgetnoprotection.c: Eliminate duplicate exit path code when there is an error.
  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  Object Handler -- Object Get
3 *
4 *
5 *  COPYRIGHT (c) 1989-2002.
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#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/score/address.h>
21#include <rtems/score/chain.h>
22#include <rtems/score/object.h>
23#if defined(RTEMS_MULTIPROCESSING)
24#include <rtems/score/objectmp.h>
25#endif
26#include <rtems/score/thread.h>
27#include <rtems/score/wkspace.h>
28#include <rtems/score/sysstate.h>
29#include <rtems/score/isr.h>
30
31/*PAGE
32 *
33 * _Objects_Get_no_protection
34 *
35 * This routine sets the object pointer for the given
36 * object id based on the given object information structure.
37 *
38 * Input parameters:
39 *   information - pointer to entry in table for this class
40 *   id          - object id to search for
41 *   location    - address of where to store the location
42 *
43 * Output parameters:
44 *   returns  - address of object if local
45 *   location - one of the following:
46 *                  OBJECTS_ERROR  - invalid object ID
47 *                  OBJECTS_REMOTE - remote object
48 *                  OBJECTS_LOCAL  - local object
49 */
50
51Objects_Control *_Objects_Get_no_protection(
52  Objects_Information *information,
53  Objects_Id           id,
54  Objects_Locations   *location
55)
56{
57  Objects_Control *the_object;
58  uint32_t         index;
59
60  /*
61   * You can't just extract the index portion or you can get tricked
62   * by a value between 1 and maximum.
63   */
64  index = id - information->minimum_id + 1;
65
66  if ( information->maximum >= index ) {
67    if ( (the_object = information->local_table[ index ]) != NULL ) {
68      *location = OBJECTS_LOCAL;
69      return the_object;
70    }
71  }
72
73  /*
74   *  This isn't supported or required yet for Global objects so
75   *  if it isn't local, we don't find it.
76   */
77  *location = OBJECTS_ERROR;
78  return NULL;
79}
Note: See TracBrowser for help on using the repository browser.