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

4.8
Last change on this file since bd029d87 was 5df1f03e, checked in by Jennifer Averett <Jennifer.Averett@…>, on 04/29/05 at 13:53:44

2005-04-29 Jennifer Averett <jennifer.averett@…>

  • score/src/objectidtoname.c: Removed warnings
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Obtain Object Name Given ID
3 *
4 *
5 *  COPYRIGHT (c) 1989-2003.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in 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/object.h>
21#include <rtems/score/thread.h>
22
23/*PAGE
24 *
25 *  _Objects_Id_to_name
26 *
27 *  DESCRIPTION:
28 *
29 *  This routine returns the name associated with the given ID.
30 *
31 *  INPUT:
32 *
33 *  id   - id of object to lookup name
34 *  name - pointer to location in which to store name
35 *
36 */
37
38
39Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
40  Objects_Id      id,
41  Objects_Name   *name
42)
43{
44  uint32_t             the_api;
45  uint32_t             the_class;
46  Objects_Information *information;
47  Objects_Control     *the_object = (Objects_Control *) 0;
48  Objects_Locations    ignored_location;
49
50  if ( !name )
51    return OBJECTS_INVALID_NAME;
52
53  the_api = _Objects_Get_API( id );
54  if ( the_api && the_api > OBJECTS_APIS_LAST )
55    return OBJECTS_INVALID_ID;
56
57  the_class = _Objects_Get_class( id );
58
59  information = _Objects_Information_table[ the_api ][ the_class ];
60  if ( !information )
61    return OBJECTS_INVALID_ID;
62
63  if ( information->is_string )
64    return OBJECTS_INVALID_ID;
65
66  the_object = _Objects_Get( information, id, &ignored_location );
67  if ( !the_object )
68    return OBJECTS_INVALID_ID;
69
70  *name = the_object->name;
71  _Thread_Enable_dispatch();
72  return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;
73}
Note: See TracBrowser for help on using the repository browser.