source: rtems/cpukit/score/src/objectmp.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 6.7 KB
Line 
1/*
2 *  Multiprocessing Support for the Object Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
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
13#if HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <rtems/system.h>
18#include <rtems/config.h>
19#include <rtems/score/interr.h>
20#include <rtems/score/object.h>
21#include <rtems/score/wkspace.h>
22#include <rtems/score/thread.h>
23
24/*
25 *  _Objects_MP_Handler_early_initialization
26 *
27 */
28void _Objects_MP_Handler_early_initialization(void)
29{
30  uint32_t   node;
31  uint32_t   maximum_nodes;
32
33  node                   = _Configuration_MP_table->node;
34  maximum_nodes          = _Configuration_MP_table->maximum_nodes;
35
36  if ( node < 1 || node > maximum_nodes )
37    _Internal_error_Occurred(
38      INTERNAL_ERROR_CORE,
39      true,
40      INTERNAL_ERROR_INVALID_NODE
41    );
42
43  _Objects_Local_node    = node;
44  _Objects_Maximum_nodes = maximum_nodes;
45}
46
47/*
48 *  _Objects_MP_Handler_initialization
49 *
50 */
51
52void _Objects_MP_Handler_initialization(void)
53{
54
55  uint32_t   maximum_global_objects;
56
57  maximum_global_objects = _Configuration_MP_table->maximum_global_objects;
58
59  _Objects_MP_Maximum_global_objects = maximum_global_objects;
60
61  if ( maximum_global_objects == 0 ) {
62    _Chain_Initialize_empty( &_Objects_MP_Inactive_global_objects );
63    return;
64  }
65
66  _Chain_Initialize(
67    &_Objects_MP_Inactive_global_objects,
68    _Workspace_Allocate_or_fatal_error(
69      maximum_global_objects * sizeof( Objects_MP_Control )
70    ),
71    maximum_global_objects,
72    sizeof( Objects_MP_Control )
73  );
74
75}
76
77/*
78 *  _Objects_MP_Open
79 *
80 */
81
82void _Objects_MP_Open (
83  Objects_Information *information,
84  Objects_MP_Control  *the_global_object,
85  uint32_t             the_name,      /* XXX -- wrong for variable */
86  Objects_Id           the_id
87)
88{
89  the_global_object->Object.id = the_id;
90  the_global_object->name      = the_name;
91
92  _Chain_Prepend(
93    &information->global_table[ _Objects_Get_node( the_id ) ],
94    &the_global_object->Object.Node
95  );
96
97}
98
99/*
100 *  _Objects_MP_Allocate_and_open
101 *
102 */
103
104bool _Objects_MP_Allocate_and_open (
105  Objects_Information *information,
106  uint32_t             the_name,      /* XXX -- wrong for variable */
107  Objects_Id           the_id,
108  bool                 is_fatal_error
109)
110{
111  Objects_MP_Control  *the_global_object;
112
113  the_global_object = _Objects_MP_Allocate_global_object();
114  if ( _Objects_MP_Is_null_global_object( the_global_object ) ) {
115
116    if ( is_fatal_error == false )
117      return false;
118
119    _Internal_error_Occurred(
120      INTERNAL_ERROR_CORE,
121      true,
122      INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS
123    );
124
125  }
126
127  _Objects_MP_Open( information, the_global_object, the_name, the_id );
128
129  return true;
130}
131
132/*
133 *  _Objects_MP_Close
134 *
135 */
136
137void _Objects_MP_Close (
138  Objects_Information *information,
139  Objects_Id           the_id
140)
141{
142  Chain_Control      *the_chain;
143  Chain_Node         *the_node;
144  Objects_MP_Control *the_object;
145
146  the_chain = &information->global_table[ _Objects_Get_node( the_id ) ];
147
148  for ( the_node = _Chain_First( the_chain ) ;
149        !_Chain_Is_tail( the_chain, the_node ) ;
150        the_node = _Chain_Next( the_node ) ) {
151
152    the_object = (Objects_MP_Control *) the_node;
153
154    if ( _Objects_Are_ids_equal( the_object->Object.id, the_id ) ) {
155
156      _Chain_Extract( the_node );
157      _Objects_MP_Free_global_object( the_object );
158      return;
159    }
160
161  }
162
163  _Internal_error_Occurred(
164    INTERNAL_ERROR_CORE,
165    true,
166    INTERNAL_ERROR_INVALID_GLOBAL_ID
167  );
168}
169
170/*
171 *  _Objects_MP_Global_name_search
172 *
173 */
174
175Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search (
176  Objects_Information *information,
177  Objects_Name         the_name,
178  uint32_t             nodes_to_search,
179  Objects_Id          *the_id
180)
181{
182  uint32_t            low_node;
183  uint32_t            high_node;
184  uint32_t            node_index;
185  Chain_Control      *the_chain;
186  Chain_Node         *the_node;
187  Objects_MP_Control *the_object;
188  uint32_t            name_to_use;
189
190  name_to_use = the_name.name_u32;  /* XXX only fixed length names */
191
192  if ( nodes_to_search > _Objects_Maximum_nodes )
193    return OBJECTS_INVALID_NODE;
194
195  if ( information->global_table == NULL )
196    return OBJECTS_INVALID_NAME;
197
198  if ( nodes_to_search == OBJECTS_SEARCH_ALL_NODES ||
199       nodes_to_search == OBJECTS_SEARCH_OTHER_NODES ) {
200    low_node = 1;
201    high_node = _Objects_Maximum_nodes;
202  } else {
203    low_node  =
204    high_node = nodes_to_search;
205  }
206
207  _Thread_Disable_dispatch();
208
209  for ( node_index = low_node ; node_index <= high_node ; node_index++ ) {
210
211    /*
212     *  NOTE: The local node was search (if necessary) by
213     *        _Objects_Name_to_id_XXX before this was invoked.
214     */
215
216    if ( !_Objects_Is_local_node( node_index ) ) {
217      the_chain = &information->global_table[ node_index ];
218
219      for ( the_node = _Chain_First( the_chain ) ;
220            !_Chain_Is_tail( the_chain, the_node ) ;
221            the_node = _Chain_Next( the_node ) ) {
222
223        the_object = (Objects_MP_Control *) the_node;
224
225        if ( the_object->name == name_to_use ) {
226          *the_id = the_object->Object.id;
227          _Thread_Enable_dispatch();
228          return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;
229        }
230      }
231    }
232  }
233
234  _Thread_Enable_dispatch();
235  return OBJECTS_INVALID_NAME;
236}
237
238/*
239 *  _Objects_MP_Is_remote
240 *
241 */
242
243void _Objects_MP_Is_remote (
244  Objects_Information  *information,
245  Objects_Id            the_id,
246  Objects_Locations    *location,
247  Objects_Control     **the_object
248)
249{
250  uint32_t            node;
251  Chain_Control      *the_chain;
252  Chain_Node         *the_node;
253  Objects_MP_Control *the_global_object;
254
255  node = _Objects_Get_node( the_id );
256
257  /*
258   *  NOTE: The local node was search (if necessary) by
259   *        _Objects_Name_to_id_XXX before this was invoked.
260   *
261   *        The NODE field of an object id cannot be 0
262   *        because 0 is an invalid node number.
263   */
264
265  if ( node == 0 ||
266       _Objects_Is_local_node( node ) ||
267       node > _Objects_Maximum_nodes ||
268       information->global_table == NULL ) {
269
270    *location   = OBJECTS_ERROR;
271    *the_object = NULL;
272    return;
273  }
274
275  _Thread_Disable_dispatch();
276
277  the_chain = &information->global_table[ node ];
278
279  for ( the_node = _Chain_First( the_chain ) ;
280        !_Chain_Is_tail( the_chain, the_node ) ;
281        the_node = _Chain_Next( the_node ) ) {
282
283    the_global_object = (Objects_MP_Control *) the_node;
284
285    if ( _Objects_Are_ids_equal( the_global_object->Object.id, the_id ) ) {
286      _Thread_Unnest_dispatch();
287      *location   = OBJECTS_REMOTE;
288      *the_object = (Objects_Control *) the_global_object;
289      return;
290    }
291  }
292
293  _Thread_Enable_dispatch();
294  *location   = OBJECTS_ERROR;
295  *the_object = NULL;
296
297}
298
Note: See TracBrowser for help on using the repository browser.