These look ugly, are inconsistently done and just have to be removed later in libqb before calling syslog. Signed-off-by: Angus Salkeld <asalkeld@xxxxxxxxxx> --- cts/agents/common_test_agent.c | 10 ++-- cts/agents/cpg_test_agent.c | 6 +- cts/agents/sam_test_agent.c | 4 +- cts/agents/votequorum_test_agent.c | 18 +++--- exec/cfg.c | 13 ++-- exec/cmap.c | 4 +- exec/coroparse.c | 4 +- exec/cpg.c | 26 ++++---- exec/evs.c | 2 +- exec/fsm.h | 4 +- exec/ipc_glue.c | 4 +- exec/main.c | 38 +++++----- exec/mon.c | 5 +- exec/pload.c | 2 +- exec/service.c | 8 +- exec/sync.c | 16 ++-- exec/syncv2.c | 10 ++-- exec/totemiba.c | 82 +++++++++++----------- exec/totemnet.c | 2 +- exec/totemrrp.c | 4 +- exec/totemsrp.c | 140 ++++++++++++++++++------------------ exec/totemudp.c | 52 +++++++------- exec/totemudpu.c | 56 +++++++------- exec/util.c | 2 +- exec/votequorum.c | 34 +++++----- exec/vsf_quorum.c | 22 +++--- exec/vsf_ykd.c | 4 +- exec/wd.c | 6 +- include/corosync/logsys.h | 2 +- 29 files changed, 292 insertions(+), 288 deletions(-) diff --git a/cts/agents/common_test_agent.c b/cts/agents/common_test_agent.c index 51266f5..f84d685 100644 --- a/cts/agents/common_test_agent.c +++ b/cts/agents/common_test_agent.c @@ -82,7 +82,7 @@ static void ta_handle_command (int sock, char* msg) char* func = NULL; if (parse_debug) - qb_log (LOG_DEBUG,"%s (MSG:%s)\n", __func__, msg); + qb_log (LOG_DEBUG,"%s (MSG:%s)", __func__, msg); str_len = strtok_r (str, ":", &saveptr); assert (str_len); @@ -129,7 +129,7 @@ static int server_process_data_fn ( /* got error or connection closed by client */ if (nbytes == 0) { /* connection closed */ - qb_log (LOG_WARNING, "socket %d hung up: exiting...\n", fd); + qb_log (LOG_WARNING, "socket %d hung up: exiting...", fd); } else { qb_perror(LOG_ERR, "recv() failed"); } @@ -175,14 +175,14 @@ retry_accept: if (new_fd == -1) { qb_log (LOG_ERR, - "Could not accept connection: %s\n", strerror (errno)); + "Could not accept connection: %s", strerror (errno)); return (0); /* This is an error, but -1 would indicate disconnect from poll loop */ } res = fcntl (new_fd, F_SETFL, O_NONBLOCK); if (res == -1) { qb_log (LOG_ERR, - "Could not set non-blocking operation on connection: %s\n", + "Could not set non-blocking operation on connection: %s", strerror (errno)); close (new_fd); return (0); /* This is an error, but -1 would indicate disconnect from poll loop */ @@ -252,7 +252,7 @@ static int create_server_sockect (int server_port) } if (bind (listener, p->ai_addr, p->ai_addrlen) < 0) { - qb_log (LOG_ERR, "bind(%s) failed: %s\n", addr_str, strerror (errno)); + qb_log (LOG_ERR, "bind(%s) failed: %s", addr_str, strerror (errno)); close (listener); continue; } diff --git a/cts/agents/cpg_test_agent.c b/cts/agents/cpg_test_agent.c index 0a2e166..727b69c 100644 --- a/cts/agents/cpg_test_agent.c +++ b/cts/agents/cpg_test_agent.c @@ -640,7 +640,7 @@ static void do_command (int sock, char* func, char*args[], int num_args) result = cpg_join (cpg_handle, &group_name); if (result != CS_OK) { qb_log (LOG_ERR, - "Could not join process group, error %d\n", result); + "Could not join process group, error %d", result); exit (1); } qb_log (LOG_INFO, "called cpg_join()!"); @@ -653,7 +653,7 @@ static void do_command (int sock, char* func, char*args[], int num_args) result = cpg_leave (cpg_handle, &group_name); if (result != CS_OK) { qb_log (LOG_ERR, - "Could not leave process group, error %d\n", result); + "Could not leave process group, error %d", result); exit (1); } qb_log (LOG_INFO, "called cpg_leave()!"); @@ -664,7 +664,7 @@ static void do_command (int sock, char* func, char*args[], int num_args) result = cpg_initialize (&cpg_handle, &callbacks); while (result != CS_OK) { qb_log (LOG_ERR, - "cpg_initialize error %d (attempt %d)\n", + "cpg_initialize error %d (attempt %d)", result, retry_count); if (retry_count >= 3) { exit (1); diff --git a/cts/agents/sam_test_agent.c b/cts/agents/sam_test_agent.c index 034c47e..58c41b3 100644 --- a/cts/agents/sam_test_agent.c +++ b/cts/agents/sam_test_agent.c @@ -84,13 +84,13 @@ static int test1 (void) qb_enter(); error = sam_initialize (2000, SAM_RECOVERY_POLICY_RESTART); if (error != CS_OK) { - qb_log (LOG_ERR, "Can't initialize SAM API. Error %d\n", error); + qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", error); return 1; } qb_log (LOG_INFO, "register"); error = sam_register (&instance_id); if (error != CS_OK) { - qb_log (LOG_ERR, "Can't register. Error %d\n", error); + qb_log (LOG_ERR, "Can't register. Error %d", error); return 1; } diff --git a/cts/agents/votequorum_test_agent.c b/cts/agents/votequorum_test_agent.c index 303d5b9..89cd00a 100644 --- a/cts/agents/votequorum_test_agent.c +++ b/cts/agents/votequorum_test_agent.c @@ -135,13 +135,13 @@ static int q_lib_init(void) } } if (ret != CS_OK) { - qb_log (LOG_ERR, "votequorum_initialize FAILED: %d\n", ret); + qb_log (LOG_ERR, "votequorum_initialize FAILED: %d", ret); vq_handle = 0; } else { ret = votequorum_trackstart (vq_handle, vq_handle, CS_TRACK_CHANGES); if (ret != CS_OK) { - qb_log (LOG_ERR, "votequorum_trackstart FAILED: %d\n", ret); + qb_log (LOG_ERR, "votequorum_trackstart FAILED: %d", ret); } votequorum_fd_get (vq_handle, &fd); @@ -155,13 +155,13 @@ static int q_lib_init(void) q_callbacks.quorum_notify_fn = quorum_notification_fn; ret = quorum_initialize (&q_handle, &q_callbacks, &q_type); if (ret != CS_OK) { - qb_log (LOG_ERR, "quorum_initialize FAILED: %d\n", ret); + qb_log (LOG_ERR, "quorum_initialize FAILED: %d", ret); q_handle = 0; } else { ret = quorum_trackstart (q_handle, CS_TRACK_CHANGES); if (ret != CS_OK) { - qb_log (LOG_ERR, "quorum_trackstart FAILED: %d\n", ret); + qb_log (LOG_ERR, "quorum_trackstart FAILED: %d", ret); } quorum_fd_get (q_handle, &fd); qb_loop_poll_add (ta_poll_handle_get(), QB_LOOP_MED, fd, @@ -181,7 +181,7 @@ static void lib_init (int sock) if (ret != CS_OK) { snprintf (response, 100, "%s", FAIL_STR); - qb_log (LOG_ERR, "q_lib_init FAILED: %d\n", ret); + qb_log (LOG_ERR, "q_lib_init FAILED: %d", ret); } send (sock, response, strlen (response), 0); @@ -198,7 +198,7 @@ static void getinfo (int sock) ret = votequorum_getinfo(vq_handle, 0, &info); if (ret != CS_OK) { snprintf (response, 100, "%s", FAIL_STR); - qb_log (LOG_ERR, "votequorum_getinfo FAILED: %d\n", ret); + qb_log (LOG_ERR, "votequorum_getinfo FAILED: %d", ret); goto send_response; } @@ -224,7 +224,7 @@ static void setexpected (int sock, char *arg) ret = votequorum_setexpected (vq_handle, atoi(arg)); if (ret != CS_OK) { snprintf (response, 100, "%s", FAIL_STR); - qb_log (LOG_ERR, "set expected votes FAILED: %d\n", ret); + qb_log (LOG_ERR, "set expected votes FAILED: %d", ret); goto send_response; } @@ -244,7 +244,7 @@ static void setvotes (int sock, char *arg) ret = votequorum_setvotes (vq_handle, 0, atoi(arg)); if (ret != CS_OK) { snprintf (response, 100, "%s", FAIL_STR); - qb_log (LOG_ERR, "set votes FAILED: %d\n", ret); + qb_log (LOG_ERR, "set votes FAILED: %d", ret); goto send_response; } @@ -266,7 +266,7 @@ static void getquorate (int sock) ret = quorum_getquorate (q_handle, &quorate); if (ret != CS_OK) { snprintf (response, 100, "%s", FAIL_STR); - qb_log (LOG_ERR, "getquorate FAILED: %d\n", ret); + qb_log (LOG_ERR, "getquorate FAILED: %d", ret); goto send_response; } diff --git a/exec/cfg.c b/exec/cfg.c index 182b687..fe1abe2 100644 --- a/exec/cfg.c +++ b/exec/cfg.c @@ -443,7 +443,8 @@ static void check_shutdown_status(void) shutdown_con = NULL; } - log_printf(LOGSYS_LEVEL_DEBUG, "shutdown decision is: (yes count: %d, no count: %d) flags=%x\n", shutdown_yes, shutdown_no, shutdown_flags); + log_printf(LOGSYS_LEVEL_DEBUG, "shutdown decision is: (yes count: %d, no count: %d) flags=%x", + shutdown_yes, shutdown_no, shutdown_flags); } LEAVE(); } @@ -572,10 +573,11 @@ static void message_handler_req_exec_cfg_killnode ( cs_name_t reason; ENTER(); - log_printf(LOGSYS_LEVEL_DEBUG, "request to kill node %d(us=%d): %s\n", req_exec_cfg_killnode->nodeid, api->totem_nodeid_get(), reason.value); + log_printf(LOGSYS_LEVEL_DEBUG, "request to kill node %d(us=%d): %s", + req_exec_cfg_killnode->nodeid, api->totem_nodeid_get(), reason.value); if (req_exec_cfg_killnode->nodeid == api->totem_nodeid_get()) { marshall_from_mar_name_t(&reason, &req_exec_cfg_killnode->reason); - log_printf(LOGSYS_LEVEL_NOTICE, "Killed by node %d: %s\n", + log_printf(LOGSYS_LEVEL_NOTICE, "Killed by node %d: %s", nodeid, reason.value); corosync_fatal_error(COROSYNC_FATAL_ERROR_EXIT); } @@ -591,7 +593,7 @@ static void message_handler_req_exec_cfg_shutdown ( { ENTER(); - log_printf(LOGSYS_LEVEL_NOTICE, "Node %d was shut down by sysadmin\n", nodeid); + log_printf(LOGSYS_LEVEL_NOTICE, "Node %d was shut down by sysadmin", nodeid); if (nodeid == api->totem_nodeid_get()) { api->shutdown_request(); } @@ -605,7 +607,8 @@ static void message_handler_req_exec_cfg_crypto_set ( const struct req_exec_cfg_crypto_set *req_exec_cfg_crypto_set = message; ENTER(); - log_printf(LOGSYS_LEVEL_NOTICE, "Node %d requested set crypto to %d\n", nodeid, req_exec_cfg_crypto_set->type); + log_printf(LOGSYS_LEVEL_NOTICE, "Node %d requested set crypto to %d", + nodeid, req_exec_cfg_crypto_set->type); api->totem_crypto_set(req_exec_cfg_crypto_set->type); LEAVE(); diff --git a/exec/cmap.c b/exec/cmap.c index 695df1f..0f7d2e2 100644 --- a/exec/cmap.c +++ b/exec/cmap.c @@ -184,7 +184,7 @@ static int cmap_lib_init_fn (void *conn) { struct cmap_conn_info *conn_info = (struct cmap_conn_info *)api->ipc_private_data_get (conn); - log_printf(LOGSYS_LEVEL_DEBUG, "lib_init_fn: conn=%p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "lib_init_fn: conn=%p", conn); api->ipc_refcnt_inc(conn); @@ -203,7 +203,7 @@ static int cmap_lib_exit_fn (void *conn) hdb_handle_t track_handle = 0; icmap_track_t *track; - log_printf(LOGSYS_LEVEL_DEBUG, "exit_fn for conn=%p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "exit_fn for conn=%p", conn); hdb_iterator_reset(&conn_info->iter_db); while (hdb_iterator_next(&conn_info->iter_db, diff --git a/exec/coroparse.c b/exec/coroparse.c index d795770..c64c2d8 100644 --- a/exec/coroparse.c +++ b/exec/coroparse.c @@ -922,7 +922,7 @@ static int read_config_file_into_icmap( char error_str[100]; const char *error_ptr = qb_strerror_r(errno, error_str, sizeof(error_str)); snprintf (error_reason, sizeof(error_string_response), - "Can't read file %s reason = (%s)\n", + "Can't read file %s reason = (%s)", filename, error_ptr); *error_string = error_reason; return -1; @@ -940,7 +940,7 @@ static int read_config_file_into_icmap( if (res == 0) { snprintf (error_reason, sizeof(error_string_response), - "Successfully read main configuration file '%s'.\n", filename); + "Successfully read main configuration file '%s'.", filename); *error_string = error_reason; } diff --git a/exec/cpg.c b/exec/cpg.c index 0d4e1af..7b26678 100644 --- a/exec/cpg.c +++ b/exec/cpg.c @@ -918,7 +918,7 @@ static int cpg_lib_exit_fn (void *conn) { struct cpg_pd *cpd = (struct cpg_pd *)api->ipc_private_data_get (conn); - log_printf(LOGSYS_LEVEL_DEBUG, "exit_fn for conn=%p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "exit_fn for conn=%p", conn); if (cpd->group_name.length > 0) { cpg_node_joinleave_send (cpd->pid, &cpd->group_name, @@ -1132,7 +1132,7 @@ static void message_handler_req_exec_cpg_procjoin ( { const struct req_exec_cpg_procjoin *req_exec_cpg_procjoin = message; - log_printf(LOGSYS_LEVEL_DEBUG, "got procjoin message from cluster node %d\n", nodeid); + log_printf(LOGSYS_LEVEL_DEBUG, "got procjoin message from cluster node %d", nodeid); do_proc_join (&req_exec_cpg_procjoin->group_name, req_exec_cpg_procjoin->pid, nodeid, @@ -1148,7 +1148,7 @@ static void message_handler_req_exec_cpg_procleave ( struct list_head *iter; mar_cpg_address_t notify_info; - log_printf(LOGSYS_LEVEL_DEBUG, "got procleave message from cluster node %d\n", nodeid); + log_printf(LOGSYS_LEVEL_DEBUG, "got procleave message from cluster node %d", nodeid); notify_info.pid = req_exec_cpg_procjoin->pid; notify_info.nodeid = nodeid; @@ -1181,7 +1181,7 @@ static void message_handler_req_exec_cpg_joinlist ( const struct qb_ipc_response_header *res = (const struct qb_ipc_response_header *)message; const struct join_list_entry *jle = (const struct join_list_entry *)(message + sizeof(struct qb_ipc_response_header)); - log_printf(LOGSYS_LEVEL_DEBUG, "got joinlist message from node %x\n", + log_printf(LOGSYS_LEVEL_DEBUG, "got joinlist message from node %x", nodeid); /* Ignore our own messages */ @@ -1330,7 +1330,7 @@ static int cpg_lib_init_fn (void *conn) list_init (&cpd->zcb_mapped_list_head); api->ipc_refcnt_inc (conn); - log_printf(LOGSYS_LEVEL_DEBUG, "lib_init_fn: conn=%p, cpd=%p\n", conn, cpd); + log_printf(LOGSYS_LEVEL_DEBUG, "lib_init_fn: conn=%p, cpd=%p", conn, cpd); return (0); } @@ -1410,7 +1410,7 @@ static void message_handler_req_lib_cpg_leave (void *conn, const void *message) struct req_lib_cpg_leave *req_lib_cpg_leave = (struct req_lib_cpg_leave *)message; struct cpg_pd *cpd = (struct cpg_pd *)api->ipc_private_data_get (conn); - log_printf(LOGSYS_LEVEL_DEBUG, "got leave request on %p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "got leave request on %p", conn); switch (cpd->cpd_state) { case CPD_STATE_UNJOINED: @@ -1448,7 +1448,7 @@ static void message_handler_req_lib_cpg_finalize ( struct res_lib_cpg_finalize res_lib_cpg_finalize; cs_error_t error = CS_OK; - log_printf (LOGSYS_LEVEL_DEBUG, "cpg finalize for conn=%p\n", conn); + log_printf (LOGSYS_LEVEL_DEBUG, "cpg finalize for conn=%p", conn); /* * We will just remove cpd from list. After this call, connection will be @@ -1682,7 +1682,7 @@ static void message_handler_req_lib_cpg_mcast (void *conn, const void *message) int result; cs_error_t error = CS_ERR_NOT_EXIST; - log_printf(LOGSYS_LEVEL_DEBUG, "got mcast request on %p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "got mcast request on %p", conn); switch (cpd->cpd_state) { case CPD_STATE_UNJOINED: @@ -1717,7 +1717,7 @@ static void message_handler_req_lib_cpg_mcast (void *conn, const void *message) result = api->totem_mcast (req_exec_cpg_iovec, 2, TOTEM_AGREED); assert(result == 0); } else { - log_printf(LOGSYS_LEVEL_ERROR, "*** %p can't mcast to group %s state:%d, error:%d\n", + log_printf(LOGSYS_LEVEL_ERROR, "*** %p can't mcast to group %s state:%d, error:%d", conn, group_name.value, cpd->cpd_state, error); } } @@ -1736,7 +1736,7 @@ static void message_handler_req_lib_cpg_zc_execute ( int result; cs_error_t error = CS_ERR_NOT_EXIST; - log_printf(LOGSYS_LEVEL_DEBUG, "got ZC mcast request on %p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "got ZC mcast request on %p", conn); header = (struct qb_ipc_request_header *)(((char *)serveraddr2void(hdr->server_address) + sizeof (struct coroipcs_zc_header))); req_lib_cpg_mcast = (struct req_lib_cpg_mcast *)header; @@ -1845,7 +1845,7 @@ static void message_handler_req_lib_cpg_iteration_initialize ( cs_error_t error = CS_OK; int res; - log_printf (LOGSYS_LEVEL_DEBUG, "cpg iteration initialize\n"); + log_printf (LOGSYS_LEVEL_DEBUG, "cpg iteration initialize"); /* Because between calling this function and *next can be some operations which will * change list, we must do full copy. @@ -1988,7 +1988,7 @@ static void message_handler_req_lib_cpg_iteration_next ( int res; struct process_info *pi; - log_printf (LOGSYS_LEVEL_DEBUG, "cpg iteration next\n"); + log_printf (LOGSYS_LEVEL_DEBUG, "cpg iteration next"); res = hdb_handle_get (&cpg_iteration_handle_t_db, req_lib_cpg_iterationnext->iteration_handle, @@ -2040,7 +2040,7 @@ static void message_handler_req_lib_cpg_iteration_finalize ( cs_error_t error = CS_OK; int res; - log_printf (LOGSYS_LEVEL_DEBUG, "cpg iteration finalize\n"); + log_printf (LOGSYS_LEVEL_DEBUG, "cpg iteration finalize"); res = hdb_handle_get (&cpg_iteration_handle_t_db, req_lib_cpg_iterationfinalize->iteration_handle, diff --git a/exec/evs.c b/exec/evs.c index 1695700..24a1f4b 100644 --- a/exec/evs.c +++ b/exec/evs.c @@ -221,7 +221,7 @@ static int evs_lib_init_fn (void *conn) { struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn); - log_printf (LOGSYS_LEVEL_DEBUG, "Got request to initalize evs service.\n"); + log_printf (LOGSYS_LEVEL_DEBUG, "Got request to initalize evs service."); evs_pd->groups = NULL; evs_pd->group_entries = 0; diff --git a/exec/fsm.h b/exec/fsm.h index f0a737e..811c6a8 100644 --- a/exec/fsm.h +++ b/exec/fsm.h @@ -102,7 +102,7 @@ static inline void cs_fsm_state_set (struct cs_fsm* fsm, int32_t next_state, voi break; } if (entry->next_states[i] == next_state) { - log_printf (LOGSYS_LEVEL_INFO, "Fsm:%s event \"%s\", state \"%s\" --> \"%s\"\n", + log_printf (LOGSYS_LEVEL_INFO, "Fsm:%s event \"%s\", state \"%s\" --> \"%s\"", fsm->name, fsm->event_to_str(fsm, entry->event), fsm->state_to_str(fsm, fsm->table[fsm->curr_entry].curr_state), @@ -111,7 +111,7 @@ static inline void cs_fsm_state_set (struct cs_fsm* fsm, int32_t next_state, voi return; } } - log_printf (LOGSYS_LEVEL_CRIT, "Fsm:%s Can't change state from \"%s\" to \"%s\" (event was \"%s\")\n", + log_printf (LOGSYS_LEVEL_CRIT, "Fsm:%s Can't change state from \"%s\" to \"%s\" (event was \"%s\")", fsm->name, fsm->state_to_str(fsm, fsm->table[fsm->curr_entry].curr_state), fsm->state_to_str(fsm, next_state), diff --git a/exec/ipc_glue.c b/exec/ipc_glue.c index e18ac55..67e3a05 100644 --- a/exec/ipc_glue.c +++ b/exec/ipc_glue.c @@ -692,10 +692,10 @@ static void cs_ipcs_low_fds_event(int32_t not_enough, int32_t fds_available) { ipc_not_enough_fds_left = not_enough; if (not_enough) { - log_printf(LOGSYS_LEVEL_WARNING, "refusing new connections (fds_available:%d)\n", + log_printf(LOGSYS_LEVEL_WARNING, "refusing new connections (fds_available:%d)", fds_available); } else { - log_printf(LOGSYS_LEVEL_NOTICE, "allowing new connections (fds_available:%d)\n", + log_printf(LOGSYS_LEVEL_NOTICE, "allowing new connections (fds_available:%d)", fds_available); } diff --git a/exec/main.c b/exec/main.c index 895b4df..c404371 100644 --- a/exec/main.c +++ b/exec/main.c @@ -252,7 +252,7 @@ static void serialize_unlock (void) static void corosync_sync_completed (void) { log_printf (LOGSYS_LEVEL_NOTICE, - "Completed service synchronization, ready to provide service.\n"); + "Completed service synchronization, ready to provide service."); sync_in_process = 0; cs_ipcs_sync_state_changed(sync_in_process); @@ -485,7 +485,7 @@ static void corosync_mlockall (void) /* under FreeBSD < 8 a process with locked page cannot call dlopen * code disabled until FreeBSD bug i386/93396 was solved */ - log_printf (LOGSYS_LEVEL_WARNING, "Could not lock memory of service to avoid page faults\n"); + log_printf (LOGSYS_LEVEL_WARNING, "Could not lock memory of service to avoid page faults"); #else res = mlockall (MCL_CURRENT | MCL_FUTURE); if (res == -1) { @@ -610,7 +610,7 @@ static void totem_dynamic_notify( if (remove_old_member) { log_printf(LOGSYS_LEVEL_DEBUG, - "removing dynamic member %s for ring %u\n", (char *)old_val.data, ring_no); + "removing dynamic member %s for ring %u", (char *)old_val.data, ring_no); if (totemip_parse(&member, (char *)old_val.data, 0) == 0) { totempg_member_remove (&member, ring_no); } @@ -618,7 +618,7 @@ static void totem_dynamic_notify( if (add_new_member) { log_printf(LOGSYS_LEVEL_DEBUG, - "adding dynamic member %s for ring %u\n", (char *)new_val.data, ring_no); + "adding dynamic member %s for ring %u", (char *)new_val.data, ring_no); if (totemip_parse(&member, (char *)new_val.data, 0) == 0) { totempg_member_add (&member, ring_no); } @@ -923,7 +923,7 @@ static void main_service_ready (void) */ res = corosync_service_defaults_link_and_init (api); if (res == -1) { - log_printf (LOGSYS_LEVEL_ERROR, "Could not initialize default services\n"); + log_printf (LOGSYS_LEVEL_ERROR, "Could not initialize default services"); corosync_exit_error (COROSYNC_DONE_INIT_SERVICES); } evil_init (api); @@ -932,13 +932,15 @@ static void main_service_ready (void) corosync_fplay_control_init (); corosync_totem_dynamic_init (); if (minimum_sync_mode == CS_SYNC_V2) { - log_printf (LOGSYS_LEVEL_NOTICE, "Compatibility mode set to none. Using V2 of the synchronization engine.\n"); + log_printf (LOGSYS_LEVEL_NOTICE, + "Compatibility mode set to none. Using V2 of the synchronization engine."); sync_v2_init ( corosync_sync_v2_callbacks_retrieve, corosync_sync_completed); } else if (minimum_sync_mode == CS_SYNC_V1) { - log_printf (LOGSYS_LEVEL_NOTICE, "Compatibility mode set to whitetank. Using V1 and V2 of the synchronization engine.\n"); + log_printf (LOGSYS_LEVEL_NOTICE, + "Compatibility mode set to whitetank. Using V1 and V2 of the synchronization engine."); sync_register ( corosync_sync_callbacks_retrieve, sync_v2_memb_list_determine, @@ -965,7 +967,7 @@ static enum e_corosync_done corosync_flock (const char *lockfile, pid_t pid) lf = open (lockfile, O_WRONLY | O_CREAT, 0640); if (lf == -1) { - log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't create lock file.\n"); + log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't create lock file."); return (COROSYNC_DONE_AQUIRE_LOCK); } @@ -981,12 +983,12 @@ retry_fcntl: break; case EAGAIN: case EACCES: - log_printf (LOGSYS_LEVEL_ERROR, "Another Corosync instance is already running.\n"); + log_printf (LOGSYS_LEVEL_ERROR, "Another Corosync instance is already running."); err = COROSYNC_DONE_ALREADY_RUNNING; goto error_close; break; default: - log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't aquire lock. Error was %s\n", + log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't aquire lock. Error was %s", strerror(errno)); err = COROSYNC_DONE_AQUIRE_LOCK; goto error_close; @@ -995,7 +997,7 @@ retry_fcntl: } if (ftruncate (lf, 0) == -1) { - log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't truncate lock file. Error was %s\n", + log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't truncate lock file. Error was %s", strerror (errno)); err = COROSYNC_DONE_AQUIRE_LOCK; goto error_close_unlink; @@ -1010,7 +1012,7 @@ retry_write: goto retry_write; } else { log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't write pid to lock file. " - "Error was %s\n", strerror (errno)); + "Error was %s", strerror (errno)); err = COROSYNC_DONE_AQUIRE_LOCK; goto error_close_unlink; } @@ -1018,14 +1020,14 @@ retry_write: if ((fd_flag = fcntl (lf, F_GETFD, 0)) == -1) { log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't get close-on-exec flag from lock file. " - "Error was %s\n", strerror (errno)); + "Error was %s", strerror (errno)); err = COROSYNC_DONE_AQUIRE_LOCK; goto error_close_unlink; } fd_flag |= FD_CLOEXEC; if (fcntl (lf, F_SETFD, fd_flag) == -1) { log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't set close-on-exec flag to lock file. " - "Error was %s\n", strerror (errno)); + "Error was %s", strerror (errno)); err = COROSYNC_DONE_AQUIRE_LOCK; goto error_close_unlink; } @@ -1095,8 +1097,8 @@ int main (int argc, char **argv, char **envp) corosync_mlockall (); - log_printf (LOGSYS_LEVEL_NOTICE, "Corosync Cluster Engine ('%s'): started and ready to provide service.\n", VERSION); - log_printf (LOGSYS_LEVEL_INFO, "Corosync built-in features:" PACKAGE_FEATURES "\n"); + log_printf (LOGSYS_LEVEL_NOTICE, "Corosync Cluster Engine ('%s'): started and ready to provide service.", VERSION); + log_printf (LOGSYS_LEVEL_INFO, "Corosync built-in features:" PACKAGE_FEATURES ""); corosync_poll_handle = qb_loop_create (); @@ -1115,7 +1117,7 @@ int main (int argc, char **argv, char **envp) #endif if (icmap_init() != CS_OK) { - log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't initialize configuration component.\n"); + log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't initialize configuration component."); corosync_exit_error (COROSYNC_DONE_OBJDB); } @@ -1151,7 +1153,7 @@ int main (int argc, char **argv, char **envp) sprintf (corosync_lib_dir, "%s/lib/corosync", LOCALSTATEDIR); res = stat (corosync_lib_dir, &stat_out); if ((res == -1) || (res == 0 && !S_ISDIR(stat_out.st_mode))) { - log_printf (LOGSYS_LEVEL_ERROR, "Required directory not present %s. Please create it.\n", corosync_lib_dir); + log_printf (LOGSYS_LEVEL_ERROR, "Required directory not present %s. Please create it.", corosync_lib_dir); corosync_exit_error (COROSYNC_DONE_DIR_NOT_PRESENT); } diff --git a/exec/mon.c b/exec/mon.c index fc5be86..95d07fb 100644 --- a/exec/mon.c +++ b/exec/mon.c @@ -285,7 +285,7 @@ static int32_t percent_mem_used_get(void) swap_stats = sg_get_swap_stats(); if (mem_stats == NULL || swap_stats != NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "Unable to get memory stats: %s\n", + log_printf (LOGSYS_LEVEL_ERROR, "Unable to get memory stats: %s", sg_str_error(sg_get_error())); return -1; } @@ -339,7 +339,6 @@ static void mem_update_stats_fn (void *data) char key_name[ICMAP_KEYNAME_MAXLEN]; new_value = percent_mem_used_get(); - fprintf(stderr,"BLA = %u\n", new_value); if (new_value > 0) { snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", inst->icmap_path, "current"); icmap_set_uint32(key_name, new_value); @@ -363,7 +362,7 @@ static double min15_loadavg_get(void) sg_load_stats *load_stats; load_stats = sg_get_load_stats (); if (load_stats == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "Unable to get load stats: %s\n", + log_printf (LOGSYS_LEVEL_ERROR, "Unable to get load stats: %s", sg_str_error (sg_get_error())); return -1; } diff --git a/exec/pload.c b/exec/pload.c index f4f599c..35fc239 100644 --- a/exec/pload.c +++ b/exec/pload.c @@ -327,7 +327,7 @@ static void message_handler_req_exec_pload_mcast ( if (msgs_delivered == msgs_wanted) { tv2 = qb_util_nano_current_get (); tv_elapsed = tv2 - tv1; - sprintf (log_buffer, "%5d Writes %d bytes per write %7.3f seconds runtime, %9.3f TP/S, %9.3f MB/S.\n", + sprintf (log_buffer, "%5d Writes %d bytes per write %7.3f seconds runtime, %9.3f TP/S, %9.3f MB/S.", msgs_delivered, msg_size, (tv_elapsed / 1000000000.0), diff --git a/exec/service.c b/exec/service.c index 4cd9d8e..fc87f45 100644 --- a/exec/service.c +++ b/exec/service.c @@ -179,7 +179,7 @@ unsigned int corosync_service_link_and_init ( } log_printf (LOGSYS_LEVEL_NOTICE, - "Service engine loaded: %s [%d]\n", service_engine->name, service_engine->id); + "Service engine loaded: %s [%d]", service_engine->name, service_engine->id); cs_ipcs_service_init(service_engine); return (res); } @@ -318,7 +318,7 @@ static unsigned int service_unlink_and_exit ( } log_printf(LOGSYS_LEVEL_NOTICE, - "Service engine unloaded: %s\n", + "Service engine unloaded: %s", corosync_service[service_id]->name); corosync_service[service_id] = NULL; @@ -372,7 +372,7 @@ static void service_unlink_schedwrk_handler (void *data) { } log_printf(LOGSYS_LEVEL_NOTICE, - "Service engine unloaded: %s\n", + "Service engine unloaded: %s", corosync_service[cb_data->service_engine]->name); corosync_service[cb_data->service_engine] = NULL; @@ -403,7 +403,7 @@ static void service_exit_schedwrk_handler (void *data) { if (called == 0) { log_printf(LOGSYS_LEVEL_NOTICE, - "Unloading all Corosync service engines.\n"); + "Unloading all Corosync service engines."); current_priority = service_priority_max (); called = 1; } diff --git a/exec/sync.c b/exec/sync.c index f84c402..fdf3e73 100644 --- a/exec/sync.c +++ b/exec/sync.c @@ -295,7 +295,7 @@ int sync_register ( sync_confchg_fn); if (res == -1) { log_printf (LOGSYS_LEVEL_ERROR, - "Couldn't initialize groups interface.\n"); + "Couldn't initialize groups interface."); return (-1); } @@ -304,7 +304,7 @@ int sync_register ( &sync_group, 1); if (res == -1) { - log_printf (LOGSYS_LEVEL_ERROR, "Couldn't join group.\n"); + log_printf (LOGSYS_LEVEL_ERROR, "Couldn't join group."); return (-1); } @@ -365,7 +365,7 @@ static void sync_deliver_fn ( unsigned int barrier_completed; int i; - log_printf (LOGSYS_LEVEL_DEBUG, "confchg entries %lu\n", + log_printf (LOGSYS_LEVEL_DEBUG, "confchg entries %lu", (unsigned long int) barrier_data_confchg_entries); if (endian_conversion_required) { sync_endian_convert (req_exec_sync_barrier_start); @@ -391,7 +391,7 @@ static void sync_deliver_fn ( if (nodeid == barrier_data_process[i].nodeid) { barrier_data_process[i].completed = 1; log_printf (LOGSYS_LEVEL_DEBUG, - "Barrier Start Received From %d\n", + "Barrier Start Received From %d", barrier_data_process[i].nodeid); break; } @@ -402,7 +402,7 @@ static void sync_deliver_fn ( */ for (i = 0; i < barrier_data_confchg_entries; i++) { log_printf (LOGSYS_LEVEL_DEBUG, - "Barrier completion status for nodeid %d = %d. \n", + "Barrier completion status for nodeid %d = %d. ", barrier_data_process[i].nodeid, barrier_data_process[i].completed); if (barrier_data_process[i].completed == 0) { @@ -411,7 +411,7 @@ static void sync_deliver_fn ( } if (barrier_completed) { log_printf (LOGSYS_LEVEL_DEBUG, - "Synchronization barrier completed\n"); + "Synchronization barrier completed"); } /* * This sync is complete so activate and start next service sync @@ -420,7 +420,7 @@ static void sync_deliver_fn ( sync_callbacks.sync_activate (); log_printf (LOGSYS_LEVEL_DEBUG, - "Committing synchronization for (%s)\n", + "Committing synchronization for (%s)", sync_callbacks.name); } @@ -438,7 +438,7 @@ static void sync_deliver_fn ( */ if (sync_processing && sync_callbacks.sync_init_api.sync_init_v1) { log_printf (LOGSYS_LEVEL_DEBUG, - "Synchronization actions starting for (%s)\n", + "Synchronization actions starting for (%s)", sync_callbacks.name); sync_service_init (&deliver_ring_id); } diff --git a/exec/syncv2.c b/exec/syncv2.c index 5a5528e..3131e34 100644 --- a/exec/syncv2.c +++ b/exec/syncv2.c @@ -193,7 +193,7 @@ int sync_v2_init ( &sync_group, 1); if (res == -1) { - log_printf (LOGSYS_LEVEL_ERROR, "Couldn't join group.\n"); + log_printf (LOGSYS_LEVEL_ERROR, "Couldn't join group."); return (-1); } @@ -230,7 +230,7 @@ static void sync_barrier_handler (unsigned int nodeid, const void *msg) if (memcmp (&my_ring_id, &req_exec_barrier_message->ring_id, sizeof (struct memb_ring_id)) != 0) { - log_printf (LOGSYS_LEVEL_DEBUG, "barrier for old ring - discarding\n"); + log_printf (LOGSYS_LEVEL_DEBUG, "barrier for old ring - discarding"); return; } for (i = 0; i < my_processor_list_entries; i++) { @@ -244,7 +244,7 @@ static void sync_barrier_handler (unsigned int nodeid, const void *msg) } } if (barrier_reached) { - log_printf (LOGSYS_LEVEL_DEBUG, "Committing synchronization for %s\n", + log_printf (LOGSYS_LEVEL_DEBUG, "Committing synchronization for %s", my_service_list[my_processing_idx].name); my_service_list[my_processing_idx].state = ACTIVATE; my_service_list[my_processing_idx].sync_activate (); @@ -296,7 +296,7 @@ static void sync_memb_determine (unsigned int nodeid, const void *msg) if (memcmp (&req_exec_memb_determine_message->ring_id, &my_memb_determine_ring_id, sizeof (struct memb_ring_id)) != 0) { - log_printf (LOGSYS_LEVEL_DEBUG, "memb determine for old ring - discarding\n"); + log_printf (LOGSYS_LEVEL_DEBUG, "memb determine for old ring - discarding"); return; } @@ -322,7 +322,7 @@ static void sync_service_build_handler (unsigned int nodeid, const void *msg) if (memcmp (&my_ring_id, &req_exec_service_build_message->ring_id, sizeof (struct memb_ring_id)) != 0) { - log_printf (LOGSYS_LEVEL_DEBUG, "service build for old ring - discarding\n"); + log_printf (LOGSYS_LEVEL_DEBUG, "service build for old ring - discarding"); return; } for (i = 0; i < req_exec_service_build_message->service_list_entries; i++) { diff --git a/exec/totemiba.c b/exec/totemiba.c index b0b178d..2a79b92 100644 --- a/exec/totemiba.c +++ b/exec/totemiba.c @@ -273,7 +273,7 @@ static inline struct send_buf *mcast_send_buf_get ( send_buf->buffer, 2048, IBV_ACCESS_LOCAL_WRITE); if (send_buf->mr == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't register memory range\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't register memory range"); free (send_buf); return (NULL); } @@ -310,7 +310,7 @@ static inline struct send_buf *token_send_buf_get ( send_buf->buffer, 2048, IBV_ACCESS_LOCAL_WRITE); if (send_buf->mr == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't register memory range\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't register memory range"); free (send_buf); return (NULL); } @@ -549,12 +549,12 @@ static int mcast_rdma_event_fn (int events, int suck, void *context) case RDMA_CM_EVENT_ADDR_ERROR: case RDMA_CM_EVENT_ROUTE_ERROR: case RDMA_CM_EVENT_MULTICAST_ERROR: - log_printf (LOGSYS_LEVEL_ERROR, "multicast error\n"); + log_printf (LOGSYS_LEVEL_ERROR, "multicast error"); break; case RDMA_CM_EVENT_DEVICE_REMOVAL: break; default: - log_printf (LOGSYS_LEVEL_ERROR, "default %d\n", event->event); + log_printf (LOGSYS_LEVEL_ERROR, "default %d", event->event); break; } @@ -661,7 +661,7 @@ static int recv_token_accept_setup (struct totemiba_instance *instance) */ instance->recv_token_recv_completion_channel = ibv_create_comp_channel (instance->recv_token_cma_id->verbs); if (instance->recv_token_recv_completion_channel == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel"); return (-1); } @@ -672,12 +672,12 @@ static int recv_token_accept_setup (struct totemiba_instance *instance) COMPLETION_QUEUE_ENTRIES, instance, instance->recv_token_recv_completion_channel, 0); if (instance->recv_token_recv_cq == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue"); return (-1); } res = ibv_req_notify_cq (instance->recv_token_recv_cq, 0); if (res != 0) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't request notifications of the completion queue\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't request notifications of the completion queue"); return (-1); } @@ -686,7 +686,7 @@ static int recv_token_accept_setup (struct totemiba_instance *instance) */ instance->recv_token_send_completion_channel = ibv_create_comp_channel (instance->recv_token_cma_id->verbs); if (instance->recv_token_send_completion_channel == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel"); return (-1); } @@ -697,12 +697,12 @@ static int recv_token_accept_setup (struct totemiba_instance *instance) COMPLETION_QUEUE_ENTRIES, instance, instance->recv_token_send_completion_channel, 0); if (instance->recv_token_send_cq == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue"); return (-1); } res = ibv_req_notify_cq (instance->recv_token_send_cq, 0); if (res != 0) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't request notifications of the completion queue\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't request notifications of the completion queue"); return (-1); } memset (&init_qp_attr, 0, sizeof (struct ibv_qp_init_attr)); @@ -718,7 +718,7 @@ static int recv_token_accept_setup (struct totemiba_instance *instance) res = rdma_create_qp (instance->recv_token_cma_id, instance->recv_token_pd, &init_qp_attr); if (res != 0) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create queue pair\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create queue pair"); return (-1); } @@ -765,7 +765,7 @@ static int recv_token_rdma_event_fn (int events, int suck, void *context) res = rdma_accept (instance->recv_token_cma_id, &conn_param); break; default: - log_printf (LOGSYS_LEVEL_ERROR, "default %d\n", event->event); + log_printf (LOGSYS_LEVEL_ERROR, "default %d", event->event); break; } @@ -859,17 +859,17 @@ static int send_token_rdma_event_fn (int events, int suck, void *context) case RDMA_CM_EVENT_ROUTE_ERROR: case RDMA_CM_EVENT_MULTICAST_ERROR: log_printf (LOGSYS_LEVEL_ERROR, - "send_token_rdma_event_fn multicast error\n"); + "send_token_rdma_event_fn multicast error"); break; case RDMA_CM_EVENT_DEVICE_REMOVAL: break; case RDMA_CM_EVENT_UNREACHABLE: log_printf (LOGSYS_LEVEL_ERROR, - "send_token_rdma_event_fn unreachable\n"); + "send_token_rdma_event_fn unreachable"); break; default: log_printf (LOGSYS_LEVEL_ERROR, - "send_token_rdma_event_fn unknown event %d\n", + "send_token_rdma_event_fn unknown event %d", event->event); break; } @@ -885,21 +885,21 @@ static int send_token_bind (struct totemiba_instance *instance) instance->send_token_channel = rdma_create_event_channel(); if (instance->send_token_channel == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create rdma channel\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create rdma channel"); return (-1); } res = rdma_create_id (instance->send_token_channel, &instance->send_token_cma_id, NULL, RDMA_PS_UDP); if (res) { - log_printf (LOGSYS_LEVEL_ERROR, "error creating send_token_cma_id\n"); + log_printf (LOGSYS_LEVEL_ERROR, "error creating send_token_cma_id"); return (-1); } res = rdma_bind_addr (instance->send_token_cma_id, &instance->send_token_bind_addr); if (res) { - log_printf (LOGSYS_LEVEL_ERROR, "error doing rdma_bind_addr for send token\n"); + log_printf (LOGSYS_LEVEL_ERROR, "error doing rdma_bind_addr for send token"); return (-1); } @@ -909,7 +909,7 @@ static int send_token_bind (struct totemiba_instance *instance) res = rdma_resolve_addr (instance->send_token_cma_id, &instance->bind_addr, &instance->token_addr, 2000); if (res) { - log_printf (LOGSYS_LEVEL_ERROR, "error resolving send token address %d %d\n", res, errno); + log_printf (LOGSYS_LEVEL_ERROR, "error resolving send token address %d %d", res, errno); return (-1); } @@ -923,7 +923,7 @@ static int send_token_bind (struct totemiba_instance *instance) */ instance->send_token_recv_completion_channel = ibv_create_comp_channel (instance->send_token_cma_id->verbs); if (instance->send_token_recv_completion_channel == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel"); return (-1); } @@ -934,13 +934,13 @@ static int send_token_bind (struct totemiba_instance *instance) COMPLETION_QUEUE_ENTRIES, instance, instance->send_token_recv_completion_channel, 0); if (instance->send_token_recv_cq == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue"); return (-1); } res = ibv_req_notify_cq (instance->send_token_recv_cq, 0); if (res != 0) { log_printf (LOGSYS_LEVEL_ERROR, - "couldn't request notifications of the completion queue\n"); + "couldn't request notifications of the completion queue"); return (-1); } @@ -951,7 +951,7 @@ static int send_token_bind (struct totemiba_instance *instance) ibv_create_comp_channel (instance->send_token_cma_id->verbs); if (instance->send_token_send_completion_channel == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel"); return (-1); } @@ -963,14 +963,14 @@ static int send_token_bind (struct totemiba_instance *instance) COMPLETION_QUEUE_ENTRIES, instance, instance->send_token_send_completion_channel, 0); if (instance->send_token_send_cq == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue"); return (-1); } res = ibv_req_notify_cq (instance->send_token_send_cq, 0); if (res != 0) { log_printf (LOGSYS_LEVEL_ERROR, - "couldn't request notifications of the completion queue\n"); + "couldn't request notifications of the completion queue"); return (-1); } memset (&init_qp_attr, 0, sizeof (struct ibv_qp_init_attr)); @@ -986,7 +986,7 @@ static int send_token_bind (struct totemiba_instance *instance) res = rdma_create_qp (instance->send_token_cma_id, instance->send_token_pd, &init_qp_attr); if (res != 0) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create queue pair\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create queue pair"); return (-1); } @@ -1046,21 +1046,21 @@ static int recv_token_bind (struct totemiba_instance *instance) instance->listen_recv_token_channel = rdma_create_event_channel(); if (instance->listen_recv_token_channel == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create rdma channel\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create rdma channel"); return (-1); } res = rdma_create_id (instance->listen_recv_token_channel, &instance->listen_recv_token_cma_id, NULL, RDMA_PS_UDP); if (res) { - log_printf (LOGSYS_LEVEL_ERROR, "error creating recv_token_cma_id\n"); + log_printf (LOGSYS_LEVEL_ERROR, "error creating recv_token_cma_id"); return (-1); } res = rdma_bind_addr (instance->listen_recv_token_cma_id, &instance->bind_addr); if (res) { - log_printf (LOGSYS_LEVEL_ERROR, "error doing rdma_bind_addr for recv token\n"); + log_printf (LOGSYS_LEVEL_ERROR, "error doing rdma_bind_addr for recv token"); return (-1); } @@ -1069,7 +1069,7 @@ static int recv_token_bind (struct totemiba_instance *instance) */ res = rdma_listen (instance->listen_recv_token_cma_id, 10); if (res) { - log_printf (LOGSYS_LEVEL_ERROR, "error listening %d %d\n", res, errno); + log_printf (LOGSYS_LEVEL_ERROR, "error listening %d %d", res, errno); return (-1); } @@ -1089,19 +1089,19 @@ static int mcast_bind (struct totemiba_instance *instance) instance->mcast_channel = rdma_create_event_channel(); if (instance->mcast_channel == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create rdma channel\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create rdma channel"); return (-1); } res = rdma_create_id (instance->mcast_channel, &instance->mcast_cma_id, NULL, RDMA_PS_UDP); if (res) { - log_printf (LOGSYS_LEVEL_ERROR, "error creating mcast_cma_id\n"); + log_printf (LOGSYS_LEVEL_ERROR, "error creating mcast_cma_id"); return (-1); } res = rdma_bind_addr (instance->mcast_cma_id, &instance->local_mcast_bind_addr); if (res) { - log_printf (LOGSYS_LEVEL_ERROR, "error doing rdma_bind_addr for mcast\n"); + log_printf (LOGSYS_LEVEL_ERROR, "error doing rdma_bind_addr for mcast"); return (-1); } @@ -1111,7 +1111,7 @@ static int mcast_bind (struct totemiba_instance *instance) res = rdma_resolve_addr (instance->mcast_cma_id, &instance->local_mcast_bind_addr, &instance->mcast_addr, 5000); if (res) { - log_printf (LOGSYS_LEVEL_ERROR, "error resolving multicast address %d %d\n", res, errno); + log_printf (LOGSYS_LEVEL_ERROR, "error resolving multicast address %d %d", res, errno); return (-1); } @@ -1125,7 +1125,7 @@ static int mcast_bind (struct totemiba_instance *instance) */ instance->mcast_recv_completion_channel = ibv_create_comp_channel (instance->mcast_cma_id->verbs); if (instance->mcast_recv_completion_channel == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel"); return (-1); } @@ -1136,12 +1136,12 @@ static int mcast_bind (struct totemiba_instance *instance) COMPLETION_QUEUE_ENTRIES, instance, instance->mcast_recv_completion_channel, 0); if (instance->mcast_recv_cq == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue"); return (-1); } res = ibv_req_notify_cq (instance->mcast_recv_cq, 0); if (res != 0) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't request notifications of the completion queue\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't request notifications of the completion queue"); return (-1); } @@ -1150,7 +1150,7 @@ static int mcast_bind (struct totemiba_instance *instance) */ instance->mcast_send_completion_channel = ibv_create_comp_channel (instance->mcast_cma_id->verbs); if (instance->mcast_send_completion_channel == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion channel"); return (-1); } @@ -1161,12 +1161,12 @@ static int mcast_bind (struct totemiba_instance *instance) COMPLETION_QUEUE_ENTRIES, instance, instance->mcast_send_completion_channel, 0); if (instance->mcast_send_cq == NULL) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create completion queue"); return (-1); } res = ibv_req_notify_cq (instance->mcast_send_cq, 0); if (res != 0) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't request notifications of the completion queue\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't request notifications of the completion queue"); return (-1); } memset (&init_qp_attr, 0, sizeof (struct ibv_qp_init_attr)); @@ -1182,7 +1182,7 @@ static int mcast_bind (struct totemiba_instance *instance) res = rdma_create_qp (instance->mcast_cma_id, instance->mcast_pd, &init_qp_attr); if (res != 0) { - log_printf (LOGSYS_LEVEL_ERROR, "couldn't create queue pair\n"); + log_printf (LOGSYS_LEVEL_ERROR, "couldn't create queue pair"); return (-1); } diff --git a/exec/totemnet.c b/exec/totemnet.c index 0343b31..38efc5c 100644 --- a/exec/totemnet.c +++ b/exec/totemnet.c @@ -237,7 +237,7 @@ static void totemnet_instance_initialize ( transport = config->transport_number; log_printf (LOGSYS_LEVEL_NOTICE, - "Initializing transport (%s).\n", transport_entries[transport].name); + "Initializing transport (%s).", transport_entries[transport].name); instance->transport = &transport_entries[transport]; } diff --git a/exec/totemrrp.c b/exec/totemrrp.c index 805763e..ea0c0b9 100644 --- a/exec/totemrrp.c +++ b/exec/totemrrp.c @@ -1730,7 +1730,7 @@ void rrp_deliver_fn ( if (hdr->type == MESSAGE_TYPE_RING_TEST_ACTIVE) { log_printf ( rrp_instance->totemrrp_log_level_debug, - "received message requesting test of ring now active\n"); + "received message requesting test of ring now active"); if (hdr->endian_detector != ENDIAN_LOCAL) { test_active_msg_endian_convert(hdr, &tmp_msg); @@ -1760,7 +1760,7 @@ void rrp_deliver_fn ( if (hdr->type == MESSAGE_TYPE_RING_TEST_ACTIVATE) { log_printf ( rrp_instance->totemrrp_log_level_notice, - "Automatically recovered ring %d\n", hdr->ring_number); + "Automatically recovered ring %d", hdr->ring_number); if (hdr->endian_detector != ENDIAN_LOCAL) { test_active_msg_endian_convert(hdr, &tmp_msg); diff --git a/exec/totemsrp.c b/exec/totemsrp.c index 5ab5e8f..c319553 100644 --- a/exec/totemsrp.c +++ b/exec/totemsrp.c @@ -713,7 +713,7 @@ static int pause_flush (struct totemsrp_instance *instance) if ((now_msec - timestamp_msec) > (instance->totem_config->token_timeout / 2)) { log_printf (instance->totemsrp_log_level_notice, - "Process pause detected for %d ms, flushing membership messages.\n", (unsigned int)(now_msec - timestamp_msec)); + "Process pause detected for %d ms, flushing membership messages.", (unsigned int)(now_msec - timestamp_msec)); /* * -1 indicates an error from recvmsg */ @@ -832,56 +832,56 @@ int totemsrp_initialize ( * Display totem configuration */ log_printf (instance->totemsrp_log_level_debug, - "Token Timeout (%d ms) retransmit timeout (%d ms)\n", + "Token Timeout (%d ms) retransmit timeout (%d ms)", totem_config->token_timeout, totem_config->token_retransmit_timeout); log_printf (instance->totemsrp_log_level_debug, - "token hold (%d ms) retransmits before loss (%d retrans)\n", + "token hold (%d ms) retransmits before loss (%d retrans)", totem_config->token_hold_timeout, totem_config->token_retransmits_before_loss_const); log_printf (instance->totemsrp_log_level_debug, - "join (%d ms) send_join (%d ms) consensus (%d ms) merge (%d ms)\n", + "join (%d ms) send_join (%d ms) consensus (%d ms) merge (%d ms)", totem_config->join_timeout, totem_config->send_join_timeout, totem_config->consensus_timeout, totem_config->merge_timeout); log_printf (instance->totemsrp_log_level_debug, - "downcheck (%d ms) fail to recv const (%d msgs)\n", + "downcheck (%d ms) fail to recv const (%d msgs)", totem_config->downcheck_timeout, totem_config->fail_to_recv_const); log_printf (instance->totemsrp_log_level_debug, - "seqno unchanged const (%d rotations) Maximum network MTU %d\n", totem_config->seqno_unchanged_const, totem_config->net_mtu); + "seqno unchanged const (%d rotations) Maximum network MTU %d", totem_config->seqno_unchanged_const, totem_config->net_mtu); log_printf (instance->totemsrp_log_level_debug, - "window size per rotation (%d messages) maximum messages per rotation (%d messages)\n", + "window size per rotation (%d messages) maximum messages per rotation (%d messages)", totem_config->window_size, totem_config->max_messages); log_printf (instance->totemsrp_log_level_debug, - "missed count const (%d messages)\n", + "missed count const (%d messages)", totem_config->miss_count_const); log_printf (instance->totemsrp_log_level_debug, - "send threads (%d threads)\n", totem_config->threads); + "send threads (%d threads)", totem_config->threads); log_printf (instance->totemsrp_log_level_debug, - "RRP token expired timeout (%d ms)\n", + "RRP token expired timeout (%d ms)", totem_config->rrp_token_expired_timeout); log_printf (instance->totemsrp_log_level_debug, - "RRP token problem counter (%d ms)\n", + "RRP token problem counter (%d ms)", totem_config->rrp_problem_count_timeout); log_printf (instance->totemsrp_log_level_debug, - "RRP threshold (%d problem count)\n", + "RRP threshold (%d problem count)", totem_config->rrp_problem_count_threshold); log_printf (instance->totemsrp_log_level_debug, - "RRP multicast threshold (%d problem count)\n", + "RRP multicast threshold (%d problem count)", totem_config->rrp_problem_count_mcast_threshold); log_printf (instance->totemsrp_log_level_debug, - "RRP automatic recovery check timeout (%d ms)\n", + "RRP automatic recovery check timeout (%d ms)", totem_config->rrp_autorecovery_check_timeout); log_printf (instance->totemsrp_log_level_debug, - "RRP mode set to %s.\n", instance->totem_config->rrp_mode); + "RRP mode set to %s.", instance->totem_config->rrp_mode); log_printf (instance->totemsrp_log_level_debug, - "heartbeat_failures_allowed (%d)\n", totem_config->heartbeat_failures_allowed); + "heartbeat_failures_allowed (%d)", totem_config->heartbeat_failures_allowed); log_printf (instance->totemsrp_log_level_debug, - "max_network_delay (%d ms)\n", totem_config->max_network_delay); + "max_network_delay (%d ms)", totem_config->max_network_delay); cs_queue_init (&instance->retrans_message_queue, RETRANS_MESSAGE_QUEUE_SIZE_MAX, @@ -904,7 +904,7 @@ int totemsrp_initialize ( if ( totem_config->heartbeat_failures_allowed == 0 ) { log_printf (instance->totemsrp_log_level_debug, - "HeartBeat is Disabled. To enable set heartbeat_failures_allowed > 0\n"); + "HeartBeat is Disabled. To enable set heartbeat_failures_allowed > 0"); instance->use_heartbeat = 0; } @@ -915,18 +915,18 @@ int totemsrp_initialize ( if (instance->heartbeat_timeout >= totem_config->token_timeout) { log_printf (instance->totemsrp_log_level_debug, - "total heartbeat_timeout (%d ms) is not less than token timeout (%d ms)\n", + "total heartbeat_timeout (%d ms) is not less than token timeout (%d ms)", instance->heartbeat_timeout, totem_config->token_timeout); log_printf (instance->totemsrp_log_level_debug, - "heartbeat_timeout = heartbeat_failures_allowed * token_retransmit_timeout + max_network_delay\n"); + "heartbeat_timeout = heartbeat_failures_allowed * token_retransmit_timeout + max_network_delay"); log_printf (instance->totemsrp_log_level_debug, - "heartbeat timeout should be less than the token timeout. HeartBeat is Diabled !!\n"); + "heartbeat timeout should be less than the token timeout. HeartBeat is Diabled !!"); instance->use_heartbeat = 0; } else { log_printf (instance->totemsrp_log_level_debug, - "total heartbeat_timeout (%d ms)\n", instance->heartbeat_timeout); + "total heartbeat_timeout (%d ms)", instance->heartbeat_timeout); } } @@ -1443,7 +1443,7 @@ static void old_ring_state_save (struct totemsrp_instance *instance) instance->old_ring_state_aru = instance->my_aru; instance->old_ring_state_high_seq_received = instance->my_high_seq_received; log_printf (instance->totemsrp_log_level_debug, - "Saving state aru %x high seq received %x\n", + "Saving state aru %x high seq received %x", instance->my_aru, instance->my_high_seq_received); } } @@ -1453,14 +1453,14 @@ static void old_ring_state_restore (struct totemsrp_instance *instance) instance->my_aru = instance->old_ring_state_aru; instance->my_high_seq_received = instance->old_ring_state_high_seq_received; log_printf (instance->totemsrp_log_level_debug, - "Restoring instance->my_aru %x my high seq received %x\n", + "Restoring instance->my_aru %x my high seq received %x", instance->my_aru, instance->my_high_seq_received); } static void old_ring_state_reset (struct totemsrp_instance *instance) { log_printf (instance->totemsrp_log_level_debug, - "Resetting old ring state\n"); + "Resetting old ring state"); instance->old_ring_state_saved = 0; } @@ -1581,9 +1581,9 @@ static void timer_function_orf_token_timeout (void *data) switch (instance->memb_state) { case MEMB_STATE_OPERATIONAL: log_printf (instance->totemsrp_log_level_debug, - "The token was lost in the OPERATIONAL state.\n"); + "The token was lost in the OPERATIONAL state."); log_printf (instance->totemsrp_log_level_notice, - "A processor failed, forming new configuration.\n"); + "A processor failed, forming new configuration."); totemrrp_iface_check (instance->totemrrp_context); memb_state_gather_enter (instance, 2); instance->stats.operational_token_lost++; @@ -1591,7 +1591,7 @@ static void timer_function_orf_token_timeout (void *data) case MEMB_STATE_GATHER: log_printf (instance->totemsrp_log_level_debug, - "The consensus timeout expired.\n"); + "The consensus timeout expired."); memb_state_consensus_timeout_expired (instance); memb_state_gather_enter (instance, 3); instance->stats.gather_token_lost++; @@ -1599,14 +1599,14 @@ static void timer_function_orf_token_timeout (void *data) case MEMB_STATE_COMMIT: log_printf (instance->totemsrp_log_level_debug, - "The token was lost in the COMMIT state.\n"); + "The token was lost in the COMMIT state."); memb_state_gather_enter (instance, 4); instance->stats.commit_token_lost++; break; case MEMB_STATE_RECOVERY: log_printf (instance->totemsrp_log_level_debug, - "The token was lost in the RECOVERY state.\n"); + "The token was lost in the RECOVERY state."); memb_recovery_state_token_loss (instance); instance->orf_token_discard = 1; break; @@ -1617,7 +1617,7 @@ static void timer_function_heartbeat_timeout (void *data) { struct totemsrp_instance *instance = data; log_printf (instance->totemsrp_log_level_debug, - "HeartBeat Timer expired Invoking token loss mechanism in state %d \n", instance->memb_state); + "HeartBeat Timer expired Invoking token loss mechanism in state %d ", instance->memb_state); timer_function_orf_token_timeout(data); } @@ -1666,7 +1666,7 @@ static void deliver_messages_from_recovery_to_regular (struct totemsrp_instance struct mcast *mcast; log_printf (instance->totemsrp_log_level_debug, - "recovery to regular %x-%x\n", SEQNO_START_MSG + 1, instance->my_aru); + "recovery to regular %x-%x", SEQNO_START_MSG + 1, instance->my_aru); range = instance->my_aru - SEQNO_START_MSG; /* @@ -1703,7 +1703,7 @@ static void deliver_messages_from_recovery_to_regular (struct totemsrp_instance } log_printf (instance->totemsrp_log_level_debug, - "comparing if ring id is for this processors old ring seqno %d\n", + "comparing if ring id is for this processors old ring seqno %d", mcast->seq); /* @@ -1724,7 +1724,7 @@ static void deliver_messages_from_recovery_to_regular (struct totemsrp_instance } } else { log_printf (instance->totemsrp_log_level_debug, - "-not adding msg with seq no %x\n", mcast->seq); + "-not adding msg with seq no %x", mcast->seq); } } } @@ -1751,7 +1751,7 @@ static void memb_state_operational_enter (struct totemsrp_instance *instance) deliver_messages_from_recovery_to_regular (instance); log_printf (instance->totemsrp_log_level_debug, - "Delivering to app %x to %x\n", + "Delivering to app %x to %x", instance->my_high_delivered + 1, instance->old_ring_state_high_seq_received); aru_save = instance->my_aru; @@ -1878,9 +1878,9 @@ static void memb_state_operational_enter (struct totemsrp_instance *instance) instance->last_released = instance->my_high_delivered; log_printf (instance->totemsrp_log_level_debug, - "entering OPERATIONAL state.\n"); + "entering OPERATIONAL state."); log_printf (instance->totemsrp_log_level_notice, - "A processor joined or left the membership and a new membership was formed.\n"); + "A processor joined or left the membership and a new membership was formed."); instance->memb_state = MEMB_STATE_OPERATIONAL; instance->stats.operational_entered++; @@ -1950,7 +1950,7 @@ static void memb_state_gather_enter ( memb_consensus_set (instance, &instance->my_id); log_printf (instance->totemsrp_log_level_debug, - "entering GATHER state from %d.\n", gather_from); + "entering GATHER state from %d.", gather_from); instance->memb_state = MEMB_STATE_GATHER; instance->stats.gather_entered++; @@ -1967,7 +1967,7 @@ static void memb_state_gather_enter ( "Totem is unable to form a cluster because of an " "operating system or network fault. The most common " "cause of this message is that the local firewall is " - "configured improperly.\n"); + "configured improperly."); } return; @@ -2006,7 +2006,7 @@ static void memb_state_commit_enter ( instance->token_ring_id_seq = instance->my_ring_id.seq; log_printf (instance->totemsrp_log_level_debug, - "entering COMMIT state.\n"); + "entering COMMIT state."); instance->memb_state = MEMB_STATE_COMMIT; reset_token_retransmit_timeout (instance); // REVIEWED @@ -2043,7 +2043,7 @@ static void memb_state_recovery_enter ( memb_list = (struct memb_commit_token_memb_entry *)(addr + commit_token->addr_entries); log_printf (instance->totemsrp_log_level_debug, - "entering RECOVERY state.\n"); + "entering RECOVERY state."); instance->orf_token_discard = 0; @@ -2085,18 +2085,18 @@ static void memb_state_recovery_enter ( for (i = 0; i < instance->my_trans_memb_entries; i++) { log_printf (instance->totemsrp_log_level_debug, - "TRANS [%d] member %s:\n", i, totemip_print (&instance->my_trans_memb_list[i].addr[0])); + "TRANS [%d] member %s:", i, totemip_print (&instance->my_trans_memb_list[i].addr[0])); } for (i = 0; i < instance->my_new_memb_entries; i++) { log_printf (instance->totemsrp_log_level_debug, - "position [%d] member %s:\n", i, totemip_print (&addr[i].addr[0])); + "position [%d] member %s:", i, totemip_print (&addr[i].addr[0])); log_printf (instance->totemsrp_log_level_debug, - "previous ring seq %llx rep %s\n", + "previous ring seq %llx rep %s", memb_list[i].ring_id.seq, totemip_print (&memb_list[i].ring_id.rep)); log_printf (instance->totemsrp_log_level_debug, - "aru %x high delivered %x received flag %d\n", + "aru %x high delivered %x received flag %d", memb_list[i].aru, memb_list[i].high_delivered, memb_list[i].received_flg); @@ -2157,7 +2157,7 @@ static void memb_state_recovery_enter ( assert (range < QUEUE_RTR_ITEMS_SIZE_MAX); log_printf (instance->totemsrp_log_level_debug, - "copying all old ring messages from %x-%x.\n", + "copying all old ring messages from %x-%x.", low_ring_aru + 1, instance->old_ring_state_high_seq_received); for (i = 1; i <= range; i++) { @@ -2192,12 +2192,12 @@ static void memb_state_recovery_enter ( cs_queue_item_add (&instance->retrans_message_queue, &message_item); } log_printf (instance->totemsrp_log_level_debug, - "Originated %d messages in RECOVERY.\n", messages_originated); + "Originated %d messages in RECOVERY.", messages_originated); goto originated; no_originate: log_printf (instance->totemsrp_log_level_debug, - "Did not need to originate any messages in recovery.\n"); + "Did not need to originate any messages in recovery."); originated: instance->my_aru = SEQNO_START_MSG; @@ -2239,7 +2239,7 @@ int totemsrp_mcast ( unsigned int addr_idx; if (cs_queue_is_full (&instance->new_message_queue)) { - log_printf (instance->totemsrp_log_level_debug, "queue full\n"); + log_printf (instance->totemsrp_log_level_debug, "queue full"); return (-1); } @@ -2275,7 +2275,7 @@ int totemsrp_mcast ( message_item.msg_len = addr_idx; - log_printf (instance->totemsrp_log_level_debug, "mcasted message added to pending queue\n"); + log_printf (instance->totemsrp_log_level_debug, "mcasted message added to pending queue"); instance->stats.mcast_tx++; cs_queue_item_add (&instance->new_message_queue, &message_item); @@ -2322,7 +2322,7 @@ static int orf_token_remcast ( res = sq_in_range (sort_queue, seq); if (res == 0) { - log_printf (instance->totemsrp_log_level_debug, "sq not in range\n"); + log_printf (instance->totemsrp_log_level_debug, "sq not in range"); return (-1); } @@ -2398,7 +2398,7 @@ static void messages_free ( if (log_release) { log_printf (instance->totemsrp_log_level_debug, - "releasing messages up to and including %x\n", release_to); + "releasing messages up to and including %x", release_to); } } @@ -2537,12 +2537,12 @@ static int orf_token_rtr ( strcpy (retransmit_msg, "Retransmit List: "); if (orf_token->rtr_list_entries) { log_printf (instance->totemsrp_log_level_debug, - "Retransmit List %d\n", orf_token->rtr_list_entries); + "Retransmit List %d", orf_token->rtr_list_entries); for (i = 0; i < orf_token->rtr_list_entries; i++) { sprintf (value, "%x ", rtr_list[i].seq); strcat (retransmit_msg, value); } - strcat (retransmit_msg, "\n"); + strcat (retransmit_msg, ""); log_printf (instance->totemsrp_log_level_notice, "%s", retransmit_msg); } @@ -2991,7 +2991,7 @@ static void memb_state_commit_token_create ( int token_memb_entries = 0; log_printf (instance->totemsrp_log_level_debug, - "Creating commit token because I am the rep.\n"); + "Creating commit token because I am the rep."); memb_set_subtract (token_memb, &token_memb_entries, instance->my_proc_list, instance->my_proc_list_entries, @@ -3089,7 +3089,7 @@ static void memb_leave_message_send (struct totemsrp_instance *instance) struct srp_addr active_memb[PROCESSOR_COUNT_MAX]; log_printf (instance->totemsrp_log_level_debug, - "sending join/leave message\n"); + "sending join/leave message"); /* * add us to the failed list, and remove us from @@ -3236,7 +3236,7 @@ static void memb_ring_id_set_and_store ( return; } log_printf (instance->totemsrp_log_level_debug, - "Storing new sequence id for ring %llx\n", instance->my_ring_id.seq); + "Storing new sequence id for ring %llx", instance->my_ring_id.seq); //assert (fd > 0); res = write (fd, &instance->my_ring_id.seq, sizeof (unsigned long long)); assert (res == sizeof (unsigned long long)); @@ -3449,7 +3449,7 @@ static int message_handler_orf_token ( tv_old = tv_current; log_printf (instance->totemsrp_log_level_debug, - "Time since last token %0.4f ms\n", ((float)tv_diff) / 1000000.0); + "Time since last token %0.4f ms", ((float)tv_diff) / 1000000.0); #endif if (instance->orf_token_discard) { @@ -3603,7 +3603,7 @@ printf ("token seq %d\n", token->seq); token->aru_addr == instance->my_id.addr[0].nodeid) { log_printf (instance->totemsrp_log_level_error, - "FAILED TO RECEIVE\n"); + "FAILED TO RECEIVE"); instance->failed_to_recv = 1; @@ -3634,7 +3634,7 @@ printf ("token seq %d\n", token->seq); instance->my_set_retrans_flg = 0; } log_printf (instance->totemsrp_log_level_debug, - "token retrans flag is %d my set retrans flag%d retrans queue empty %d count %d, aru %x\n", + "token retrans flag is %d my set retrans flag%d retrans queue empty %d count %d, aru %x", token->retrans_flg, instance->my_set_retrans_flg, cs_queue_is_empty (&instance->retrans_message_queue), instance->my_retrans_flg_count, token->aru); @@ -3647,7 +3647,7 @@ printf ("token seq %d\n", token->seq); instance->my_install_seq = token->seq; } log_printf (instance->totemsrp_log_level_debug, - "install seq %x aru %x high seq received %x\n", + "install seq %x aru %x high seq received %x", instance->my_install_seq, instance->my_aru, instance->my_high_seq_received); if (instance->my_retrans_flg_count >= 2 && instance->my_received_flg == 0 && @@ -3665,7 +3665,7 @@ printf ("token seq %d\n", token->seq); } if (instance->my_rotation_counter == 2) { log_printf (instance->totemsrp_log_level_debug, - "retrans flag count %x token aru %x install seq %x aru %x %x\n", + "retrans flag count %x token aru %x install seq %x aru %x %x", instance->my_retrans_flg_count, token->aru, instance->my_install_seq, instance->my_aru, token->seq); @@ -3683,7 +3683,7 @@ printf ("token seq %d\n", token->seq); tv_diff = tv_current - tv_old; tv_old = tv_current; log_printf (instance->totemsrp_log_level_debug, - "I held %0.4f ms\n", + "I held %0.4f ms", ((float)tv_diff) / 1000000.0); #endif if (instance->memb_state == MEMB_STATE_OPERATIONAL) { @@ -3738,7 +3738,7 @@ static void messages_deliver_to_app ( if (range) { log_printf (instance->totemsrp_log_level_debug, - "Delivering %x to %x\n", instance->my_high_delivered, + "Delivering %x to %x", instance->my_high_delivered, end_point); } assert (range < QUEUE_RTR_ITEMS_SIZE_MAX); @@ -3807,7 +3807,7 @@ static void messages_deliver_to_app ( * Message found */ log_printf (instance->totemsrp_log_level_debug, - "Delivering MCAST message with seq %x to pending delivery queue\n", + "Delivering MCAST message with seq %x to pending delivery queue", mcast_header.seq); /* @@ -3897,7 +3897,7 @@ static int message_handler_mcast ( } log_printf (instance->totemsrp_log_level_debug, - "Received ringid(%s:%lld) seq %x\n", + "Received ringid(%s:%lld) seq %x", totemip_print (&mcast_header.ring_id.rep), mcast_header.ring_id.seq, mcast_header.seq); @@ -4322,7 +4322,7 @@ static int message_handler_memb_commit_token ( struct srp_addr *addr; log_printf (instance->totemsrp_log_level_debug, - "got commit token\n"); + "got commit token"); if (endian_conversion_needed) { memb_commit_token_endian_convert (msg, memb_commit_token_convert); @@ -4375,7 +4375,7 @@ static int message_handler_memb_commit_token ( case MEMB_STATE_RECOVERY: if (totemip_equal (&instance->my_id.addr[0], &instance->my_ring_id.rep)) { log_printf (instance->totemsrp_log_level_debug, - "Sending initial ORF token\n"); + "Sending initial ORF token"); // TODO convert instead of initiate orf_token_send_initial (instance); @@ -4416,7 +4416,7 @@ void main_deliver_fn ( if (msg_len < sizeof (struct message_header)) { log_printf (instance->totemsrp_log_level_security, - "Received message is too short... ignoring %u.\n", + "Received message is too short... ignoring %u.", (unsigned int)msg_len); return; } @@ -4473,7 +4473,7 @@ void main_iface_change_fn ( memb_ring_id_create_or_load (instance, &instance->my_ring_id); log_printf ( instance->totemsrp_log_level_debug, - "Created or loaded sequence id %llx.%s for this ring.\n", + "Created or loaded sequence id %llx.%s for this ring.", instance->my_ring_id.seq, totemip_print (&instance->my_ring_id.rep)); diff --git a/exec/totemudp.c b/exec/totemudp.c index c44429e..2880008 100644 --- a/exec/totemudp.c +++ b/exec/totemudp.c @@ -258,7 +258,7 @@ do { \ instance->totemudp_log_printf ( \ level, instance->totemudp_subsys_id, \ __FUNCTION__, __FILE__, __LINE__, \ - fmt ": %s (%d)\n", ##args, _error_ptr, err_num); \ + fmt ": %s (%d)", ##args, _error_ptr, err_num); \ } while(0) @@ -327,7 +327,7 @@ static void init_sober_crypto( struct totemudp_instance *instance) { log_printf(instance->totemudp_log_level_notice, - "Initializing transmit/receive security: libtomcrypt SOBER128/SHA1HMAC (mode 0).\n"); + "Initializing transmit/receive security: libtomcrypt SOBER128/SHA1HMAC (mode 0)."); rng_make_prng (128, PRNG_SOBER, &instance->totemudp_prng_state, NULL); } @@ -393,11 +393,11 @@ static void init_nss_crypto( SECStatus rv; log_printf(instance->totemudp_log_level_notice, - "Initializing transmit/receive security: NSS AES128CBC/SHA1HMAC (mode 1).\n"); + "Initializing transmit/receive security: NSS AES128CBC/SHA1HMAC (mode 1)."); rv = NSS_NoDB_Init("."); if (rv != SECSuccess) { - log_printf(instance->totemudp_log_level_security, "NSS initialization failed (err %d)\n", + log_printf(instance->totemudp_log_level_security, "NSS initialization failed (err %d)", PR_GetError()); goto out; } @@ -405,7 +405,7 @@ static void init_nss_crypto( aes_slot = PK11_GetBestSlot(instance->totem_config->crypto_crypt_type, NULL); if (aes_slot == NULL) { - log_printf(instance->totemudp_log_level_security, "Unable to find security slot (err %d)\n", + log_printf(instance->totemudp_log_level_security, "Unable to find security slot (err %d)", PR_GetError()); goto out; } @@ -413,7 +413,7 @@ static void init_nss_crypto( sha1_slot = PK11_GetBestSlot(CKM_SHA_1_HMAC, NULL); if (sha1_slot == NULL) { - log_printf(instance->totemudp_log_level_security, "Unable to find security slot (err %d)\n", + log_printf(instance->totemudp_log_level_security, "Unable to find security slot (err %d)", PR_GetError()); goto out; } @@ -430,7 +430,7 @@ static void init_nss_crypto( &key_item, NULL); if (instance->nss_sym_key == NULL) { - log_printf(instance->totemudp_log_level_security, "Failure to import key into NSS (err %d)\n", + log_printf(instance->totemudp_log_level_security, "Failure to import key into NSS (err %d)", PR_GetError()); goto out; } @@ -440,7 +440,7 @@ static void init_nss_crypto( PK11_OriginUnwrap, CKA_SIGN, &key_item, NULL); if (instance->nss_sym_key_sign == NULL) { - log_printf(instance->totemudp_log_level_security, "Failure to import key into NSS (err %d)\n", + log_printf(instance->totemudp_log_level_security, "Failure to import key into NSS (err %d)", PR_GetError()); goto out; } @@ -477,7 +477,7 @@ static int encrypt_and_sign_nss ( tmp1_outlen = tmp2_outlen = 0; inbuf = copy_from_iovec(iovec, iov_len, &datalen); if (!inbuf) { - log_printf(instance->totemudp_log_level_security, "malloc error copying buffer from iovec\n"); + log_printf(instance->totemudp_log_level_security, "malloc error copying buffer from iovec"); return -1; } @@ -492,7 +492,7 @@ static int encrypt_and_sign_nss ( sizeof (nss_iv_data)); if (rv != SECSuccess) { log_printf(instance->totemudp_log_level_security, - "Failure to generate a random number %d\n", + "Failure to generate a random number %d", PR_GetError()); } @@ -506,7 +506,7 @@ static int encrypt_and_sign_nss ( &iv_item); if (nss_sec_param == NULL) { log_printf(instance->totemudp_log_level_security, - "Failure to set up PKCS11 param (err %d)\n", + "Failure to set up PKCS11 param (err %d)", PR_GetError()); free (inbuf); return (-1); @@ -525,7 +525,7 @@ static int encrypt_and_sign_nss ( PR_GetErrorText(err); err[PR_GetErrorTextLength()] = 0; log_printf(instance->totemudp_log_level_security, - "PK11_CreateContext failed (encrypt) crypt_type=%d (err %d): %s\n", + "PK11_CreateContext failed (encrypt) crypt_type=%d (err %d): %s", instance->totem_config->crypto_crypt_type, PR_GetError(), err); free(inbuf); @@ -552,7 +552,7 @@ static int encrypt_and_sign_nss ( char err[1024]; PR_GetErrorText(err); err[PR_GetErrorTextLength()] = 0; - log_printf(instance->totemudp_log_level_security, "encrypt: PK11_CreateContext failed (digest) err %d: %s\n", + log_printf(instance->totemudp_log_level_security, "encrypt: PK11_CreateContext failed (digest) err %d: %s", PR_GetError(), err); return -1; } @@ -606,7 +606,7 @@ static int authenticate_and_decrypt_nss ( if (iov_len > 1) { inbuf = copy_from_iovec(iov, iov_len, &datalen); if (!inbuf) { - log_printf(instance->totemudp_log_level_security, "malloc error copying buffer from iovec\n"); + log_printf(instance->totemudp_log_level_security, "malloc error copying buffer from iovec"); return -1; } } @@ -628,7 +628,7 @@ static int authenticate_and_decrypt_nss ( char err[1024]; PR_GetErrorText(err); err[PR_GetErrorTextLength()] = 0; - log_printf(instance->totemudp_log_level_security, "PK11_CreateContext failed (check digest) err %d: %s\n", + log_printf(instance->totemudp_log_level_security, "PK11_CreateContext failed (check digest) err %d: %s", PR_GetError(), err); free (inbuf); return -1; @@ -642,12 +642,12 @@ static int authenticate_and_decrypt_nss ( PK11_DestroyContext(enc_context, PR_TRUE); if (rv1 != SECSuccess || rv2 != SECSuccess) { - log_printf(instance->totemudp_log_level_security, "Digest check failed\n"); + log_printf(instance->totemudp_log_level_security, "Digest check failed"); return -1; } if (memcmp(digest, header->hash_digest, tmp2_outlen) != 0) { - log_printf(instance->totemudp_log_level_error, "Digest does not match\n"); + log_printf(instance->totemudp_log_level_error, "Digest does not match"); return -1; } @@ -668,7 +668,7 @@ static int authenticate_and_decrypt_nss ( instance->nss_sym_key, &ivdata); if (!enc_context) { log_printf(instance->totemudp_log_level_security, - "PK11_CreateContext (decrypt) failed (err %d)\n", + "PK11_CreateContext (decrypt) failed (err %d)", PR_GetError()); return -1; } @@ -678,7 +678,7 @@ static int authenticate_and_decrypt_nss ( data, datalen); if (rv1 != SECSuccess) { log_printf(instance->totemudp_log_level_security, - "PK11_CipherOp (decrypt) failed (err %d)\n", + "PK11_CipherOp (decrypt) failed (err %d)", PR_GetError()); } rv2 = PK11_DigestFinal(enc_context, outdata + tmp1_outlen, &tmp2_outlen, @@ -1132,7 +1132,7 @@ static int net_deliver_fn ( if ((instance->totem_config->secauth == 1) && (bytes_received < sizeof (struct security_header))) { - log_printf (instance->totemudp_log_level_security, "Received message is too short... ignoring %d.\n", bytes_received); + log_printf (instance->totemudp_log_level_security, "Received message is too short... ignoring %d.", bytes_received); return (0); } @@ -1144,9 +1144,9 @@ static int net_deliver_fn ( res = authenticate_and_decrypt (instance, iovec, 1); if (res == -1) { - log_printf (instance->totemudp_log_level_security, "Received message has invalid digest... ignoring.\n"); + log_printf (instance->totemudp_log_level_security, "Received message has invalid digest... ignoring."); log_printf (instance->totemudp_log_level_security, - "Invalid packet data\n"); + "Invalid packet data"); iovec->iov_len = FRAME_SIZE_MAX; return 0; } @@ -1307,7 +1307,7 @@ static void timer_function_netif_check_timeout ( if (instance->netif_bind_state == BIND_STATE_REGULAR) { if (instance->netif_state_report & NETIF_STATE_REPORT_UP) { log_printf (instance->totemudp_log_level_notice, - "The network interface [%s] is now up.\n", + "The network interface [%s] is now up.", totemip_print (&instance->totem_interface->boundto)); instance->netif_state_report = NETIF_STATE_REPORT_DOWN; instance->totemudp_iface_change_fn (instance->context, &instance->my_id); @@ -1327,7 +1327,7 @@ static void timer_function_netif_check_timeout ( } else { if (instance->netif_state_report & NETIF_STATE_REPORT_DOWN) { log_printf (instance->totemudp_log_level_notice, - "The network interface is down.\n"); + "The network interface is down."); instance->totemudp_iface_change_fn (instance->context, &instance->my_id); } instance->netif_state_report = NETIF_STATE_REPORT_UP; @@ -1498,13 +1498,13 @@ static int totemudp_build_sockets_ip ( res = getsockopt (sockets->mcast_recv, SOL_SOCKET, SO_RCVBUF, &recvbuf_size, &optlen); if (res == 0) { log_printf (instance->totemudp_log_level_debug, - "Receive multicast socket recv buffer size (%d bytes).\n", recvbuf_size); + "Receive multicast socket recv buffer size (%d bytes).", recvbuf_size); } res = getsockopt (sockets->mcast_send, SOL_SOCKET, SO_SNDBUF, &sendbuf_size, &optlen); if (res == 0) { log_printf (instance->totemudp_log_level_debug, - "Transmit multicast socket send buffer size (%d bytes).\n", sendbuf_size); + "Transmit multicast socket send buffer size (%d bytes).", sendbuf_size); } /* diff --git a/exec/totemudpu.c b/exec/totemudpu.c index 32c595b..2af0533 100644 --- a/exec/totemudpu.c +++ b/exec/totemudpu.c @@ -101,7 +101,7 @@ struct totemudpu_member { struct totem_ip_address member; int fd; }; - + struct totemudpu_instance { hmac_state totemudpu_hmac_state; @@ -241,7 +241,7 @@ do { \ instance->totemudpu_log_printf ( \ level, instance->totemudpu_subsys_id, \ __FUNCTION__, __FILE__, __LINE__, \ - fmt ": %s (%d)\n", ##args, _error_ptr, err_num); \ + fmt ": %s (%d)", ##args, _error_ptr, err_num); \ } while(0) static int authenticate_and_decrypt_sober ( @@ -309,7 +309,7 @@ static void init_sober_crypto( struct totemudpu_instance *instance) { log_printf(instance->totemudpu_log_level_notice, - "Initializing transmit/receive security: libtomcrypt SOBER128/SHA1HMAC (mode 0).\n"); + "Initializing transmit/receive security: libtomcrypt SOBER128/SHA1HMAC (mode 0)."); rng_make_prng (128, PRNG_SOBER, &instance->totemudpu_prng_state, NULL); } @@ -375,11 +375,11 @@ static void init_nss_crypto( SECStatus rv; log_printf(instance->totemudpu_log_level_notice, - "Initializing transmit/receive security: NSS AES128CBC/SHA1HMAC (mode 1).\n"); + "Initializing transmit/receive security: NSS AES128CBC/SHA1HMAC (mode 1)."); rv = NSS_NoDB_Init("."); if (rv != SECSuccess) { - log_printf(instance->totemudpu_log_level_security, "NSS initialization failed (err %d)\n", + log_printf(instance->totemudpu_log_level_security, "NSS initialization failed (err %d)", PR_GetError()); goto out; } @@ -387,7 +387,7 @@ static void init_nss_crypto( aes_slot = PK11_GetBestSlot(instance->totem_config->crypto_crypt_type, NULL); if (aes_slot == NULL) { - log_printf(instance->totemudpu_log_level_security, "Unable to find security slot (err %d)\n", + log_printf(instance->totemudpu_log_level_security, "Unable to find security slot (err %d)", PR_GetError()); goto out; } @@ -395,7 +395,7 @@ static void init_nss_crypto( sha1_slot = PK11_GetBestSlot(CKM_SHA_1_HMAC, NULL); if (sha1_slot == NULL) { - log_printf(instance->totemudpu_log_level_security, "Unable to find security slot (err %d)\n", + log_printf(instance->totemudpu_log_level_security, "Unable to find security slot (err %d)", PR_GetError()); goto out; } @@ -412,7 +412,7 @@ static void init_nss_crypto( &key_item, NULL); if (instance->nss_sym_key == NULL) { - log_printf(instance->totemudpu_log_level_security, "Failure to import key into NSS (err %d)\n", + log_printf(instance->totemudpu_log_level_security, "Failure to import key into NSS (err %d)", PR_GetError()); goto out; } @@ -422,7 +422,7 @@ static void init_nss_crypto( PK11_OriginUnwrap, CKA_SIGN, &key_item, NULL); if (instance->nss_sym_key_sign == NULL) { - log_printf(instance->totemudpu_log_level_security, "Failure to import key into NSS (err %d)\n", + log_printf(instance->totemudpu_log_level_security, "Failure to import key into NSS (err %d)", PR_GetError()); goto out; } @@ -459,7 +459,7 @@ static int encrypt_and_sign_nss ( tmp1_outlen = tmp2_outlen = 0; inbuf = copy_from_iovec(iovec, iov_len, &datalen); if (!inbuf) { - log_printf(instance->totemudpu_log_level_security, "malloc error copying buffer from iovec\n"); + log_printf(instance->totemudpu_log_level_security, "malloc error copying buffer from iovec"); return -1; } @@ -474,7 +474,7 @@ static int encrypt_and_sign_nss ( sizeof (nss_iv_data)); if (rv != SECSuccess) { log_printf(instance->totemudpu_log_level_security, - "Failure to generate a random number %d\n", + "Failure to generate a random number %d", PR_GetError()); } @@ -488,7 +488,7 @@ static int encrypt_and_sign_nss ( &iv_item); if (nss_sec_param == NULL) { log_printf(instance->totemudpu_log_level_security, - "Failure to set up PKCS11 param (err %d)\n", + "Failure to set up PKCS11 param (err %d)", PR_GetError()); free (inbuf); return (-1); @@ -507,7 +507,7 @@ static int encrypt_and_sign_nss ( PR_GetErrorText(err); err[PR_GetErrorTextLength()] = 0; log_printf(instance->totemudpu_log_level_security, - "PK11_CreateContext failed (encrypt) crypt_type=%d (err %d): %s\n", + "PK11_CreateContext failed (encrypt) crypt_type=%d (err %d): %s", instance->totem_config->crypto_crypt_type, PR_GetError(), err); free(inbuf); @@ -534,7 +534,7 @@ static int encrypt_and_sign_nss ( char err[1024]; PR_GetErrorText(err); err[PR_GetErrorTextLength()] = 0; - log_printf(instance->totemudpu_log_level_security, "encrypt: PK11_CreateContext failed (digest) err %d: %s\n", + log_printf(instance->totemudpu_log_level_security, "encrypt: PK11_CreateContext failed (digest) err %d: %s", PR_GetError(), err); return -1; } @@ -588,7 +588,7 @@ static int authenticate_and_decrypt_nss ( if (iov_len > 1) { inbuf = copy_from_iovec(iov, iov_len, &datalen); if (!inbuf) { - log_printf(instance->totemudpu_log_level_security, "malloc error copying buffer from iovec\n"); + log_printf(instance->totemudpu_log_level_security, "malloc error copying buffer from iovec"); return -1; } } @@ -610,7 +610,7 @@ static int authenticate_and_decrypt_nss ( char err[1024]; PR_GetErrorText(err); err[PR_GetErrorTextLength()] = 0; - log_printf(instance->totemudpu_log_level_security, "PK11_CreateContext failed (check digest) err %d: %s\n", + log_printf(instance->totemudpu_log_level_security, "PK11_CreateContext failed (check digest) err %d: %s", PR_GetError(), err); free (inbuf); return -1; @@ -624,12 +624,12 @@ static int authenticate_and_decrypt_nss ( PK11_DestroyContext(enc_context, PR_TRUE); if (rv1 != SECSuccess || rv2 != SECSuccess) { - log_printf(instance->totemudpu_log_level_security, "Digest check failed\n"); + log_printf(instance->totemudpu_log_level_security, "Digest check failed"); return -1; } if (memcmp(digest, header->hash_digest, tmp2_outlen) != 0) { - log_printf(instance->totemudpu_log_level_error, "Digest does not match\n"); + log_printf(instance->totemudpu_log_level_error, "Digest does not match"); return -1; } @@ -650,7 +650,7 @@ static int authenticate_and_decrypt_nss ( instance->nss_sym_key, &ivdata); if (!enc_context) { log_printf(instance->totemudpu_log_level_security, - "PK11_CreateContext (decrypt) failed (err %d)\n", + "PK11_CreateContext (decrypt) failed (err %d)", PR_GetError()); return -1; } @@ -660,7 +660,7 @@ static int authenticate_and_decrypt_nss ( data, datalen); if (rv1 != SECSuccess) { log_printf(instance->totemudpu_log_level_security, - "PK11_CipherOp (decrypt) failed (err %d)\n", + "PK11_CipherOp (decrypt) failed (err %d)", PR_GetError()); } rv2 = PK11_DigestFinal(enc_context, outdata + tmp1_outlen, &tmp2_outlen, @@ -1104,7 +1104,7 @@ static int net_deliver_fn ( if ((instance->totem_config->secauth == 1) && (bytes_received < sizeof (struct security_header))) { - log_printf (instance->totemudpu_log_level_security, "Received message is too short... ignoring %d.\n", bytes_received); + log_printf (instance->totemudpu_log_level_security, "Received message is too short... ignoring %d.", bytes_received); return (0); } @@ -1116,9 +1116,9 @@ static int net_deliver_fn ( res = authenticate_and_decrypt (instance, iovec, 1); if (res == -1) { - log_printf (instance->totemudpu_log_level_security, "Received message has invalid digest... ignoring.\n"); + log_printf (instance->totemudpu_log_level_security, "Received message has invalid digest... ignoring."); log_printf (instance->totemudpu_log_level_security, - "Invalid packet data\n"); + "Invalid packet data"); iovec->iov_len = FRAME_SIZE_MAX; return 0; } @@ -1252,7 +1252,7 @@ static void timer_function_netif_check_timeout ( if (instance->netif_bind_state == BIND_STATE_REGULAR) { if (instance->netif_state_report & NETIF_STATE_REPORT_UP) { log_printf (instance->totemudpu_log_level_notice, - "The network interface [%s] is now up.\n", + "The network interface [%s] is now up.", totemip_print (&instance->totem_interface->boundto)); instance->netif_state_report = NETIF_STATE_REPORT_DOWN; instance->totemudpu_iface_change_fn (instance->context, &instance->my_id); @@ -1272,7 +1272,7 @@ static void timer_function_netif_check_timeout ( } else { if (instance->netif_state_report & NETIF_STATE_REPORT_DOWN) { log_printf (instance->totemudpu_log_level_notice, - "The network interface is down.\n"); + "The network interface is down."); instance->totemudpu_iface_change_fn (instance->context, &instance->my_id); } instance->netif_state_report = NETIF_STATE_REPORT_UP; @@ -1676,7 +1676,7 @@ int totemudpu_member_add ( if (new_member == NULL) { return (-1); } - log_printf (LOGSYS_LEVEL_NOTICE, "adding new UDPU member {%s}\n", + log_printf (LOGSYS_LEVEL_NOTICE, "adding new UDPU member {%s}", totemip_print(member)); list_init (&new_member->list); list_add_tail (&new_member->list, &instance->member_list); @@ -1732,12 +1732,12 @@ int totemudpu_member_remove ( if (totemip_compare (token_target, &member->member)==0) { log_printf(LOGSYS_LEVEL_NOTICE, - "removing UDPU member {%s}\n", + "removing UDPU member {%s}", totemip_print(&member->member)); if (member->fd > 0) { log_printf(LOGSYS_LEVEL_DEBUG, - "Closing socket to: {%s}\n", + "Closing socket to: {%s}", totemip_print(&member->member)); qb_loop_poll_del (instance->totemudpu_poll_handle, member->fd); diff --git a/exec/util.c b/exec/util.c index 540036e..240dd28 100644 --- a/exec/util.c +++ b/exec/util.c @@ -145,7 +145,7 @@ void _corosync_exit_error ( "Corosync Cluster Engine exiting normally"); } else { log_printf (LOGSYS_LEVEL_ERROR, "Corosync Cluster Engine exiting " - "with status %d at %s:%u.\n", err, file, line); + "with status %d at %s:%u.", err, file, line); } logsys_system_fini (); exit (err); diff --git a/exec/votequorum.c b/exec/votequorum.c index 741f8ae..2b0f132 100644 --- a/exec/votequorum.c +++ b/exec/votequorum.c @@ -461,7 +461,7 @@ static void get_lowest_node_id(void) lowest_node_id = node->node_id; } } - log_printf(LOGSYS_LEVEL_DEBUG, "lowest node id: %d us: %d\n", lowest_node_id, us->node_id); + log_printf(LOGSYS_LEVEL_DEBUG, "lowest node id: %d us: %d", lowest_node_id, us->node_id); LEAVE(); } @@ -505,7 +505,7 @@ static int calculate_quorum(int allow_decrease, unsigned int max_expected, unsig list_iterate(nodelist, &cluster_members_list) { node = list_entry(nodelist, struct cluster_node, list); - log_printf(LOGSYS_LEVEL_DEBUG, "node %u state=%d, votes=%u, expected=%u\n", + log_printf(LOGSYS_LEVEL_DEBUG, "node %u state=%d, votes=%u, expected=%u", node->node_id, node->state, node->votes, node->expected_votes); if (node->state == NODESTATE_MEMBER) { @@ -577,7 +577,7 @@ static void are_we_quorate(unsigned int total_votes) if (total_votes != us->expected_votes) { log_printf(LOGSYS_LEVEL_NOTICE, "Waiting for all cluster members. " - "Current votes: %d expected_votes: %d\n", + "Current votes: %d expected_votes: %d", total_votes, us->expected_votes); cluster_is_quorate = 0; return; @@ -600,11 +600,11 @@ static void are_we_quorate(unsigned int total_votes) if (cluster_is_quorate && !quorate) { quorum_change = 1; - log_printf(LOGSYS_LEVEL_DEBUG, "quorum lost, blocking activity\n"); + log_printf(LOGSYS_LEVEL_DEBUG, "quorum lost, blocking activity"); } if (!cluster_is_quorate && quorate) { quorum_change = 1; - log_printf(LOGSYS_LEVEL_DEBUG, "quorum regained, resuming activity\n"); + log_printf(LOGSYS_LEVEL_DEBUG, "quorum regained, resuming activity"); } cluster_is_quorate = quorate; @@ -648,7 +648,7 @@ static void recalculate_quorum(int allow_decrease, int by_current_nodes) /* * Keep expected_votes at the highest number of votes in the cluster */ - log_printf(LOGSYS_LEVEL_DEBUG, "total_votes=%d, expected_votes=%d\n", total_votes, us->expected_votes); + log_printf(LOGSYS_LEVEL_DEBUG, "total_votes=%d, expected_votes=%d", total_votes, us->expected_votes); if (total_votes > us->expected_votes) { us->expected_votes = total_votes; votequorum_exec_send_expectedvotes_notification(); @@ -699,7 +699,7 @@ static void votequorum_readconfig_dynamic(void) ENTER(); - log_printf(LOGSYS_LEVEL_DEBUG, "Reading configuration\n"); + log_printf(LOGSYS_LEVEL_DEBUG, "Reading configuration"); /* * TODO: add votequorum_parse_nodelist(); @@ -729,7 +729,7 @@ static void votequorum_readconfig_dynamic(void) } if (two_node && cluster_members > 2) { - log_printf(LOGSYS_LEVEL_WARNING, "quorum.two_node was set but there are more than 2 nodes in the cluster. It will be ignored.\n"); + log_printf(LOGSYS_LEVEL_WARNING, "quorum.two_node was set but there are more than 2 nodes in the cluster. It will be ignored."); two_node = 0; } @@ -921,7 +921,7 @@ static void votequorum_exec_send_expectedvotes_notification(void) ENTER(); - log_printf(LOGSYS_LEVEL_DEBUG, "Sending expected votes callback\n"); + log_printf(LOGSYS_LEVEL_DEBUG, "Sending expected votes callback"); res_lib_votequorum_expectedvotes_notification.header.id = MESSAGE_RES_VOTEQUORUM_EXPECTEDVOTES_NOTIFICATION; res_lib_votequorum_expectedvotes_notification.header.size = sizeof(res_lib_votequorum_expectedvotes_notification); @@ -964,7 +964,7 @@ static void message_handler_req_exec_votequorum_nodeinfo ( ENTER(); - log_printf(LOGSYS_LEVEL_DEBUG, "got nodeinfo message from cluster node %u\n", nodeid); + log_printf(LOGSYS_LEVEL_DEBUG, "got nodeinfo message from cluster node %u", nodeid); /* * TODO: add version checking for onwire compat @@ -990,7 +990,7 @@ static void message_handler_req_exec_votequorum_nodeinfo ( node->expected_votes = req_exec_quorum_nodeinfo->expected_votes; node->state = NODESTATE_MEMBER; - log_printf(LOGSYS_LEVEL_DEBUG, "nodeinfo message: votes: %d, expected: %d wfa: %d quorate: %d\n", + log_printf(LOGSYS_LEVEL_DEBUG, "nodeinfo message: votes: %d, expected: %d wfa: %d quorate: %d", req_exec_quorum_nodeinfo->votes, req_exec_quorum_nodeinfo->expected_votes, req_exec_quorum_nodeinfo->wait_for_all_status, @@ -1051,7 +1051,7 @@ static void message_handler_req_exec_votequorum_reconfigure ( ENTER(); - log_printf(LOGSYS_LEVEL_DEBUG, "got reconfigure message from cluster node %u\n", nodeid); + log_printf(LOGSYS_LEVEL_DEBUG, "got reconfigure message from cluster node %u", nodeid); /* * TODO: add version checking for onwire compat @@ -1286,7 +1286,7 @@ static void quorum_device_timer_fn(void *arg) if ((quorum_device->last_hello / QB_TIME_NS_IN_SEC) + quorumdev_poll/1000 < (qb_util_nano_current_get () / QB_TIME_NS_IN_SEC)) { quorum_device->state = NODESTATE_DEAD; - log_printf(LOGSYS_LEVEL_INFO, "lost contact with quorum device\n"); + log_printf(LOGSYS_LEVEL_INFO, "lost contact with quorum device"); recalculate_quorum(0, 0); } else { corosync_api->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device, @@ -1312,7 +1312,7 @@ static void message_handler_req_lib_votequorum_getinfo (void *conn, const void * ENTER(); - log_printf(LOGSYS_LEVEL_DEBUG, "got getinfo request on %p for node %u\n", conn, req_lib_votequorum_getinfo->nodeid); + log_printf(LOGSYS_LEVEL_DEBUG, "got getinfo request on %p for node %u", conn, req_lib_votequorum_getinfo->nodeid); node = find_node_by_nodeid(req_lib_votequorum_getinfo->nodeid); if (node) { @@ -1365,7 +1365,7 @@ static void message_handler_req_lib_votequorum_getinfo (void *conn, const void * res_lib_votequorum_getinfo.header.id = MESSAGE_RES_VOTEQUORUM_GETINFO; res_lib_votequorum_getinfo.header.error = error; corosync_api->ipc_response_send(conn, &res_lib_votequorum_getinfo, sizeof(res_lib_votequorum_getinfo)); - log_printf(LOGSYS_LEVEL_DEBUG, "getinfo response error: %d\n", error); + log_printf(LOGSYS_LEVEL_DEBUG, "getinfo response error: %d", error); LEAVE(); } @@ -1467,7 +1467,7 @@ static void message_handler_req_lib_votequorum_trackstart (void *conn, */ if (req_lib_votequorum_trackstart->track_flags & CS_TRACK_CURRENT || req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES) { - log_printf(LOGSYS_LEVEL_DEBUG, "sending initial status to %p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "sending initial status to %p", conn); votequorum_exec_send_quorum_notification(conn, req_lib_votequorum_trackstart->context); } @@ -1623,7 +1623,7 @@ static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn, ENTER(); if (quorum_device) { - log_printf(LOGSYS_LEVEL_DEBUG, "got qdisk_getinfo state %d\n", quorum_device->state); + log_printf(LOGSYS_LEVEL_DEBUG, "got qdisk_getinfo state %d", quorum_device->state); res_lib_votequorum_qdisk_getinfo.votes = quorum_device->votes; if (quorum_device->state == NODESTATE_MEMBER) { res_lib_votequorum_qdisk_getinfo.state = 1; diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c index 429be6d..3a835b4 100644 --- a/exec/vsf_quorum.c +++ b/exec/vsf_quorum.c @@ -145,9 +145,9 @@ static void quorum_api_set_quorum(const unsigned int *view_list, primary_designated = quorum; if (primary_designated && !old_quorum) { - log_printf (LOGSYS_LEVEL_NOTICE, "This node is within the primary component and will provide service.\n"); + log_printf (LOGSYS_LEVEL_NOTICE, "This node is within the primary component and will provide service."); } else if (!primary_designated && old_quorum) { - log_printf (LOGSYS_LEVEL_NOTICE, "This node is within the non-primary component and will NOT provide any services.\n"); + log_printf (LOGSYS_LEVEL_NOTICE, "This node is within the non-primary component and will NOT provide any services."); } quorum_view_list_entries = view_list_entries; @@ -273,7 +273,7 @@ static int quorum_exec_init_fn (struct corosync_api_v1 *api) */ if (icmap_get_string("quorum.provider", &quorum_module) == CS_OK) { log_printf (LOGSYS_LEVEL_NOTICE, - "Using quorum provider %s\n", quorum_module); + "Using quorum provider %s", quorum_module); if (strcmp (quorum_module, "corosync_votequorum") == 0) { if (votequorum_init (api, quorum_api_set_quorum) == CS_OK) { @@ -308,7 +308,7 @@ static int quorum_lib_init_fn (void *conn) { struct quorum_pd *pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); - log_printf(LOGSYS_LEVEL_DEBUG, "lib_init_fn: conn=%p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "lib_init_fn: conn=%p", conn); list_init (&pd->list); pd->conn = conn; @@ -320,7 +320,7 @@ static int quorum_lib_exit_fn (void *conn) { struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); - log_printf(LOGSYS_LEVEL_DEBUG, "lib_exit_fn: conn=%p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "lib_exit_fn: conn=%p", conn); if (quorum_pd->tracking_enabled) { list_del (&quorum_pd->list); @@ -351,7 +351,7 @@ static void send_library_notification(void *conn) struct list_head *tmp; int i; - log_printf(LOGSYS_LEVEL_DEBUG, "sending quorum notification to %p, length = %d\n", conn, size); + log_printf(LOGSYS_LEVEL_DEBUG, "sending quorum notification to %p, length = %d", conn, size); res_lib_quorum_notification->quorate = primary_designated; res_lib_quorum_notification->ring_seq = quorum_ring_id.seq; @@ -387,7 +387,7 @@ static void message_handler_req_lib_quorum_getquorate (void *conn, { struct res_lib_quorum_getquorate res_lib_quorum_getquorate; - log_printf(LOGSYS_LEVEL_DEBUG, "got quorate request on %p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "got quorate request on %p", conn); /* send status */ res_lib_quorum_getquorate.quorate = primary_designated; @@ -404,7 +404,7 @@ static void message_handler_req_lib_quorum_trackstart (void *conn, struct qb_ipc_response_header res; struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); - log_printf(LOGSYS_LEVEL_DEBUG, "got trackstart request on %p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "got trackstart request on %p", conn); /* * If an immediate listing of the current cluster membership @@ -412,7 +412,7 @@ static void message_handler_req_lib_quorum_trackstart (void *conn, */ if (req_lib_quorum_trackstart->track_flags & CS_TRACK_CURRENT || req_lib_quorum_trackstart->track_flags & CS_TRACK_CHANGES) { - log_printf(LOGSYS_LEVEL_DEBUG, "sending initial status to %p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "sending initial status to %p", conn); send_library_notification(conn); } @@ -440,7 +440,7 @@ static void message_handler_req_lib_quorum_trackstop (void *conn, const void *ms struct qb_ipc_response_header res; struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); - log_printf(LOGSYS_LEVEL_DEBUG, "got trackstop request on %p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "got trackstop request on %p", conn); if (quorum_pd->tracking_enabled) { res.error = CS_OK; @@ -463,7 +463,7 @@ static void message_handler_req_lib_quorum_gettype (void *conn, { struct res_lib_quorum_gettype res_lib_quorum_gettype; - log_printf(LOGSYS_LEVEL_DEBUG, "got quorum_type request on %p\n", conn); + log_printf(LOGSYS_LEVEL_DEBUG, "got quorum_type request on %p", conn); /* send status */ res_lib_quorum_gettype.quorum_type = quorum_type; diff --git a/exec/vsf_ykd.c b/exec/vsf_ykd.c index e021ad1..1b8a1b0 100644 --- a/exec/vsf_ykd.c +++ b/exec/vsf_ykd.c @@ -353,7 +353,7 @@ static void ykd_deliver_fn ( #ifdef TODO if (totemip_localhost_check (source_addr)) { log_printf (LOGSYS_LEVEL_NOTICE, - "This processor is within the primary component.\n"); + "This processor is within the primary component."); primary_designated = 1; ykd_primary_callback_fn ( @@ -435,7 +435,7 @@ static void ykd_deliver_fn ( case YKD_MODE_ATTEMPT: if (all_received) { log_printf (LOGSYS_LEVEL_NOTICE, - "This processor is within the primary component.\n"); + "This processor is within the primary component."); ykd_primary_designated = 1; ykd_primary_callback_fn ( diff --git a/exec/wd.c b/exec/wd.c index 7909112..551962a 100644 --- a/exec/wd.c +++ b/exec/wd.c @@ -579,11 +579,11 @@ static void watchdog_timeout_apply (uint32_t new) api->timer_add_duration(tickle_timeout*MILLI_2_NANO_SECONDS, NULL, wd_tickle_fn, &wd_timer); - log_printf (LOGSYS_LEVEL_DEBUG, "The Watchdog timeout is %d seconds\n", watchdog_timeout); - log_printf (LOGSYS_LEVEL_DEBUG, "The tickle timeout is %"PRIu64" ms\n", tickle_timeout); + log_printf (LOGSYS_LEVEL_DEBUG, "The Watchdog timeout is %d seconds", watchdog_timeout); + log_printf (LOGSYS_LEVEL_DEBUG, "The tickle timeout is %"PRIu64" ms", tickle_timeout); } else { log_printf (LOGSYS_LEVEL_WARNING, - "Could not change the Watchdog timeout from %d to %d seconds\n", + "Could not change the Watchdog timeout from %d to %d seconds", original_timeout, new); } diff --git a/include/corosync/logsys.h b/include/corosync/logsys.h index 247881e..1a15ab3 100644 --- a/include/corosync/logsys.h +++ b/include/corosync/logsys.h @@ -194,7 +194,7 @@ static void logsys_subsys_init (void) \ #define LOGSYS_PERROR(err_num, level, fmt, args...) do { \ char _error_str[LOGSYS_MAX_PERROR_MSG_LEN]; \ const char *_error_ptr = qb_strerror_r(err_num, _error_str, sizeof(_error_str)); \ - qb_log(level, fmt ": %s (%d)\n", ##args, _error_ptr, err_num); \ + qb_log(level, fmt ": %s (%d)", ##args, _error_ptr, err_num); \ } while(0) #define log_printf(level, format, args...) qb_log(level, format, ##args) -- 1.7.7.5 _______________________________________________ discuss mailing list discuss@xxxxxxxxxxxx http://lists.corosync.org/mailman/listinfo/discuss