summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/src')
-rw-r--r--cpukit/score/src/objectactivecount.c11
-rw-r--r--cpukit/score/src/objectextendinformation.c20
-rw-r--r--cpukit/score/src/objectgetinfo.c2
-rw-r--r--cpukit/score/src/objectgetnext.c22
-rw-r--r--cpukit/score/src/objectinitializeinformation.c17
-rw-r--r--cpukit/score/src/objectnametoid.c6
-rw-r--r--cpukit/score/src/objectnametoidstring.c11
-rw-r--r--cpukit/score/src/objectshrinkinformation.c2
-rw-r--r--cpukit/score/src/threaditerate.c9
9 files changed, 50 insertions, 50 deletions
diff --git a/cpukit/score/src/objectactivecount.c b/cpukit/score/src/objectactivecount.c
index 376820158a..d29ce0736d 100644
--- a/cpukit/score/src/objectactivecount.c
+++ b/cpukit/score/src/objectactivecount.c
@@ -24,13 +24,14 @@ Objects_Maximum _Objects_Active_count(
const Objects_Information *information
)
{
- size_t inactive;
- size_t maximum;
+ Objects_Maximum inactive;
+ Objects_Maximum maximum;
_Assert( _Objects_Allocator_is_owner() );
- inactive = _Chain_Node_count_unprotected( &information->Inactive );
- maximum = information->maximum;
+ inactive = (Objects_Maximum)
+ _Chain_Node_count_unprotected( &information->Inactive );
+ maximum = _Objects_Get_maximum_index( information );
- return (Objects_Maximum) ( maximum - inactive );
+ return maximum - inactive;
}
diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c
index a8346ce937..57ce6737ec 100644
--- a/cpukit/score/src/objectextendinformation.c
+++ b/cpukit/score/src/objectextendinformation.c
@@ -49,7 +49,8 @@ void _Objects_Extend_information(
uint32_t index_base;
uint32_t index_end;
uint32_t index;
- uint32_t maximum;
+ Objects_Maximum old_maximum;
+ uint32_t new_maximum;
size_t object_block_size;
Objects_Control *new_object_block;
bool do_extend;
@@ -59,6 +60,8 @@ void _Objects_Extend_information(
|| !_System_state_Is_up( _System_state_Get() )
);
+ old_maximum = _Objects_Get_maximum_index( information );
+
/*
* Search for a free block of indexes. If we do NOT need to allocate or
* extend the block table, then we will change do_extend.
@@ -70,7 +73,7 @@ void _Objects_Extend_information(
if ( information->object_blocks == NULL )
block_count = 0;
else {
- block_count = information->maximum / information->objects_per_block;
+ block_count = old_maximum / information->objects_per_block;
for ( ; block < block_count; block++ ) {
if ( information->object_blocks[ block ] == NULL ) {
@@ -82,14 +85,14 @@ void _Objects_Extend_information(
}
index_end = index_base + information->objects_per_block;
- maximum = (uint32_t) information->maximum + information->objects_per_block;
+ new_maximum = (uint32_t) old_maximum + information->objects_per_block;
/*
* We need to limit the number of objects to the maximum number
* representable in the index portion of the object Id. In the
* case of 16-bit Ids, this is only 256 object instances.
*/
- if ( maximum > OBJECTS_ID_FINAL_INDEX ) {
+ if ( new_maximum > OBJECTS_ID_FINAL_INDEX ) {
return;
}
@@ -146,7 +149,7 @@ void _Objects_Extend_information(
* Allocate the tables and break it up.
*/
object_blocks_size = block_count * sizeof( *object_blocks );
- local_table_size = maximum * sizeof( *local_table );
+ local_table_size = new_maximum * sizeof( *local_table );
table_size = object_blocks_size
+ local_table_size
+ block_count * sizeof( *inactive_per_block );
@@ -178,7 +181,7 @@ void _Objects_Extend_information(
*/
block_count--;
- if ( information->maximum > 0 ) {
+ if ( old_maximum > 0 ) {
/*
* Copy each section of the table over. This has to be performed as
* separate parts as size of each block has changed.
@@ -196,7 +199,7 @@ void _Objects_Extend_information(
memcpy(
local_table,
information->local_table,
- information->maximum * sizeof( *local_table )
+ old_maximum * sizeof( *local_table )
);
}
@@ -215,12 +218,11 @@ void _Objects_Extend_information(
information->object_blocks = object_blocks;
information->inactive_per_block = inactive_per_block;
information->local_table = local_table;
- information->maximum = (Objects_Maximum) maximum;
information->maximum_id = _Objects_Build_id(
information->the_api,
information->the_class,
_Objects_Local_node,
- information->maximum
+ new_maximum
);
_ISR_lock_ISR_enable( &lock_context );
diff --git a/cpukit/score/src/objectgetinfo.c b/cpukit/score/src/objectgetinfo.c
index 6ba561d368..c927d1c944 100644
--- a/cpukit/score/src/objectgetinfo.c
+++ b/cpukit/score/src/objectgetinfo.c
@@ -55,7 +55,7 @@ Objects_Information *_Objects_Get_information(
* pointer.
*/
#if !defined(RTEMS_MULTIPROCESSING)
- if ( info->maximum == 0 )
+ if ( _Objects_Get_maximum_index( info ) == 0 )
return NULL;
#endif
diff --git a/cpukit/score/src/objectgetnext.c b/cpukit/score/src/objectgetnext.c
index 054ed22fc1..156bee72a4 100644
--- a/cpukit/score/src/objectgetnext.c
+++ b/cpukit/score/src/objectgetnext.c
@@ -28,6 +28,7 @@ Objects_Control *_Objects_Get_next(
{
Objects_Control *the_object;
Objects_Id next_id;
+ Objects_Maximum maximum;
if ( !information )
return NULL;
@@ -41,21 +42,20 @@ Objects_Control *_Objects_Get_next(
next_id = id;
_Objects_Allocator_lock();
+ maximum = _Objects_Get_maximum_index( information );
do {
- /* walked off end of list? */
- if (_Objects_Get_index(next_id) > information->maximum)
- {
- _Objects_Allocator_unlock();
- *next_id_p = OBJECTS_ID_FINAL;
- return NULL;
- }
+ /* walked off end of list? */
+ if (_Objects_Get_index( next_id ) > maximum) {
+ _Objects_Allocator_unlock();
+ *next_id_p = OBJECTS_ID_FINAL;
+ return NULL;
+ }
- /* try to grab one */
- the_object = _Objects_Get_no_protection( next_id, information );
-
- next_id++;
+ /* try to grab one */
+ the_object = _Objects_Get_no_protection( next_id, information );
+ next_id++;
} while ( the_object == NULL );
*next_id_p = next_id;
diff --git a/cpukit/score/src/objectinitializeinformation.c b/cpukit/score/src/objectinitializeinformation.c
index 530e4e10ba..c1327aece8 100644
--- a/cpukit/score/src/objectinitializeinformation.c
+++ b/cpukit/score/src/objectinitializeinformation.c
@@ -39,20 +39,9 @@ void _Objects_Do_initialize_information(
{
Objects_Maximum maximum_per_allocation;
- information->the_api = the_api;
- information->the_class = the_class;
- information->object_size = object_size;
- information->local_table = 0;
- information->inactive_per_block = 0;
- information->object_blocks = 0;
- information->inactive = 0;
- information->local_table = NULL;
-
- /*
- * Set the maximum value to 0. It will be updated when objects are
- * added to the inactive set from _Objects_Extend_information()
- */
- information->maximum = 0;
+ information->the_api = the_api;
+ information->the_class = the_class;
+ information->object_size = object_size;
/*
* Register this Object Class in the Object Information Table.
diff --git a/cpukit/score/src/objectnametoid.c b/cpukit/score/src/objectnametoid.c
index c3b014e3e1..6a89b874e7 100644
--- a/cpukit/score/src/objectnametoid.c
+++ b/cpukit/score/src/objectnametoid.c
@@ -29,6 +29,7 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
{
bool search_local_node;
Objects_Control *the_object;
+ Objects_Maximum maximum;
Objects_Maximum index;
#if defined(RTEMS_MULTIPROCESSING)
Objects_Name name_for_mp;
@@ -42,9 +43,10 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
if ( name == 0 )
return OBJECTS_INVALID_NAME;
+ maximum = _Objects_Get_maximum_index( information );
search_local_node = false;
- if ( information->maximum != 0 &&
+ if ( maximum > 0 &&
(node == OBJECTS_SEARCH_ALL_NODES ||
node == OBJECTS_SEARCH_LOCAL_NODE ||
_Objects_Is_local_node( node )
@@ -52,7 +54,7 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
search_local_node = true;
if ( search_local_node ) {
- for ( index = 0; index < information->maximum; ++index ) {
+ for ( index = 0; index < maximum; ++index ) {
the_object = information->local_table[ index ];
if ( !the_object )
continue;
diff --git a/cpukit/score/src/objectnametoidstring.c b/cpukit/score/src/objectnametoidstring.c
index a015d5fc25..d357339ea7 100644
--- a/cpukit/score/src/objectnametoidstring.c
+++ b/cpukit/score/src/objectnametoidstring.c
@@ -29,9 +29,10 @@ Objects_Control *_Objects_Get_by_name(
Objects_Get_by_name_error *error
)
{
- size_t name_length;
- size_t max_name_length;
- uint32_t index;
+ size_t name_length;
+ size_t max_name_length;
+ Objects_Maximum maximum;
+ Objects_Maximum index;
_Assert( _Objects_Has_string_name( information ) );
_Assert( _Objects_Allocator_is_owner() );
@@ -52,7 +53,9 @@ Objects_Control *_Objects_Get_by_name(
*name_length_p = name_length;
}
- for ( index = 0; index < information->maximum; ++index ) {
+ maximum = _Objects_Get_maximum_index( information );
+
+ for ( index = 0; index < maximum; ++index ) {
Objects_Control *the_object;
the_object = information->local_table[ index ];
diff --git a/cpukit/score/src/objectshrinkinformation.c b/cpukit/score/src/objectshrinkinformation.c
index 3b1841a16b..5a53be9979 100644
--- a/cpukit/score/src/objectshrinkinformation.c
+++ b/cpukit/score/src/objectshrinkinformation.c
@@ -39,7 +39,7 @@ void _Objects_Shrink_information(
*/
objects_per_block = information->objects_per_block;
- block_count = information->maximum / objects_per_block;
+ block_count = _Objects_Get_maximum_index( information ) / objects_per_block;
index_base = 0;
for ( block = 0; block < block_count; block++ ) {
diff --git a/cpukit/score/src/threaditerate.c b/cpukit/score/src/threaditerate.c
index 9fa9b89166..8d1614ab9b 100644
--- a/cpukit/score/src/threaditerate.c
+++ b/cpukit/score/src/threaditerate.c
@@ -27,7 +27,8 @@ void _Thread_Iterate(
for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; ++api_index ) {
const Objects_Information *information;
- Objects_Maximum i;
+ Objects_Maximum maximum;
+ Objects_Maximum index;
if ( _Objects_Information_table[ api_index ] == NULL ) {
continue;
@@ -39,10 +40,12 @@ void _Thread_Iterate(
continue;
}
- for ( i = 0 ; i < information->maximum ; ++i ) {
+ maximum = _Objects_Get_maximum_index( information );
+
+ for ( index = 0 ; index < maximum ; ++index ) {
Thread_Control *the_thread;
- the_thread = (Thread_Control *) information->local_table[ i ];
+ the_thread = (Thread_Control *) information->local_table[ index ];
if ( the_thread != NULL ) {
bool done;