[COMPLIB] Semantic change: inserting object relationships returns status.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 11 Jul 2006 21:14:20 +0000 (21:14 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 11 Jul 2006 21:14:20 +0000 (21:14 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@420 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/complib/cl_obj.c
inc/complib/cl_obj.h

index c84f61b..259a5f5 100644 (file)
@@ -351,17 +351,19 @@ __obj_set_state(
 /*\r
  * Add a dependent relationship between two objects.\r
  */\r
-void\r
+cl_status_t\r
 cl_obj_insert_rel(\r
        IN                              cl_obj_rel_t * const            p_rel,\r
        IN                              cl_obj_t * const                        p_parent_obj,\r
        IN                              cl_obj_t * const                        p_child_obj )\r
 {\r
+       cl_status_t     status;\r
        CL_ASSERT( p_rel && p_parent_obj && p_child_obj );\r
 \r
        cl_spinlock_acquire( &p_parent_obj->lock );\r
-       cl_obj_insert_rel_parent_locked( p_rel, p_parent_obj, p_child_obj );\r
+       status = cl_obj_insert_rel_parent_locked( p_rel, p_parent_obj, p_child_obj );\r
        cl_spinlock_release( &p_parent_obj->lock );\r
+       return status;\r
 }\r
 \r
 \r
@@ -369,7 +371,7 @@ cl_obj_insert_rel(
 /*\r
  * Add a dependent relationship between two objects.\r
  */\r
-void\r
+cl_status_t\r
 cl_obj_insert_rel_parent_locked(\r
        IN                              cl_obj_rel_t * const            p_rel,\r
        IN                              cl_obj_t * const                        p_parent_obj,\r
@@ -377,6 +379,8 @@ cl_obj_insert_rel_parent_locked(
 {\r
        CL_ASSERT( p_rel && p_parent_obj && p_child_obj );\r
 \r
+       if(p_parent_obj->state != CL_INITIALIZED)\r
+               return CL_INVALID_STATE;\r
        /* The child object needs to maintain a reference on the parent. */\r
        cl_obj_ref( p_parent_obj );\r
        cl_obj_ref( p_child_obj );\r
@@ -396,6 +400,7 @@ cl_obj_insert_rel_parent_locked(
                (cl_list_item_t*)&p_rel->pool_item );\r
 \r
        cl_spinlock_release( &p_child_obj->lock );\r
+       return CL_SUCCESS;\r
 }\r
 \r
 \r
index 34ba3dd..e691d10 100644 (file)
@@ -877,7 +877,7 @@ cl_rel_free(
 *\r
 * SYNOPSIS\r
 */\r
-CL_EXPORT void CL_API\r
+CL_EXPORT cl_status_t CL_API\r
 cl_obj_insert_rel(\r
        IN                              cl_obj_rel_t * const            p_rel,\r
        IN                              cl_obj_t * const                        p_parent_obj,\r
@@ -922,7 +922,7 @@ cl_obj_insert_rel(
 *\r
 * SYNOPSIS\r
 */\r
-CL_EXPORT void CL_API\r
+CL_EXPORT cl_status_t CL_API\r
 cl_obj_insert_rel_parent_locked(\r
        IN                              cl_obj_rel_t * const            p_rel,\r
        IN                              cl_obj_t * const                        p_parent_obj,\r