Changeset 1c2d178 in rtems


Ignore:
Timestamp:
11/25/18 19:15:26 (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
f70079c
Parents:
3899bc1a
git-author:
Sebastian Huber <sebastian.huber@…> (11/25/18 19:15:26)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/07/18 13:22:02)
Message:

score: Remove Objects_Information::maximum

This information is already present in Objects_Information::maximum_id.
Add and use _Objects_Get_maximum_index().

Update #3621.

Files:
13 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/score/objectimpl.h

    r3899bc1a r1c2d178  
    125125  /** This points to the table of local objects. */
    126126  Objects_Control **local_table;
    127   /** This is the maximum number of objects in this class. */
    128   Objects_Maximum   maximum;
    129127  /** This is the number of objects on the Inactive list. */
    130128  Objects_Maximum   inactive;
     
    852850
    853851/**
     852 * Returns the maximum index of the specified object class.
     853 *
     854 * @param[in] information The object information.
     855 *
     856 * @return The maximum index of the specified object class.
     857 */
     858RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Get_maximum_index(
     859  const Objects_Information *information
     860)
     861{
     862  return _Objects_Get_index( information->maximum_id );
     863}
     864
     865/**
    854866 * This function sets the pointer to the local_table object
    855867 * referenced by the index.
     
    877889   */
    878890  _Assert( index >= OBJECTS_INDEX_MINIMUM );
    879   _Assert( index <= information->maximum );
     891  _Assert( index <= _Objects_Get_maximum_index( information ) );
    880892
    881893  information->local_table[ index - OBJECTS_INDEX_MINIMUM ] = the_object;
  • cpukit/posix/src/killinfo.c

    r3899bc1a r1c2d178  
    208208      continue;
    209209
    210     maximum = the_info->maximum;
     210    maximum = _Objects_Get_maximum_index( the_info );
    211211    object_table = the_info->local_table;
    212212
  • cpukit/rtems/src/rtemsobjectgetclassinfo.c

    r3899bc1a r1c2d178  
    4848  info->maximum_id  = obj_info->maximum_id;
    4949  info->auto_extend = obj_info->auto_extend;
    50   info->maximum     = obj_info->maximum;
     50  info->maximum     = _Objects_Get_maximum_index( obj_info );
    5151
    5252  for ( unallocated=0, i=1 ; i <= info->maximum ; i++ )
  • cpukit/score/src/objectactivecount.c

    r3899bc1a r1c2d178  
    2525)
    2626{
    27   size_t inactive;
    28   size_t maximum;
     27  Objects_Maximum inactive;
     28  Objects_Maximum maximum;
    2929
    3030  _Assert( _Objects_Allocator_is_owner() );
    3131
    32   inactive = _Chain_Node_count_unprotected( &information->Inactive );
    33   maximum  = information->maximum;
     32  inactive = (Objects_Maximum)
     33    _Chain_Node_count_unprotected( &information->Inactive );
     34  maximum  = _Objects_Get_maximum_index( information );
    3435
    35   return (Objects_Maximum) ( maximum - inactive );
     36  return maximum - inactive;
    3637}
  • cpukit/score/src/objectextendinformation.c

    r3899bc1a r1c2d178  
    5050  uint32_t          index_end;
    5151  uint32_t          index;
    52   uint32_t          maximum;
     52  Objects_Maximum   old_maximum;
     53  uint32_t          new_maximum;
    5354  size_t            object_block_size;
    5455  Objects_Control  *new_object_block;
     
    6061  );
    6162
     63  old_maximum = _Objects_Get_maximum_index( information );
     64
    6265  /*
    6366   *  Search for a free block of indexes. If we do NOT need to allocate or
     
    7174    block_count = 0;
    7275  else {
    73     block_count = information->maximum / information->objects_per_block;
     76    block_count = old_maximum / information->objects_per_block;
    7477
    7578    for ( ; block < block_count; block++ ) {
     
    8386  index_end = index_base + information->objects_per_block;
    8487
    85   maximum = (uint32_t) information->maximum + information->objects_per_block;
     88  new_maximum = (uint32_t) old_maximum + information->objects_per_block;
    8689
    8790  /*
     
    9093   *  case of 16-bit Ids, this is only 256 object instances.
    9194   */
    92   if ( maximum > OBJECTS_ID_FINAL_INDEX ) {
     95  if ( new_maximum > OBJECTS_ID_FINAL_INDEX ) {
    9396    return;
    9497  }
     
    147150     */
    148151    object_blocks_size = block_count * sizeof( *object_blocks );
    149     local_table_size =  maximum * sizeof( *local_table );
     152    local_table_size =  new_maximum * sizeof( *local_table );
    150153    table_size = object_blocks_size
    151154      + local_table_size
     
    179182    block_count--;
    180183
    181     if ( information->maximum > 0 ) {
     184    if ( old_maximum > 0 ) {
    182185      /*
    183186       *  Copy each section of the table over. This has to be performed as
     
    197200        local_table,
    198201        information->local_table,
    199         information->maximum * sizeof( *local_table )
     202        old_maximum * sizeof( *local_table )
    200203      );
    201204    }
     
    216219    information->inactive_per_block = inactive_per_block;
    217220    information->local_table = local_table;
    218     information->maximum = (Objects_Maximum) maximum;
    219221    information->maximum_id = _Objects_Build_id(
    220222      information->the_api,
    221223      information->the_class,
    222224      _Objects_Local_node,
    223       information->maximum
     225      new_maximum
    224226    );
    225227
  • cpukit/score/src/objectgetinfo.c

    r3899bc1a r1c2d178  
    5656   */
    5757  #if !defined(RTEMS_MULTIPROCESSING)
    58     if ( info->maximum == 0 )
     58    if ( _Objects_Get_maximum_index( info ) == 0 )
    5959      return NULL;
    6060  #endif
  • cpukit/score/src/objectgetnext.c

    r3899bc1a r1c2d178  
    2929    Objects_Control *the_object;
    3030    Objects_Id       next_id;
     31    Objects_Maximum  maximum;
    3132
    3233    if ( !information )
     
    4243
    4344    _Objects_Allocator_lock();
     45    maximum = _Objects_Get_maximum_index( information );
    4446
    4547    do {
    46         /* walked off end of list? */
    47         if (_Objects_Get_index(next_id) > information->maximum)
    48         {
    49             _Objects_Allocator_unlock();
    50             *next_id_p = OBJECTS_ID_FINAL;
    51             return NULL;
    52         }
     48      /* walked off end of list? */
     49      if (_Objects_Get_index( next_id ) > maximum) {
     50        _Objects_Allocator_unlock();
     51        *next_id_p = OBJECTS_ID_FINAL;
     52        return NULL;
     53      }
    5354
    54         /* try to grab one */
    55         the_object = _Objects_Get_no_protection( next_id, information );
     55      /* try to grab one */
     56      the_object = _Objects_Get_no_protection( next_id, information );
    5657
    57         next_id++;
    58 
     58      next_id++;
    5959    } while ( the_object == NULL );
    6060
  • cpukit/score/src/objectinitializeinformation.c

    r3899bc1a r1c2d178  
    4040  Objects_Maximum maximum_per_allocation;
    4141
    42   information->the_api            = the_api;
    43   information->the_class          = the_class;
    44   information->object_size        = object_size;
    45   information->local_table        = 0;
    46   information->inactive_per_block = 0;
    47   information->object_blocks      = 0;
    48   information->inactive           = 0;
    49   information->local_table        = NULL;
    50 
    51   /*
    52    *  Set the maximum value to 0. It will be updated when objects are
    53    *  added to the inactive set from _Objects_Extend_information()
    54    */
    55   information->maximum = 0;
     42  information->the_api     = the_api;
     43  information->the_class   = the_class;
     44  information->object_size = object_size;
    5645
    5746  /*
  • cpukit/score/src/objectnametoid.c

    r3899bc1a r1c2d178  
    3030  bool                       search_local_node;
    3131  Objects_Control           *the_object;
     32  Objects_Maximum            maximum;
    3233  Objects_Maximum            index;
    3334#if defined(RTEMS_MULTIPROCESSING)
     
    4344    return OBJECTS_INVALID_NAME;
    4445
     46  maximum = _Objects_Get_maximum_index( information );
    4547  search_local_node = false;
    4648
    47   if ( information->maximum != 0 &&
     49  if ( maximum > 0 &&
    4850      (node == OBJECTS_SEARCH_ALL_NODES ||
    4951       node == OBJECTS_SEARCH_LOCAL_NODE ||
     
    5355
    5456  if ( search_local_node ) {
    55     for ( index = 0; index < information->maximum; ++index ) {
     57    for ( index = 0; index < maximum; ++index ) {
    5658      the_object = information->local_table[ index ];
    5759      if ( !the_object )
  • cpukit/score/src/objectnametoidstring.c

    r3899bc1a r1c2d178  
    3030)
    3131{
    32   size_t   name_length;
    33   size_t   max_name_length;
    34   uint32_t index;
     32  size_t          name_length;
     33  size_t          max_name_length;
     34  Objects_Maximum maximum;
     35  Objects_Maximum index;
    3536
    3637  _Assert( _Objects_Has_string_name( information ) );
     
    5354  }
    5455
    55   for ( index = 0; index < information->maximum; ++index ) {
     56  maximum = _Objects_Get_maximum_index( information );
     57
     58  for ( index = 0; index < maximum; ++index ) {
    5659    Objects_Control *the_object;
    5760
  • cpukit/score/src/objectshrinkinformation.c

    r3899bc1a r1c2d178  
    4040
    4141  objects_per_block = information->objects_per_block;
    42   block_count = information->maximum / objects_per_block;
     42  block_count = _Objects_Get_maximum_index( information ) / objects_per_block;
    4343  index_base = 0;
    4444
  • cpukit/score/src/threaditerate.c

    r3899bc1a r1c2d178  
    2828  for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; ++api_index ) {
    2929    const Objects_Information *information;
    30     Objects_Maximum            i;
     30    Objects_Maximum            maximum;
     31    Objects_Maximum            index;
    3132
    3233    if ( _Objects_Information_table[ api_index ] == NULL ) {
     
    4041    }
    4142
    42     for ( i = 0 ; i < information->maximum ; ++i ) {
     43    maximum = _Objects_Get_maximum_index( information );
     44
     45    for ( index = 0 ; index < maximum ; ++index ) {
    4346      Thread_Control *the_thread;
    4447
    45       the_thread = (Thread_Control *) information->local_table[ i ];
     48      the_thread = (Thread_Control *) information->local_table[ index ];
    4649
    4750      if ( the_thread != NULL ) {
  • testsuites/sptests/spsysinit01/init.c

    r3899bc1a r1c2d178  
    249249FIRST(RTEMS_SYSINIT_DATA_STRUCTURES)
    250250{
    251   assert(_Thread_Internal_information.Objects.maximum == 0);
     251  assert(
     252    _Objects_Get_maximum_index(&_Thread_Internal_information.Objects) == 0
     253  );
    252254  next_step(DATA_STRUCTURES_PRE);
    253255}
     
    255257LAST(RTEMS_SYSINIT_DATA_STRUCTURES)
    256258{
    257   assert(_Thread_Internal_information.Objects.maximum != 0);
     259  assert(
     260    _Objects_Get_maximum_index(&_Thread_Internal_information.Objects) != 0
     261  );
    258262  next_step(DATA_STRUCTURES_POST);
    259263}
     
    261265FIRST(RTEMS_SYSINIT_USER_EXTENSIONS)
    262266{
    263   assert(_Extension_Information.maximum == 0);
     267  assert(_Objects_Get_maximum_index(&_Extension_Information) == 0);
    264268  next_step(USER_EXTENSIONS_PRE);
    265269}
     
    267271LAST(RTEMS_SYSINIT_USER_EXTENSIONS)
    268272{
    269   assert(_Extension_Information.maximum != 0);
     273  assert(_Objects_Get_maximum_index(&_Extension_Information) != 0);
    270274  next_step(USER_EXTENSIONS_POST);
    271275}
     
    273277FIRST(RTEMS_SYSINIT_CLASSIC_TASKS)
    274278{
    275   assert(_RTEMS_tasks_Information.Objects.maximum == 0);
     279  assert(_Objects_Get_maximum_index(&_RTEMS_tasks_Information.Objects) == 0);
    276280  next_step(CLASSIC_TASKS_PRE);
    277281}
     
    279283LAST(RTEMS_SYSINIT_CLASSIC_TASKS)
    280284{
    281   assert(_RTEMS_tasks_Information.Objects.maximum != 0);
     285  assert(_Objects_Get_maximum_index(&_RTEMS_tasks_Information.Objects) != 0);
    282286  next_step(CLASSIC_TASKS_POST);
    283287}
     
    285289FIRST(RTEMS_SYSINIT_CLASSIC_TIMER)
    286290{
    287   assert(_Timer_Information.maximum == 0);
     291  assert(_Objects_Get_maximum_index(&_Timer_Information) == 0);
    288292  next_step(CLASSIC_TIMER_PRE);
    289293}
     
    291295LAST(RTEMS_SYSINIT_CLASSIC_TIMER)
    292296{
    293   assert(_Timer_Information.maximum != 0);
     297  assert(_Objects_Get_maximum_index(&_Timer_Information) != 0);
    294298  next_step(CLASSIC_TIMER_POST);
    295299}
     
    319323FIRST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE)
    320324{
    321   assert(_Message_queue_Information.maximum == 0);
     325  assert(_Objects_Get_maximum_index(&_Message_queue_Information) == 0);
    322326  next_step(CLASSIC_MESSAGE_QUEUE_PRE);
    323327}
     
    325329LAST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE)
    326330{
    327   assert(_Message_queue_Information.maximum != 0);
     331  assert(_Objects_Get_maximum_index(&_Message_queue_Information) != 0);
    328332  next_step(CLASSIC_MESSAGE_QUEUE_POST);
    329333}
     
    331335FIRST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE)
    332336{
    333   assert(_Semaphore_Information.maximum == 0);
     337  assert(_Objects_Get_maximum_index(&_Semaphore_Information) == 0);
    334338  next_step(CLASSIC_SEMAPHORE_PRE);
    335339}
     
    337341LAST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE)
    338342{
    339   assert(_Semaphore_Information.maximum != 0);
     343  assert(_Objects_Get_maximum_index(&_Semaphore_Information) != 0);
    340344  next_step(CLASSIC_SEMAPHORE_POST);
    341345}
     
    343347FIRST(RTEMS_SYSINIT_CLASSIC_PARTITION)
    344348{
    345   assert(_Partition_Information.maximum == 0);
     349  assert(_Objects_Get_maximum_index(&_Partition_Information) == 0);
    346350  next_step(CLASSIC_PARTITION_PRE);
    347351}
     
    349353LAST(RTEMS_SYSINIT_CLASSIC_PARTITION)
    350354{
    351   assert(_Partition_Information.maximum != 0);
     355  assert(_Objects_Get_maximum_index(&_Partition_Information) != 0);
    352356  next_step(CLASSIC_PARTITION_POST);
    353357}
     
    355359FIRST(RTEMS_SYSINIT_CLASSIC_REGION)
    356360{
    357   assert(_Region_Information.maximum == 0);
     361  assert(_Objects_Get_maximum_index(&_Region_Information) == 0);
    358362  next_step(CLASSIC_REGION_PRE);
    359363}
     
    361365LAST(RTEMS_SYSINIT_CLASSIC_REGION)
    362366{
    363   assert(_Region_Information.maximum != 0);
     367  assert(_Objects_Get_maximum_index(&_Region_Information) != 0);
    364368  next_step(CLASSIC_REGION_POST);
    365369}
     
    367371FIRST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY)
    368372{
    369   assert(_Dual_ported_memory_Information.maximum == 0);
     373  assert(_Objects_Get_maximum_index(&_Dual_ported_memory_Information) == 0);
    370374  next_step(CLASSIC_DUAL_PORTED_MEMORY_PRE);
    371375}
     
    373377LAST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY)
    374378{
    375   assert(_Dual_ported_memory_Information.maximum != 0);
     379  assert(_Objects_Get_maximum_index(&_Dual_ported_memory_Information) != 0);
    376380  next_step(CLASSIC_DUAL_PORTED_MEMORY_POST);
    377381}
     
    379383FIRST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC)
    380384{
    381   assert(_Rate_monotonic_Information.maximum == 0);
     385  assert(_Objects_Get_maximum_index(&_Rate_monotonic_Information) == 0);
    382386  next_step(CLASSIC_RATE_MONOTONIC_PRE);
    383387}
     
    385389LAST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC)
    386390{
    387   assert(_Rate_monotonic_Information.maximum != 0);
     391  assert(_Objects_Get_maximum_index(&_Rate_monotonic_Information) != 0);
    388392  next_step(CLASSIC_RATE_MONOTONIC_POST);
    389393}
     
    391395FIRST(RTEMS_SYSINIT_CLASSIC_BARRIER)
    392396{
    393   assert(_Barrier_Information.maximum == 0);
     397  assert(_Objects_Get_maximum_index(&_Barrier_Information) == 0);
    394398  next_step(CLASSIC_BARRIER_PRE);
    395399}
     
    397401LAST(RTEMS_SYSINIT_CLASSIC_BARRIER)
    398402{
    399   assert(_Barrier_Information.maximum != 0);
     403  assert(_Objects_Get_maximum_index(&_Barrier_Information) != 0);
    400404  next_step(CLASSIC_BARRIER_POST);
    401405}
     
    429433FIRST(RTEMS_SYSINIT_POSIX_THREADS)
    430434{
    431   assert(_POSIX_Threads_Information.Objects.maximum == 0);
     435  assert(_Objects_Get_maximum_index(&_POSIX_Threads_Information.Objects) == 0);
    432436  next_step(POSIX_THREADS_PRE);
    433437}
     
    435439LAST(RTEMS_SYSINIT_POSIX_THREADS)
    436440{
    437   assert(_POSIX_Threads_Information.Objects.maximum != 0);
     441  assert(_Objects_Get_maximum_index(&_POSIX_Threads_Information.Objects) != 0);
    438442  next_step(POSIX_THREADS_POST);
    439443}
     
    441445FIRST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE)
    442446{
    443   assert(_POSIX_Message_queue_Information.maximum == 0);
     447  assert(_Objects_Get_maximum_index(&_POSIX_Message_queue_Information) == 0);
    444448  next_step(POSIX_MESSAGE_QUEUE_PRE);
    445449}
     
    447451LAST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE)
    448452{
    449   assert(_POSIX_Message_queue_Information.maximum != 0);
     453  assert(_Objects_Get_maximum_index(&_POSIX_Message_queue_Information) != 0);
    450454  next_step(POSIX_MESSAGE_QUEUE_POST);
    451455}
     
    453457FIRST(RTEMS_SYSINIT_POSIX_SEMAPHORE)
    454458{
    455   assert(_POSIX_Semaphore_Information.maximum == 0);
     459  assert(_Objects_Get_maximum_index(&_POSIX_Semaphore_Information) == 0);
    456460  next_step(POSIX_SEMAPHORE_PRE);
    457461}
     
    459463LAST(RTEMS_SYSINIT_POSIX_SEMAPHORE)
    460464{
    461   assert(_POSIX_Semaphore_Information.maximum != 0);
     465  assert(_Objects_Get_maximum_index(&_POSIX_Semaphore_Information) != 0);
    462466  next_step(POSIX_SEMAPHORE_POST);
    463467}
     
    466470FIRST(RTEMS_SYSINIT_POSIX_TIMER)
    467471{
    468   assert(_POSIX_Timer_Information.maximum == 0);
     472  assert(_Objects_Get_maximum_index(&_POSIX_Timer_Information) == 0);
    469473  next_step(POSIX_TIMER_PRE);
    470474}
     
    472476LAST(RTEMS_SYSINIT_POSIX_TIMER)
    473477{
    474   assert(_POSIX_Timer_Information.maximum != 0);
     478  assert(_Objects_Get_maximum_index(&_POSIX_Timer_Information) != 0);
    475479  next_step(POSIX_TIMER_POST);
    476480}
     
    479483FIRST(RTEMS_SYSINIT_POSIX_SHM)
    480484{
    481   assert(_POSIX_Shm_Information.maximum == 0);
     485  assert(_Objects_Get_maximum_index(&_POSIX_Shm_Information) == 0);
    482486  next_step(POSIX_SHM_PRE);
    483487}
     
    485489LAST(RTEMS_SYSINIT_POSIX_SHM)
    486490{
    487   assert(_POSIX_Shm_Information.maximum != 0);
     491  assert(_Objects_Get_maximum_index(&_POSIX_Shm_Information) != 0);
    488492  next_step(POSIX_SHM_POST);
    489493}
     
    509513FIRST(RTEMS_SYSINIT_POSIX_KEYS)
    510514{
    511   assert(_POSIX_Keys_Information.maximum == 0);
     515  assert(_Objects_Get_maximum_index(&_POSIX_Keys_Information) == 0);
    512516  next_step(POSIX_KEYS_PRE);
    513517}
     
    515519LAST(RTEMS_SYSINIT_POSIX_KEYS)
    516520{
    517   assert(_POSIX_Keys_Information.maximum != 0);
     521  assert(_Objects_Get_maximum_index(&_POSIX_Keys_Information) != 0);
    518522  next_step(POSIX_KEYS_POST);
    519523}
Note: See TracChangeset for help on using the changeset viewer.