source: rtems/cpukit/score/src/objectidtoname.c @ f68401e

4.115
Last change on this file since f68401e was a2e3f33, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 11:50:54

score: Create object implementation header

Move implementation specific parts of object.h and object.inl into new
header file objectimpl.h. The object.h contains now only the
application visible API.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  @file
3 *
4 *  @brief Object id to name
5 *  @ingroup Score
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2003.
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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/threadimpl.h>
22
23Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
24  Objects_Id      id,
25  Objects_Name   *name
26)
27{
28  uint32_t             the_api;
29  uint32_t             the_class;
30  Objects_Id           tmpId;
31  Objects_Information *information;
32  Objects_Control     *the_object = (Objects_Control *) 0;
33  Objects_Locations    ignored_location;
34
35  /*
36   *  Caller is trusted for name != NULL.
37   */
38
39  tmpId = (id == OBJECTS_ID_OF_SELF) ? _Thread_Get_executing()->Object.id : id;
40
41  the_api = _Objects_Get_API( tmpId );
42  if ( !_Objects_Is_api_valid( the_api ) )
43    return OBJECTS_INVALID_ID;
44
45  if ( !_Objects_Information_table[ the_api ] )
46    return OBJECTS_INVALID_ID;
47
48  the_class = _Objects_Get_class( tmpId );
49
50  information = _Objects_Information_table[ the_api ][ the_class ];
51  if ( !information )
52    return OBJECTS_INVALID_ID;
53
54  #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
55    if ( information->is_string )
56      return OBJECTS_INVALID_ID;
57  #endif
58
59  the_object = _Objects_Get( information, tmpId, &ignored_location );
60  if ( !the_object )
61    return OBJECTS_INVALID_ID;
62
63  *name = the_object->name;
64  _Objects_Put( the_object );
65  return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;
66}
Note: See TracBrowser for help on using the repository browser.