source: rtems/cpukit/score/src/objectnametoidstring.c @ 507d382

4.104.115
Last change on this file since 507d382 was 507d382, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/09 at 20:00:30

2009-09-11 Joel Sherrill <joel.sherrill@…>

  • score/include/rtems/score/coremsg.h, score/inline/rtems/score/coremsg.inl, score/src/coremsg.c, score/src/coremsginsert.c, score/src/coremsgseize.c, score/src/coremsgsubmit.c, score/src/objectnametoidstring.c: Disable the Core Message Queue features of notification, priority messages, and blocking sends when no API requires them.
  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  Object Handler - Object ID to Name (String)
3 *
4 *
5 *  COPYRIGHT (c) 1989-2008.
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 <string.h>
20
21#include <rtems/system.h>
22#include <rtems/score/address.h>
23#include <rtems/score/chain.h>
24#include <rtems/score/object.h>
25#if defined(RTEMS_MULTIPROCESSING)
26#include <rtems/score/objectmp.h>
27#endif
28#include <rtems/score/thread.h>
29#include <rtems/score/wkspace.h>
30#include <rtems/score/sysstate.h>
31#include <rtems/score/isr.h>
32
33#if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
34/*PAGE
35 *
36 *  _Objects_Name_to_id_string
37 *
38 *  These kernel routines search the object table(s) for the given
39 *  object name and returns the associated object id.
40 *
41 *  Input parameters:
42 *    information - object information
43 *    name        - user defined object name
44 *    id          - address of return ID
45 *
46 *  Output parameters:
47 *    id                                   - object id
48 *    OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL - if successful
49 *    error code                           - if unsuccessful
50 */
51
52Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string(
53  Objects_Information *information,
54  const char          *name,
55  Objects_Id          *id
56)
57{
58  Objects_Control           *the_object;
59  uint32_t                   index;
60  uint32_t                   name_length;
61
62  /* ASSERT: information->is_string == true */
63
64  if ( !id )
65    return OBJECTS_INVALID_ADDRESS;
66
67  if ( !name )
68    return OBJECTS_INVALID_NAME;
69
70  if ( information->maximum != 0 ) {
71    name_length = information->name_length;
72
73    for ( index = 1; index <= information->maximum; index++ ) {
74      the_object = information->local_table[ index ];
75      if ( !the_object )
76        continue;
77
78      if ( !the_object->name.name_p )
79        continue;
80
81      if (!strncmp( name, the_object->name.name_p, information->name_length)) {
82        *id = the_object->id;
83        return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;
84      }
85    }
86  }
87
88  return OBJECTS_INVALID_NAME;
89}
90#endif
Note: See TracBrowser for help on using the repository browser.