source: rtems/cpukit/score/src/objectinitializeinformation.c @ 359a3a3

5
Last change on this file since 359a3a3 was 359a3a3, checked in by Sebastian Huber <sebastian.huber@…>, on 11/22/18 at 05:38:42

score: Rename Objects_Information::allocation_size

Rename Objects_Information::allocation_size in
Objects_Information::objects_per_block. Adjust integer types in
_Objects_Shrink_information() and _Objects_Free().

Update #3621.

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief Initialize Object Information
5 * @ingroup ScoreObject
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2011.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/objectimpl.h>
22#include <rtems/score/chainimpl.h>
23#include <rtems/score/interr.h>
24#include <rtems/score/sysstate.h>
25#include <rtems/score/wkspace.h>
26
27void _Objects_Do_initialize_information(
28  Objects_Information *information,
29  Objects_APIs         the_api,
30  uint16_t             the_class,
31  uint32_t             maximum,
32  uint16_t             object_size,
33  uint16_t             maximum_name_length
34#if defined(RTEMS_MULTIPROCESSING)
35  ,
36  Objects_Thread_queue_Extract_callout extract
37#endif
38)
39{
40  static Objects_Control *null_local_table = NULL;
41  uint32_t                minimum_index;
42  Objects_Maximum         maximum_per_allocation;
43
44  information->the_api            = the_api;
45  information->the_class          = the_class;
46  information->object_size        = object_size;
47  information->local_table        = 0;
48  information->inactive_per_block = 0;
49  information->object_blocks      = 0;
50  information->inactive           = 0;
51
52  /*
53   *  Set the maximum value to 0. It will be updated when objects are
54   *  added to the inactive set from _Objects_Extend_information()
55   */
56  information->maximum = 0;
57
58  /*
59   *  Register this Object Class in the Object Information Table.
60   */
61  _Objects_Information_table[ the_api ][ the_class ] = information;
62
63  /*
64   *  Are we operating in limited or unlimited (e.g. auto-extend) mode.
65   */
66  information->auto_extend = _Objects_Is_unlimited( maximum );
67  maximum_per_allocation = _Objects_Maximum_per_allocation( maximum );
68
69  /*
70   *  Unlimited and maximum of zero is illogical.
71   */
72  if ( information->auto_extend && maximum_per_allocation == 0) {
73    _Internal_error( INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 );
74  }
75
76  /*
77   *  The allocation unit is the maximum value
78   */
79  information->objects_per_block = maximum_per_allocation;
80
81  /*
82   *  Provide a null local table entry for the case of any empty table.
83   */
84  information->local_table = &null_local_table;
85
86  /*
87   *  Calculate minimum and maximum Id's
88   */
89  minimum_index = (maximum_per_allocation == 0) ? 0 : 1;
90  information->minimum_id =
91    _Objects_Build_id( the_api, the_class, _Objects_Local_node, minimum_index );
92
93  /*
94   *  Calculate the maximum name length
95   *
96   *  NOTE: Either 4 bytes for Classic API names or an arbitrary
97   *        number for POSIX names which are strings that may be
98   *        an odd number of bytes.
99   */
100
101  information->name_length = maximum_name_length;
102
103  _Chain_Initialize_empty( &information->Inactive );
104
105  /*
106   *  Initialize objects .. if there are any
107   */
108  if ( maximum_per_allocation ) {
109    /*
110     *  Always have the maximum size available so the current performance
111     *  figures are create are met.  If the user moves past the maximum
112     *  number then a performance hit is taken.
113     */
114    _Objects_Extend_information( information );
115  }
116
117  /*
118   *  Take care of multiprocessing
119   */
120  #if defined(RTEMS_MULTIPROCESSING)
121    information->extract = extract;
122    _RBTree_Initialize_empty( &information->Global_by_id );
123    _RBTree_Initialize_empty( &information->Global_by_name );
124  #endif
125}
Note: See TracBrowser for help on using the repository browser.