| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | #if HAVE_CONFIG_H1 |
| 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 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( |
| 51 | Objects_Information *information, |
| 52 | uint32_t name, |
| 53 | uint32_t node, |
| 54 | Objects_Id *id |
| 55 | ) |
| 56 | { |
| 57 | bool_Bool search_local_node; |
| 58 | Objects_Control *the_object; |
| 59 | uint32_t index; |
| 60 | uint32_t name_length; |
| 61 | #if defined(RTEMS_MULTIPROCESSING) |
| 62 | Objects_Name name_for_mp; |
| 63 | #endif |
| 64 | |
| 65 | |
| 66 | |
| 67 | if ( !id ) |
| 68 | return OBJECTS_INVALID_ADDRESS; |
| 69 | |
| 70 | if ( name == 0 ) |
| 71 | return OBJECTS_INVALID_NAME; |
| 72 | |
| 73 | search_local_node = false0; |
| 74 | |
| 75 | if ( information->maximum != 0 && |
| 76 | (node == OBJECTS_SEARCH_ALL_NODES0 || |
| 77 | node == OBJECTS_SEARCH_LOCAL_NODE0x7FFFFFFF || |
| 78 | _Objects_Is_local_node( node ) |
| 79 | )) |
| 80 | search_local_node = true1; |
| 81 | |
| 82 | if ( search_local_node ) { |
| 83 | name_length = information->name_length; |
| Value stored to 'name_length' is never read |
| 84 | |
| 85 | for ( index = 1; index <= information->maximum; index++ ) { |
| 86 | the_object = information->local_table[ index ]; |
| 87 | if ( !the_object ) |
| 88 | continue; |
| 89 | |
| 90 | if ( name == the_object->name.name_u32 ) { |
| 91 | *id = the_object->id; |
| 92 | return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL; |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | #if defined(RTEMS_MULTIPROCESSING) |
| 98 | if ( _Objects_Is_local_node( node ) || node == OBJECTS_SEARCH_LOCAL_NODE0x7FFFFFFF ) |
| 99 | return OBJECTS_INVALID_NAME; |
| 100 | |
| 101 | name_for_mp.name_u32 = name; |
| 102 | return _Objects_MP_Global_name_search( information, name_for_mp, node, id ); |
| 103 | #else |
| 104 | return OBJECTS_INVALID_NAME; |
| 105 | #endif |
| 106 | } |