source: rtems/cpukit/score/src/objectinitializeinformation.c @ 2d7ae960

4.115
Last change on this file since 2d7ae960 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: 4.8 KB
Line 
1/*
2 *  Object Handler Initialization per Object Class
3 *
4 *  COPYRIGHT (c) 1989-2011.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/system.h>
17#include <rtems/score/address.h>
18#include <rtems/score/chain.h>
19#include <rtems/score/object.h>
20#if defined(RTEMS_MULTIPROCESSING)
21#include <rtems/score/objectmp.h>
22#endif
23#include <rtems/score/thread.h>
24#include <rtems/score/wkspace.h>
25#include <rtems/score/sysstate.h>
26#include <rtems/score/isr.h>
27
28/*
29 *  _Objects_Initialize_information
30 *
31 *  This routine initializes all object information related data structures.
32 *
33 *  Input parameters:
34 *    information         - object information table
35 *    maximum             - maximum objects of this class
36 *    size                - size of this object's control block
37 *    is_string           - true if names for this object are strings
38 *    maximum_name_length - maximum length of each object's name
39 *    When multiprocessing is configured,
40 *      supports_global     - true if this is a global object class
41 *      extract_callout     - pointer to threadq extract callout
42 *
43 *  Output parameters:  NONE
44 */
45
46void _Objects_Initialize_information(
47  Objects_Information *information,
48  Objects_APIs         the_api,
49  uint16_t             the_class,
50  uint32_t             maximum,
51  uint16_t             size,
52  bool                 is_string,
53  uint32_t             maximum_name_length
54#if defined(RTEMS_MULTIPROCESSING)
55  ,
56  bool                 supports_global,
57  Objects_Thread_queue_Extract_callout extract
58#endif
59)
60{
61  static Objects_Control *null_local_table = NULL;
62  uint32_t                minimum_index;
63  Objects_Maximum         maximum_per_allocation;
64  #if defined(RTEMS_MULTIPROCESSING)
65    uint32_t              index;
66  #endif
67
68  information->the_api            = the_api;
69  information->the_class          = the_class;
70  information->size               = size;
71  information->local_table        = 0;
72  information->inactive_per_block = 0;
73  information->object_blocks      = 0;
74  information->inactive           = 0;
75  #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
76    information->is_string        = is_string;
77  #endif
78
79  /*
80   *  Set the maximum value to 0. It will be updated when objects are
81   *  added to the inactive set from _Objects_Extend_information()
82   */
83  information->maximum = 0;
84
85  /*
86   *  Register this Object Class in the Object Information Table.
87   */
88  _Objects_Information_table[ the_api ][ the_class ] = information;
89
90  /*
91   *  Are we operating in limited or unlimited (e.g. auto-extend) mode.
92   */
93  information->auto_extend = _Objects_Is_unlimited( maximum );
94  maximum_per_allocation = _Objects_Maximum_per_allocation( maximum );
95
96  /*
97   *  Unlimited and maximum of zero is illogical.
98   */
99  if ( information->auto_extend && maximum_per_allocation == 0) {
100    _Internal_error_Occurred(
101      INTERNAL_ERROR_CORE,
102      true,
103      INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0
104    );
105  }
106
107  /*
108   *  The allocation unit is the maximum value
109   */
110  information->allocation_size = maximum_per_allocation;
111
112  /*
113   *  Provide a null local table entry for the case of any empty table.
114   */
115  information->local_table = &null_local_table;
116
117  /*
118   *  Calculate minimum and maximum Id's
119   */
120  minimum_index = (maximum_per_allocation == 0) ? 0 : 1;
121  information->minimum_id =
122    _Objects_Build_id( the_api, the_class, _Objects_Local_node, minimum_index );
123
124  /*
125   *  Calculate the maximum name length
126   *
127   *  NOTE: Either 4 bytes for Classic API names or an arbitrary
128   *        number for POSIX names which are strings that may be
129   *        an odd number of bytes.
130   */
131
132  information->name_length = maximum_name_length;
133
134  _Chain_Initialize_empty( &information->Inactive );
135
136  /*
137   *  Initialize objects .. if there are any
138   */
139  if ( maximum_per_allocation ) {
140    /*
141     *  Always have the maximum size available so the current performance
142     *  figures are create are met.  If the user moves past the maximum
143     *  number then a performance hit is taken.
144     */
145    _Objects_Extend_information( information );
146  }
147
148  /*
149   *  Take care of multiprocessing
150   */
151  #if defined(RTEMS_MULTIPROCESSING)
152    information->extract = extract;
153
154    if ( (supports_global == true) && _System_state_Is_multiprocessing ) {
155
156      information->global_table =
157        (Chain_Control *) _Workspace_Allocate_or_fatal_error(
158          (_Objects_Maximum_nodes + 1) * sizeof(Chain_Control)
159        );
160
161      for ( index=1; index <= _Objects_Maximum_nodes ; index++ )
162        _Chain_Initialize_empty( &information->global_table[ index ] );
163     }
164     else
165       information->global_table = NULL;
166  #endif
167}
Note: See TracBrowser for help on using the repository browser.