Ack, code review only/Thanks HansN

-----Original Message-----
From: [email protected] [mailto:[email protected]] 
Sent: den 15 januari 2015 10:24
To: Hans Nordebäck; [email protected]
Cc: [email protected]
Subject: [PATCH 1 of 1] amfd: adjust rank of all csis in SI if csidep is 
deleted [#1240]

 osaf/services/saf/amf/amfd/csi.cc |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)


Before unlock and unlock-in operation, user deletes CSI dependency via CCB 
modification. After this when unlock-in and unlock operations are performed, 
AMF did not give callback to components for some CSIs.

While deleting CSI dependency, AMF assigns rank 1 to the deleted CSI in SI if 
this CSI has no further sponsor. But AMF is not cheking if this CSI is sponsor 
to some other CSI recursively. Due to this there was no CSI with rank 2 in this 
SI when this CSI of rank 2 was deleted. Now AMFND assigns CSI of rank r+1 when 
csi of rank r is assigned. Since there was no CSI with rank 2, AMFND skipped 
assignments when CSI of rank 1 was assigned assuming there are no further CSIs 
to be assigned. Thus CSI of rank 3 remained unassigned. So deletion of CSI 
dependency requires recalculation of ranks of all the CSIs in SI.

Patch fixed the problem by performing recalculation of ranks of all CSIs in a 
SI when CSI dependency is deleted through CCB modification.

diff --git a/osaf/services/saf/amf/amfd/csi.cc 
b/osaf/services/saf/amf/amfd/csi.cc
--- a/osaf/services/saf/amf/amfd/csi.cc
+++ b/osaf/services/saf/amf/amfd/csi.cc
@@ -882,12 +882,17 @@ static void csi_ccb_apply_modify_hdlr(st
                                assert(attr_mod->modAttr.attrValuesNumber == 1);
                                const SaNameT *required_dn = (SaNameT*) 
attr_mod->modAttr.attrValues[0];
                                csi_remove_csidep(csi, required_dn);
-                               si->remove_csi(csi);
-                               if (csi->saAmfCSIDependencies == NULL)
-                                       csi->rank = 1; // indicate that there 
is no dep to another CSI
-                               else
-                                       csi->rank = 0; // indicate that add_csi 
should recalculate rank
-                               si->add_csi(csi);
+                               
+                               //Mark rank of all the CSIs to 0.
+                                for (AVD_CSI *tmp_csi = csi->si->list_of_csi; 
tmp_csi;
+                                                tmp_csi = 
tmp_csi->si_list_of_csi_next) {
+                                       tmp_csi->rank = 0;// indicate that 
there is a dep to another CSI
+                               }
+                               //Rearrange Rank of all the CSIs now.
+                                for (AVD_CSI *tmp_csi = csi->si->list_of_csi; 
tmp_csi;
+                                                tmp_csi = 
tmp_csi->si_list_of_csi_next) {
+                                       tmp_csi->si->arrange_dep_csi(tmp_csi);
+                               }
                        } else
                                assert(0);
                } else {

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to