osaf/services/saf/amf/amfd/include/comp.h | 8 +++++--- osaf/services/saf/amf/amfd/include/node.h | 9 +++++---- osaf/services/saf/amf/amfd/include/sg.h | 28 +++++++++++++++------------- osaf/services/saf/amf/amfd/include/si_dep.h | 12 ++++++------ osaf/services/saf/amf/amfd/include/su.h | 12 ++++++------ osaf/services/saf/amf/amfd/include/sutype.h | 6 +++--- osaf/services/saf/amf/amfd/include/util.h | 8 +++++--- 7 files changed, 45 insertions(+), 38 deletions(-)
First change in series to convert all functions operating on SU data into methods. No functional impact. diff --git a/osaf/services/saf/amf/amfd/include/comp.h b/osaf/services/saf/amf/amfd/include/comp.h --- a/osaf/services/saf/amf/amfd/include/comp.h +++ b/osaf/services/saf/amf/amfd/include/comp.h @@ -38,7 +38,9 @@ #include <saImm.h> #include <ncspatricia.h> #include <amf_d2nmsg.h> -#include <su.h> +#include <cb.h> + +class AVD_SU; /* AMF Class SaAmfCompGlobalAttributes */ typedef struct { @@ -113,7 +115,7 @@ typedef struct avd_comp_tag { */ struct avd_amf_comp_type_tag *comp_type; struct avd_comp_tag *comp_type_list_comp_next; - struct avd_su_tag *su; /* SU to which this component belongs */ + AVD_SU *su; /* SU to which this component belongs */ struct avd_comp_tag *su_comp_next; /* the next component in list of components * in this SU */ AVD_ADMIN_OPER_CBK admin_pend_cbk; /* holds callback invocation for admin operation */ @@ -209,7 +211,7 @@ extern void avd_comp_delete(AVD_COMP *co extern AVD_COMP *avd_comp_get(const SaNameT *comp_name); extern AVD_COMP *avd_comp_getnext(const SaNameT *comp_name); extern void avd_su_remove_comp(AVD_COMP* comp); -extern SaAisErrorT avd_comp_config_get(const SaNameT* su_name, struct avd_su_tag* su); +extern SaAisErrorT avd_comp_config_get(const SaNameT* su_name, AVD_SU *su); extern void avd_comp_constructor(void); extern SaAisErrorT avd_comptype_config_get(void); diff --git a/osaf/services/saf/amf/amfd/include/node.h b/osaf/services/saf/amf/amfd/include/node.h --- a/osaf/services/saf/amf/amfd/include/node.h +++ b/osaf/services/saf/amf/amfd/include/node.h @@ -43,6 +43,7 @@ #include <amf_d2nmsg.h> #include <timer.h> +class AVD_SU; struct avd_cluster_tag; struct avd_node_sw_bundle_tag; struct CcbUtilOperationData; @@ -114,10 +115,10 @@ typedef struct avd_avnd_tag { * Checkpointing - Sent independent update */ - struct avd_su_tag *list_of_ncs_su; /* the list of NCS service units on + AVD_SU *list_of_ncs_su; /* the list of NCS service units on * this node. */ - struct avd_su_tag *list_of_su; /* the list of service units on this + AVD_SU *list_of_su; /* the list of service units on this * node that are application specific. */ NCS_DB_LINK_LIST pg_csi_list; /* list of csis for which pg is tracked @@ -197,8 +198,8 @@ extern void avd_node_state_set(AVD_AVND extern void avd_node_oper_state_set(AVD_AVND *node, SaAmfOperationalStateT oper_state); extern void node_admin_state_set(AVD_AVND *node, SaAmfAdminStateT admin_state); extern void avd_node_constructor(void); -extern void avd_node_add_su(struct avd_su_tag *su); -extern void avd_node_remove_su(struct avd_su_tag *su); +extern void avd_node_add_su(AVD_SU *su); +extern void avd_node_remove_su(AVD_SU *su); extern uint32_t avd_node_admin_lock_instantiation(AVD_AVND *node); extern uint32_t node_admin_unlock_instantiation(AVD_AVND *node); extern void avd_node_admin_lock_unlock_shutdown(AVD_AVND *node, diff --git a/osaf/services/saf/amf/amfd/include/sg.h b/osaf/services/saf/amf/amfd/include/sg.h --- a/osaf/services/saf/amf/amfd/include/sg.h +++ b/osaf/services/saf/amf/amfd/include/sg.h @@ -41,6 +41,8 @@ #include <amf_defs.h> #include <amf_d2nmsg.h> +class AVD_SU; + /* The valid SG FSM states. */ typedef enum { AVD_SG_FSM_STABLE = 0, @@ -54,7 +56,7 @@ typedef enum { * undergoing operations on them. */ typedef struct avd_sg_oper_tag { - struct avd_su_tag *su; /* SU undergoing operation */ + AVD_SU *su; /* SU undergoing operation */ struct avd_sg_oper_tag *next; /* The next SU undergoing operation. */ } AVD_SG_OPER; @@ -174,7 +176,7 @@ typedef struct avd_sg_tag { * Checkpointing - Sent as a one time update. */ - struct avd_su_tag *list_of_su; /* the list of service units in this + AVD_SU *list_of_su; /* the list of service units in this * group in the descending order of * the rank. */ @@ -190,8 +192,8 @@ typedef struct avd_sg_tag { bool equal_ranked_su; /* This flag is set when ranks of all SU is the same. It is used in equal distribution of SIs on SU in Nway, N+M and Nway-Act Red models.*/ - struct avd_su_tag *max_assigned_su; - struct avd_su_tag *min_assigned_su; + AVD_SU *max_assigned_su; + AVD_SU *min_assigned_su; struct avd_si_tag *si_tobe_redistributed; uint32_t try_inst_counter; /* It should be used when amfd try to send instantiate command to amfnd in a loop @@ -203,7 +205,7 @@ typedef struct avd_sg_tag { // Function pointers to redundancy model specific handlers // Handle node failure and fail over assignments - void (*node_fail)(AVD_CL_CB *cb, struct avd_su_tag *su); + void (*node_fail)(AVD_CL_CB *cb, AVD_SU *su); // Handle SG realign uint32_t (*realign)(AVD_CL_CB *cb, struct avd_sg_tag *sg); @@ -221,21 +223,21 @@ typedef struct avd_sg_tag { uint32_t (*sg_admin_down)(AVD_CL_CB *cb, struct avd_sg_tag *sg); // Handle SU inservice event, possibly assign the SU - uint32_t (*su_insvc)(AVD_CL_CB *cb, struct avd_su_tag *su); + uint32_t (*su_insvc)(AVD_CL_CB *cb, AVD_SU *su); // Handle SU failure and switch over assignments - uint32_t (*su_fault)(AVD_CL_CB *cb, struct avd_su_tag *su); + uint32_t (*su_fault)(AVD_CL_CB *cb, AVD_SU *su); // Handle SU admin op LOCK/SHUTDOWN - uint32_t (*su_admin_down)(AVD_CL_CB *cb, struct avd_su_tag *su, + uint32_t (*su_admin_down)(AVD_CL_CB *cb, AVD_SU *su, struct avd_avnd_tag *avnd); // Handle successful SUSI assignment - uint32_t (*susi_success)(AVD_CL_CB *cb, struct avd_su_tag *su, + uint32_t (*susi_success)(AVD_CL_CB *cb, AVD_SU *su, struct avd_su_si_rel_tag *susi, AVSV_SUSI_ACT act, SaAmfHAStateT state); // Handle failed SUSI assignment - uint32_t (*susi_failed)(AVD_CL_CB *cb, struct avd_su_tag *su, + uint32_t (*susi_failed)(AVD_CL_CB *cb, AVD_SU *su, struct avd_su_si_rel_tag *susi, AVSV_SUSI_ACT act, SaAmfHAStateT state); } AVD_SG; @@ -340,8 +342,8 @@ extern AVD_SG *avd_sg_getnext(const SaNa extern void avd_sg_add_si(AVD_SG *sg, struct avd_si_tag *si); extern void avd_sg_remove_si(AVD_SG *sg, struct avd_si_tag *si); extern SaAisErrorT avd_sg_config_get(const SaNameT *app_dn, struct avd_app_tag *app); -extern void avd_sg_add_su(struct avd_su_tag* su); -extern void avd_sg_remove_su(struct avd_su_tag *su); +extern void avd_sg_add_su(AVD_SU *su); +extern void avd_sg_remove_su(AVD_SU *su); extern void avd_sg_constructor(void); extern SaAisErrorT avd_sgtype_config_get(void); @@ -352,7 +354,7 @@ extern void avd_sgtype_constructor(void) extern void avd_sg_admin_state_set(AVD_SG* sg, SaAmfAdminStateT state); extern void avd_sg_nwayact_screening_for_si_distr(AVD_SG *avd_sg); extern void avd_sg_nway_screen_si_distr_equal(AVD_SG *sg); -extern void avd_su_role_failover(struct avd_su_tag *su, struct avd_su_tag *stdby_su); +extern void avd_su_role_failover(AVD_SU *su, AVD_SU *stdby_su); extern bool sg_is_tolerance_timer_running_for_any_si(AVD_SG *sg); extern void avd_sg_adjust_config(AVD_SG *sg); extern uint32_t sg_instantiated_su_count(const AVD_SG *sg); diff --git a/osaf/services/saf/amf/amfd/include/si_dep.h b/osaf/services/saf/amf/amfd/include/si_dep.h --- a/osaf/services/saf/amf/amfd/include/si_dep.h +++ b/osaf/services/saf/amf/amfd/include/si_dep.h @@ -101,13 +101,13 @@ extern SaAisErrorT avd_sidep_config_get( extern void avd_sidep_constructor(void); extern void avd_sidep_reset_dependents_depstate_in_sufault(struct avd_si_tag *si); extern void avd_sidep_si_dep_state_set(struct avd_si_tag *si, AVD_SI_DEP_STATE state); -extern bool avd_sidep_is_su_failover_possible(struct avd_su_tag *su); -extern bool avd_sidep_is_si_failover_possible(struct avd_si_tag *si, struct avd_su_tag *su); -extern void avd_sidep_update_depstate_su_rolefailover(struct avd_su_tag *su); -extern void avd_sidep_update_depstate_si_failover(struct avd_si_tag *si, struct avd_su_tag *su); -extern bool avd_sidep_si_dependency_exists_within_su(const struct avd_su_tag *su); +extern bool avd_sidep_is_su_failover_possible(AVD_SU *su); +extern bool avd_sidep_is_si_failover_possible(struct avd_si_tag *si, AVD_SU *su); +extern void avd_sidep_update_depstate_su_rolefailover(AVD_SU *su); +extern void avd_sidep_update_depstate_si_failover(struct avd_si_tag *si, AVD_SU *su); +extern bool avd_sidep_si_dependency_exists_within_su(const AVD_SU *su); extern void avd_sidep_send_active_to_dependents(const struct avd_si_tag *si); -extern bool avd_sidep_quiesced_done_for_all_dependents(const struct avd_si_tag *si, const struct avd_su_tag *su); +extern bool avd_sidep_quiesced_done_for_all_dependents(const struct avd_si_tag *si, const AVD_SU *su); extern void sidep_take_action_on_dependents(struct avd_si_tag *si); extern bool avd_sidep_sponsors_assignment_states(struct avd_si_tag *si); extern void sidep_si_take_action(AVD_SI *si); diff --git a/osaf/services/saf/amf/amfd/include/su.h b/osaf/services/saf/amf/amfd/include/su.h --- a/osaf/services/saf/amf/amfd/include/su.h +++ b/osaf/services/saf/amf/amfd/include/su.h @@ -55,8 +55,8 @@ typedef enum { * This data structure lives in the AvD and reflects data points * associated with the Service Unit (SU) on the AvD. */ -typedef struct avd_su_tag { - +class AVD_SU { + public: NCS_PATRICIA_NODE tree_node; /* key will be the SU name */ SaNameT name; @@ -105,11 +105,11 @@ typedef struct avd_su_tag { struct avd_avnd_tag *su_on_node; /* the node on which this SU resides */ struct avd_su_si_rel_tag *list_of_susi; /* the list of su si relationship elements */ struct avd_comp_tag *list_of_comp; /* the list of components in this SU */ - struct avd_su_tag *sg_list_su_next; /* the next SU in the SG */ - struct avd_su_tag *avnd_list_su_next; /* the next SU in the AvND */ + AVD_SU *sg_list_su_next; /* the next SU in the SG */ + AVD_SU *avnd_list_su_next; /* the next SU in the AvND */ struct avd_sutype *su_type; - struct avd_su_tag *su_list_su_type_next; -} AVD_SU; + AVD_SU *su_list_su_type_next; +}; typedef struct { NCS_PATRICIA_NODE tree_node; /* key is name */ diff --git a/osaf/services/saf/amf/amfd/include/sutype.h b/osaf/services/saf/amf/amfd/include/sutype.h --- a/osaf/services/saf/amf/amfd/include/sutype.h +++ b/osaf/services/saf/amf/amfd/include/sutype.h @@ -29,7 +29,7 @@ struct avd_sutype { SaUint32T saAmfSutDefSUFailover; SaNameT *saAmfSutProvidesSvcTypes; /* array of DNs, size in number_svc_types */ unsigned int number_svc_types; /* size of array saAmfSutProvidesSvcTypes */ - struct avd_su_tag *list_of_su; + AVD_SU *list_of_su; }; /** @@ -56,12 +56,12 @@ extern void avd_sutype_constructor(void) * Add SU to SU Type internal list * @param su */ -extern void avd_sutype_add_su(struct avd_su_tag* su); +extern void avd_sutype_add_su(AVD_SU* su); /** * Remove SU from SU Type internal list * @param su */ -extern void avd_sutype_remove_su(struct avd_su_tag* su); +extern void avd_sutype_remove_su(AVD_SU* su); #endif diff --git a/osaf/services/saf/amf/amfd/include/util.h b/osaf/services/saf/amf/amfd/include/util.h --- a/osaf/services/saf/amf/amfd/include/util.h +++ b/osaf/services/saf/amf/amfd/include/util.h @@ -38,6 +38,8 @@ #include <cb.h> #include <amf_util.h> +class AVD_SU; + typedef enum { AVD_D2D_CHANGE_ROLE_REQ = AVSV_DND_MSG_MAX, AVD_D2D_CHANGE_ROLE_RSP, @@ -105,13 +107,13 @@ uint32_t avd_snd_node_data_verify_msg(st uint32_t avd_snd_node_info_on_fover_msg(struct cl_cb_tag *cb, struct avd_avnd_tag *avnd); uint32_t avd_snd_node_update_msg(struct cl_cb_tag *cb, struct avd_avnd_tag *avnd); uint32_t avd_snd_node_up_msg(struct cl_cb_tag *cb, struct avd_avnd_tag *avnd, uint32_t msg_id_ack); -uint32_t avd_snd_presence_msg(struct cl_cb_tag *cb, struct avd_su_tag *su, bool term_state); +uint32_t avd_snd_presence_msg(struct cl_cb_tag *cb, AVD_SU *su, bool term_state); uint32_t avd_snd_oper_state_msg(struct cl_cb_tag *cb, struct avd_avnd_tag *avnd, uint32_t msg_id_ack); uint32_t avd_snd_op_req_msg(struct cl_cb_tag *cb, struct avd_avnd_tag *avnd, AVSV_PARAM_INFO *param_info); uint32_t avd_snd_su_reg_msg(struct cl_cb_tag *cb, struct avd_avnd_tag *avnd, bool fail_over); -uint32_t avd_snd_su_msg(struct cl_cb_tag *cb, struct avd_su_tag *su); +uint32_t avd_snd_su_msg(struct cl_cb_tag *cb, AVD_SU *su); uint32_t avd_snd_comp_msg(struct cl_cb_tag *cb, struct avd_comp_tag *comp); -uint32_t avd_snd_susi_msg(struct cl_cb_tag *cb, struct avd_su_tag *su, struct avd_su_si_rel_tag *susi, +uint32_t avd_snd_susi_msg(struct cl_cb_tag *cb, AVD_SU *su, struct avd_su_si_rel_tag *susi, AVSV_SUSI_ACT actn, bool single_csi, struct avd_comp_csi_rel_tag*); uint32_t avd_snd_set_leds_msg(struct cl_cb_tag *cb, struct avd_avnd_tag *avnd); ------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel