rtems: Delete Region_Control::number_of_used_blocks

Use Heap_Statistics::used_blocks instead.
This commit is contained in:
Sebastian Huber
2016-04-12 07:36:19 +02:00
parent 1142f5593a
commit b4b062f4df
7 changed files with 9 additions and 12 deletions
+2 -1
View File
@@ -19,13 +19,14 @@ rtems_monitor_region_canonical(
)
{
const Region_Control *rtems_region = (const Region_Control *) region_void;
const Heap_Control *heap = &rtems_region->Memory;
canonical_region->attribute = rtems_region->attribute_set;
canonical_region->start_addr = rtems_region->starting_address;
canonical_region->length = rtems_region->length;
canonical_region->page_size = rtems_region->page_size;
canonical_region->max_seg_size = rtems_region->maximum_segment_size;
canonical_region->used_blocks = rtems_region->number_of_used_blocks;
canonical_region->used_blocks = heap->stats.used_blocks;
}
@@ -65,7 +65,6 @@ typedef struct {
uintptr_t page_size; /* in bytes */
uintptr_t maximum_segment_size; /* in bytes */
rtems_attribute attribute_set;
uint32_t number_of_used_blocks; /* blocks allocated */
Heap_Control Memory;
} Region_Control;
+4 -5
View File
@@ -87,11 +87,10 @@ rtems_status_code rtems_region_create(
_Region_Free( the_region );
return_status = RTEMS_INVALID_SIZE;
} else {
the_region->starting_address = starting_address;
the_region->length = length;
the_region->page_size = page_size;
the_region->attribute_set = attribute_set;
the_region->number_of_used_blocks = 0;
the_region->starting_address = starting_address;
the_region->length = length;
the_region->page_size = page_size;
the_region->attribute_set = attribute_set;
_Objects_Open(
&_Region_Information,
+3 -1
View File
@@ -36,7 +36,9 @@ rtems_status_code rtems_region_delete(
return RTEMS_INVALID_ID;
}
if ( the_region->number_of_used_blocks != 0 ) {
_Heap_Protection_free_all_delayed_blocks( &the_region->Memory );
if ( the_region->Memory.stats.used_blocks != 0 ) {
status = RTEMS_RESOURCE_IN_USE;
} else {
_Objects_Close( &_Region_Information, &the_region->Object );
-1
View File
@@ -58,7 +58,6 @@ rtems_status_code rtems_region_get_segment(
the_segment = _Region_Allocate_segment( the_region, size );
if ( the_segment != NULL ) {
the_region->number_of_used_blocks += 1;
*segment = the_segment;
status = RTEMS_SUCCESSFUL;
} else if ( _Options_Is_no_wait( option_set ) ) {
-1
View File
@@ -64,7 +64,6 @@ void _Region_Process_queue(
break;
*(void **)the_thread->Wait.return_argument = the_segment;
the_region->number_of_used_blocks += 1;
_Thread_queue_Extract( the_thread );
the_thread->Wait.return_code = RTEMS_SUCCESSFUL;
}
-2
View File
@@ -34,8 +34,6 @@ rtems_status_code rtems_region_return_segment(
}
if ( _Region_Free_segment( the_region, segment ) ) {
the_region->number_of_used_blocks -= 1;
/* Unlocks allocator */
_Region_Process_queue( the_region );
return RTEMS_SUCCESSFUL;