[rtems commit] score: _Objects_Extend_information()

Sebastian Huber sebh at rtems.org
Wed Feb 12 15:11:59 UTC 2020


Module:    rtems
Branch:    master
Commit:    36e59b2bbc8737c4ba1b93ac0f695528a36844c9
Changeset: http://git.rtems.org/rtems/commit/?id=36e59b2bbc8737c4ba1b93ac0f695528a36844c9

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Dec 10 10:46:52 2019 +0100

score: _Objects_Extend_information()

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 87d29cb..d4d6347 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 688d0f9..65fef94 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;
 }



More information about the vc mailing list