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

4.104.114.84.95
Last change on this file since fa6b0f5 was a8eed23, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/27/05 at 05:57:05

Include config.h.

  • Property mode set to 100644
File size: 1.5 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
22/*PAGE
23 *
24 *  _Objects_Id_to_name
25 *
26 *  DESCRIPTION:
27 *
28 *  This routine returns the name associated with the given ID.
29 *
30 *  INPUT:
31 *
32 *  id   - id of object to lookup name
33 *  name - pointer to location in which to store name
34 *
35 */
36
37
38Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
39  Objects_Id      id,
40  Objects_Name   *name
41)
42{
43  uint32_t             the_api;
44  uint32_t             the_class;
45  Objects_Information *information;
46  Objects_Control     *the_object = (Objects_Control *) 0;
47  Objects_Locations    ignored_location;
48
49  if ( !name )
50    return OBJECTS_INVALID_NAME;
51
52  the_api = _Objects_Get_API( id );
53  if ( the_api && the_api > OBJECTS_APIS_LAST )
54    return OBJECTS_INVALID_ID;
55
56  the_class = _Objects_Get_class( id );
57
58  information = _Objects_Information_table[ the_api ][ the_class ];
59  if ( !information )
60    return OBJECTS_INVALID_ID;
61
62  if ( information->is_string )
63    return OBJECTS_INVALID_ID;
64
65  the_object = _Objects_Get( information, id, &ignored_location  );
66  if (!the_object)
67    return OBJECTS_INVALID_ID;
68
69  *name = the_object->name;
70  return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;
71}
Note: See TracBrowser for help on using the repository browser.