[PATCH 16/21] score: _Objects_Extend_information()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Dec 16 14:28:21 UTC 2019


Return block index in _Objects_Extend_information().  This allows to
customize the objects information extend.

Update #3835.
---
 cpukit/include/rtems/score/objectimpl.h    |  5 ++++-
 cpukit/score/src/objectextendinformation.c | 21 ++++++---------------
 2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h
index eb63101b76..e5d5347895 100644
--- a/cpukit/include/rtems/score/objectimpl.h
+++ b/cpukit/include/rtems/score/objectimpl.h
@@ -91,8 +91,11 @@ _Objects_Information_table[ OBJECTS_APIS_LAST + 1 ];
  * @brief Extends an object class information record.
  *
  * @param information Points to an object class information block.
+ *
+ * @retval 0 The extend operation failed.
+ * @retval block The block index of the new objects block.
  */
-void _Objects_Extend_information(
+Objects_Maximum _Objects_Extend_information(
   Objects_Information *information
 );
 
diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c
index 688d0f90bb..65fef94e44 100644
--- a/cpukit/score/src/objectextendinformation.c
+++ b/cpukit/score/src/objectextendinformation.c
@@ -28,18 +28,7 @@
 
 #include <string.h>  /* for memcpy() */
 
-/*
- *  _Objects_Extend_information
- *
- *  This routine extends all object information related data structures.
- *
- *  Input parameters:
- *    information     - object information table
- *
- *  Output parameters:  NONE
- */
-
-void _Objects_Extend_information(
+Objects_Maximum _Objects_Extend_information(
   Objects_Information *information
 )
 {
@@ -98,7 +87,7 @@ void _Objects_Extend_information(
    *  case of 16-bit Ids, this is only 256 object instances.
    */
   if ( new_maximum > OBJECTS_ID_FINAL_INDEX ) {
-    return;
+    return 0;
   }
 
   /*
@@ -108,7 +97,7 @@ void _Objects_Extend_information(
   object_block_size = extend_count * information->object_size;
   new_object_block = _Workspace_Allocate( object_block_size );
   if ( new_object_block == NULL ) {
-    return;
+    return 0;
   }
 
   /*
@@ -157,7 +146,7 @@ void _Objects_Extend_information(
     object_blocks = _Workspace_Allocate( table_size );
     if ( object_blocks == NULL ) {
       _Workspace_Free( new_object_block );
-      return;
+      return 0;
     }
 
     /*
@@ -249,4 +238,6 @@ void _Objects_Extend_information(
 
     the_object = _Addresses_Add_offset( the_object, information->object_size );
   }
+
+  return block;
 }
-- 
2.16.4



More information about the devel mailing list