osaf/services/saf/amf/amfd/amfd_main.cc | 33 ------------------
osaf/services/saf/amf/amfd/avd_proc.cc | 47 ++++++++++++++++++++------
osaf/services/saf/amf/amfd/include/avd_proc.h | 2 -
3 files changed, 35 insertions(+), 47 deletions(-)
diff --git a/osaf/services/saf/amf/amfd/amfd_main.cc
b/osaf/services/saf/amf/amfd/amfd_main.cc
--- a/osaf/services/saf/amf/amfd/amfd_main.cc
+++ b/osaf/services/saf/amf/amfd/amfd_main.cc
@@ -22,36 +22,3 @@
#include <nid_api.h>
#include "avd.h"
-static int __init_avd(void)
-{
- if (ncs_agents_startup() != NCSCC_RC_SUCCESS)
- return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);
-
- return (NCSCC_RC_SUCCESS);
-}
-
-int main(int argc, char *argv[])
-{
- uint32_t error;
- char * ee_id = NULL;
- uint32_t node_id;
-
- daemonize(argc, argv);
-
- if (__init_avd() != NCSCC_RC_SUCCESS) {
- syslog(LOG_ERR, "__init_avd() failed");
- goto done;
- }
-
- /* should never return */
- avd_main_proc();
-
- node_id = m_NCS_GET_NODE_ID;
- opensaf_reboot(node_id, ee_id, "avd_main_proc exited");
- exit(1);
-
-done:
- (void) nid_notify(const_cast<char*>("AMFD"), NCSCC_RC_FAILURE, &error);
- fprintf(stderr, "failed, exiting\n");
- exit(1);
-}
diff --git a/osaf/services/saf/amf/amfd/avd_proc.cc
b/osaf/services/saf/amf/amfd/avd_proc.cc
--- a/osaf/services/saf/amf/amfd/avd_proc.cc
+++ b/osaf/services/saf/amf/amfd/avd_proc.cc
@@ -621,22 +621,13 @@ done:
}
/*****************************************************************************
- * Function: avd_main_proc
- *
- * Purpose: This is the main infinite loop in which both the active and
- * standby AvDs execute waiting for events to happen. When woken up
+ * This is the main infinite loop in which both the active and
+ * standby waiting for events to happen. When woken up
* due to an event, based on the HA state it moves to either the active
* or standby processing modules. Even in Init state the same arrays are used.
*
- * Input: cb - AVD control block
- *
- * Returns: NONE.
- *
- * NOTES: This function will never return execept in case of init errors.
- *
- *
**************************************************************************/
-void avd_main_proc(void)
+static void main_loop(void)
{
AVD_CL_CB *cb = avd_cb;
AVD_EVT *evt;
@@ -846,3 +837,35 @@ static void avd_process_event(AVD_CL_CB
free(evt);
}
+static int __init(void)
+{
+ if (ncs_agents_startup() != NCSCC_RC_SUCCESS)
+ return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);
+
+ return (NCSCC_RC_SUCCESS);
+}
+
+int main(int argc, char *argv[])
+{
+ uint32_t error;
+
+ daemonize(argc, argv);
+
+ if (__init() != NCSCC_RC_SUCCESS) {
+ syslog(LOG_ERR, "__init_avd() failed");
+ goto done;
+ }
+
+ /* should never return */
+ main_loop();
+
+ // TODO: amfd is not running as root, cannot reboot local node
+ opensaf_reboot(0, NULL, "avd_main_proc exited");
+ exit(1);
+
+done:
+ (void) nid_notify(const_cast<char*>("AMFD"), NCSCC_RC_FAILURE, &error);
+ fprintf(stderr, "failed, exiting\n");
+ exit(1);
+}
+
diff --git a/osaf/services/saf/amf/amfd/include/avd_proc.h
b/osaf/services/saf/amf/amfd/include/avd_proc.h
--- a/osaf/services/saf/amf/amfd/include/avd_proc.h
+++ b/osaf/services/saf/amf/amfd/include/avd_proc.h
@@ -39,8 +39,6 @@
typedef void (*AVD_EVT_HDLR) (AVD_CL_CB *, AVD_EVT *);
-void avd_main_proc(void);
-
void avd_su_oper_state_evh(AVD_CL_CB *cb, struct avd_evt_tag *evt);
void avd_su_si_assign_evh(AVD_CL_CB *cb, struct avd_evt_tag *evt);
uint32_t avd_new_assgn_susi(AVD_CL_CB *cb, AVD_SU *su, AVD_SI *si,
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel