diff options
author | Lee Duncan <lduncan@suse.com> | 2015-03-16 09:17:03 -0700 |
---|---|---|
committer | Mike Christie <michaelc@cs.wisc.edu> | 2015-04-03 15:44:22 -0500 |
commit | a277d3138761db1adffbe7c5ea0059aa4b4facc3 (patch) | |
tree | d0e556914b37b61f2223469308cb0d75944b44c5 | |
parent | 006270c0f9a1fa1e78574a7eaa04bb9ae1ef62b6 (diff) | |
download | open-iscsi-a277d3138761db1adffbe7c5ea0059aa4b4facc3.tar.gz |
Remove duplicate newlines in log messages.
Cleanup log messages, some of which had
newlines and some of which did not, as
the logging system already adds a newline
to the end of log messges.
No functional changes, though one log
message was also slightly corrected.
-rw-r--r-- | usr/actor.c | 8 | ||||
-rw-r--r-- | usr/auth.c | 12 | ||||
-rw-r--r-- | usr/discovery.c | 42 | ||||
-rw-r--r-- | usr/discoveryd.c | 10 | ||||
-rw-r--r-- | usr/event_poll.c | 8 | ||||
-rw-r--r-- | usr/idbm.c | 66 | ||||
-rw-r--r-- | usr/iface.c | 22 | ||||
-rw-r--r-- | usr/initiator.c | 89 | ||||
-rw-r--r-- | usr/initiator_common.c | 18 | ||||
-rw-r--r-- | usr/io.c | 10 | ||||
-rw-r--r-- | usr/iscsi_net_util.c | 14 | ||||
-rw-r--r-- | usr/iscsi_sysfs.c | 40 | ||||
-rw-r--r-- | usr/iscsi_util.c | 8 | ||||
-rw-r--r-- | usr/iscsiadm.c | 22 | ||||
-rw-r--r-- | usr/iscsid.c | 12 | ||||
-rw-r--r-- | usr/iscsid_req.c | 4 | ||||
-rw-r--r-- | usr/iscsistart.c | 12 | ||||
-rw-r--r-- | usr/login.c | 10 | ||||
-rw-r--r-- | usr/netlink.c | 22 | ||||
-rw-r--r-- | usr/strings.c | 2 | ||||
-rw-r--r-- | usr/sysfs.c | 64 | ||||
-rw-r--r-- | usr/transport.c | 6 | ||||
-rw-r--r-- | usr/uip_mgmt_ipc.c | 2 |
23 files changed, 252 insertions, 251 deletions
diff --git a/usr/actor.c b/usr/actor.c index 67ae0e0..b4f9e95 100644 --- a/usr/actor.c +++ b/usr/actor.c @@ -65,7 +65,7 @@ actor_delete(actor_t *thread) log_debug(1, "deleting a scheduled/waiting thread!"); list_del_init(&thread->list); if (list_empty(&pend_list)) { - log_debug(7, "nothing left on pend_list, deactivating alarm\n"); + log_debug(7, "nothing left on pend_list, deactivating alarm"); alarm(0); } @@ -134,7 +134,7 @@ actor_schedule_private(actor_t *thread, uint32_t delay_secs, int head) struct timespec tv; if (clock_gettime(CLOCK_MONOTONIC_COARSE, &tv)) { - log_error("clock_getime failed, can't schedule!\n"); + log_error("clock_getime failed, can't schedule!"); return; } @@ -214,7 +214,7 @@ actor_poll(void) } if (clock_gettime(CLOCK_MONOTONIC_COARSE, &tv)) { - log_error("clock_gettime failed, can't schedule!\n"); + log_error("clock_gettime failed, can't schedule!"); return; } @@ -255,7 +255,7 @@ actor_poll(void) /* Disable alarm if nothing else pending */ if (list_empty(&pend_list)) { - log_debug(7, "nothing on pend_list, deactivating alarm\n"); + log_debug(7, "nothing on pend_list, deactivating alarm"); alarm(0); } @@ -109,13 +109,13 @@ acl_chap_auth_request(struct iscsi_acl *client, char *username, unsigned int id, /* the expected credentials are in the session */ if (session->username_in == NULL) { log_error("failing authentication, no incoming username " - "configured to authenticate target %s\n", + "configured to authenticate target %s", session->target_name); return AUTH_STATUS_FAIL; } if (strcmp(username, session->username_in) != 0) { log_error("failing authentication, received incorrect " - "username from target %s\n", session->target_name); + "username from target %s", session->target_name); return AUTH_STATUS_FAIL; } @@ -123,7 +123,7 @@ acl_chap_auth_request(struct iscsi_acl *client, char *username, unsigned int id, (session->password_in == NULL) || (session->password_in[0] == '\0')) { log_error("failing authentication, no incoming password " - "configured to authenticate target %s\n", + "configured to authenticate target %s", session->target_name); return AUTH_STATUS_FAIL; } @@ -132,7 +132,7 @@ acl_chap_auth_request(struct iscsi_acl *client, char *username, unsigned int id, if (rsp_length != sizeof(verify_data)) { log_error("failing authentication, received incorrect " - "CHAP response length %u from target %s\n", + "CHAP response length %u from target %s", rsp_length, session->target_name); return AUTH_STATUS_FAIL; } @@ -154,13 +154,13 @@ acl_chap_auth_request(struct iscsi_acl *client, char *username, unsigned int id, auth_md5_final(verify_data, &context); if (memcmp(response_data, verify_data, sizeof(verify_data)) == 0) { - log_debug(1, "initiator authenticated target %s\n", + log_debug(1, "initiator authenticated target %s", session->target_name); return AUTH_STATUS_PASS; } log_error("failing authentication, received incorrect CHAP " - "response from target %s\n", session->target_name); + "response from target %s", session->target_name); return AUTH_STATUS_FAIL; } diff --git a/usr/discovery.c b/usr/discovery.c index 565a919..38968ca 100644 --- a/usr/discovery.c +++ b/usr/discovery.c @@ -111,7 +111,7 @@ int discovery_isns_set_servername(char *address, int port) int len; if (port > USHRT_MAX) { - log_error("Invalid port %d\n", port); + log_error("Invalid port %d", port); return ISCSI_ERR_INVAL; } @@ -193,7 +193,7 @@ int discovery_isns_query(struct discovery_rec *drec, const char *iname, status = isns_query_response_get_objects(qry, &objects); if (status) { log_error("Unable to extract object list from query " - "response: %s\n", isns_strerror(status)); + "response: %s", isns_strerror(status)); rc = ISCSI_ERR; goto free_query; } @@ -391,7 +391,7 @@ int discovery_fw(void *data, struct iface_rec *iface, rc = fw_get_targets(&targets); if (rc) { log_error("Could not get list of targets from firmware. " - "(err %d)\n", rc); + "(err %d)", rc); return rc; } if (list_empty(&targets)) @@ -406,7 +406,7 @@ int discovery_fw(void *data, struct iface_rec *iface, rec = idbm_create_rec_from_boot_context(bcontext); if (!rec) { log_error("Could not convert firmware info to " - "node record.\n"); + "node record."); rc = ISCSI_ERR_NOMEM; goto free_targets; } @@ -456,7 +456,7 @@ int discovery_offload_sendtargets(int host_no, int do_login, */ rc = iscsid_exec_req(&req, &rsp, 1); if (rc) { - log_error("Could not offload sendtargets to %s.\n", + log_error("Could not offload sendtargets to %s.", drec->address); iscsi_err_print_msg(rc); return rc; @@ -817,7 +817,7 @@ iscsi_alloc_session(struct iscsi_sendtargets_config *config, session->t = iscsi_sysfs_get_transport_by_name(iface->transport_name); if (!session->t) { log_error("iSCSI driver %s is not loaded. Load the module " - "then retry the command.\n", iface->transport_name); + "then retry the command.", iface->transport_name); *rc = ISCSI_ERR_TRANS_NOT_FOUND; goto fail; } @@ -1036,7 +1036,7 @@ static void iscsi_destroy_session(struct iscsi_session *session) rc = ipc->stop_conn(session->t->handle, session->id, conn->id, STOP_CONN_TERM); if (rc) { - log_error("Could not stop conn %d:%d cleanly (err %d)\n", + log_error("Could not stop conn %d:%d cleanly (err %d)", session->id, conn->id, rc); goto done; } @@ -1091,7 +1091,7 @@ static int iscsi_create_leading_conn(struct iscsi_session *session) */ conn->socket_fd = ipc->ctldev_open(); if (conn->socket_fd < 0) { - log_error("Could not open netlink interface (err %d)\n", + log_error("Could not open netlink interface (err %d)", errno); return ISCSI_ERR_INTERNAL; } @@ -1117,7 +1117,7 @@ static int iscsi_create_leading_conn(struct iscsi_session *session) } /* create interconnect endpoint */ - log_debug(2, "%s discovery ep connect\n", __FUNCTION__); + log_debug(2, "%s discovery ep connect", __FUNCTION__); rc = t->template->ep_connect(conn, 1); if (rc < 0) { rc = ISCSI_ERR_TRANS; @@ -1140,21 +1140,21 @@ static int iscsi_create_leading_conn(struct iscsi_session *session) break; } while (1); - log_debug(2, "%s discovery create session\n", __FUNCTION__); + log_debug(2, "%s discovery create session", __FUNCTION__); /* create kernel structs */ rc = ipc->create_session(session->t->handle, conn->transport_ep_handle, 1, 32, 1, &session->id, &host_no); if (rc) { - log_error("Could not create kernel session (err %d).\n", rc); + log_error("Could not create kernel session (err %d).", rc); rc = ISCSI_ERR_INTERNAL; goto disconnect; } - log_debug(2, "%s discovery created session %u\n", __FUNCTION__, + log_debug(2, "%s discovery created session %u", __FUNCTION__, session->id); session->isid[3] = session->id; - log_debug(2, "%s discovery create conn\n", __FUNCTION__); + log_debug(2, "%s discovery create conn", __FUNCTION__); rc = ipc->create_conn(t->handle, session->id, conn->id, &conn->id); if (rc) { log_error("Could not create connection (err %d)", rc); @@ -1162,7 +1162,7 @@ static int iscsi_create_leading_conn(struct iscsi_session *session) goto disconnect; } - log_debug(2, "%s discovery bind conn\n", __FUNCTION__); + log_debug(2, "%s discovery bind conn", __FUNCTION__); if (ipc->bind_conn(t->handle, session->id, conn->id, conn->transport_ep_handle, (conn->id == 0), &rc) || rc) { @@ -1208,7 +1208,7 @@ close_ipc: static struct iscsi_ev_context * iscsi_ev_context_get(struct iscsi_conn *conn, int ev_size) { - log_debug(2, "%s: ev_size %d\n", __FUNCTION__, ev_size); + log_debug(2, "%s: ev_size %d", __FUNCTION__, ev_size); ipc_ev_context.data = calloc(1, ev_size); if (!ipc_ev_context.data) @@ -1405,11 +1405,11 @@ redirect_reconnect: &config->conn_conf); if (t->caps & CAP_TEXT_NEGO) { - log_debug(2, "%s discovery set params\n", __FUNCTION__); + log_debug(2, "%s discovery set params", __FUNCTION__); rc = iscsi_session_set_params(conn); if (rc) { log_error("Could not set iscsi params for conn %d:%d " - "(err %d)\n", session->id, conn->id, rc); + "(err %d)", session->id, conn->id, rc); rc = ISCSI_ERR_INTERNAL; goto login_failed; } @@ -1489,7 +1489,7 @@ redirect_reconnect: case ISCSI_LOGIN_STATUS_AUTH_FAILED: case ISCSI_LOGIN_STATUS_TGT_FORBIDDEN: log_error("discovery login to %s rejected: " - "initiator failed authorization\n", + "initiator failed authorization", conn->host); rc = ISCSI_ERR_LOGIN_AUTH_FAILED; goto login_failed; @@ -1521,16 +1521,16 @@ redirect_reconnect: return 0; start_conn: - log_debug(2, "%s discovery set neg params\n", __FUNCTION__); + log_debug(2, "%s discovery set neg params", __FUNCTION__); rc = iscsi_session_set_neg_params(conn); if (rc) { log_error("Could not set iscsi params for conn %d:%d (err " - "%d)\n", session->id, conn->id, rc); + "%d)", session->id, conn->id, rc); rc = ISCSI_ERR_INTERNAL; goto login_failed; } - log_debug(2, "%s discovery start conn\n", __FUNCTION__); + log_debug(2, "%s discovery start conn", __FUNCTION__); if (ipc->start_conn(t->handle, session->id, conn->id, &rc) || rc) { log_error("Cannot start conn %d:%d (err %d)", session->id, conn->id, rc); diff --git a/usr/discoveryd.c b/usr/discoveryd.c index de080ea..1e14977 100644 --- a/usr/discoveryd.c +++ b/usr/discoveryd.c @@ -211,7 +211,7 @@ static void fork_disc(const char *def_iname, struct discovery_rec *drec, exit(0); } else if (pid < 0) log_error("Fork failed (err %d - %s). Will not be able " - "to perform discovery to %s.\n", + "to perform discovery to %s.", errno, strerror(errno), drec->address); else { shutdown_callback(pid); @@ -254,7 +254,7 @@ static int isns_build_objs(isns_portal_info_t *portal_info, nportals = isns_enumerate_portals(iflist, nportals); if (nportals == 0) { log_error("Unable to enumerate portals - " - "no usable interfaces found\n"); + "no usable interfaces found"); free(iflist); return ISCSI_ERR_NO_OBJS_FOUND; } @@ -557,7 +557,7 @@ static int isns_setup_registration_refresh(isns_simple_t *rsp, int poll_inval) status = isns_query_response_get_objects(rsp, &objs); if (status) { log_error("Unable to extract object list from " - "registration response: %s\n", + "registration response: %s", isns_strerror(status)); return ISCSI_ERR; } @@ -693,7 +693,7 @@ static int isns_register_objs(isns_client_t *clnt, isns_object_list_t *objs, status = isns_simple_call(clnt->ic_socket, ®); if (status != ISNS_SUCCESS) { - log_error("SCN registration for node %s failed: %s\n", + log_error("SCN registration for node %s failed: %s", isns_source_name(node->source), isns_strerror(status)); /* @@ -907,7 +907,7 @@ static int isns_scn_recv(isns_server_t *svr, isns_socket_t *svr_sock, function = isns_message_function(msg); if (function != ISNS_STATE_CHANGE_NOTIFICATION) { - log_warning("Discarding unexpected %s message\n", + log_warning("Discarding unexpected %s message", isns_function_name(function)); isns_message_release(msg); continue; diff --git a/usr/event_poll.c b/usr/event_poll.c index 8482d6f..209ee02 100644 --- a/usr/event_poll.c +++ b/usr/event_poll.c @@ -84,7 +84,7 @@ int shutdown_callback(pid_t pid) INIT_LIST_HEAD(&cb->list); cb->pid = pid; - log_debug(1, "adding %d for shutdown cb\n", pid); + log_debug(1, "adding %d for shutdown cb", pid); list_add_tail(&cb->list, &shutdown_callbacks); return 0; } @@ -94,7 +94,7 @@ static void shutdown_notify_pids(void) struct shutdown_callback *cb; list_for_each_entry(cb, &shutdown_callbacks, list) { - log_debug(1, "Killing %d\n", cb->pid); + log_debug(1, "Killing %d", cb->pid); kill(cb->pid, SIGTERM); } } @@ -109,7 +109,7 @@ static int shutdown_wait_pids(void) * sign that it is gone. */ if (waitpid(cb->pid, NULL, WNOHANG)) { - log_debug(1, "%d done\n", cb->pid); + log_debug(1, "%d done", cb->pid); list_del(&cb->list); free(cb); } @@ -146,7 +146,7 @@ void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd) sig_fd = signalfd(-1, &sigset, SFD_NONBLOCK); if (sig_fd == -1) { - log_error("signalfd failed: %m\n"); + log_error("signalfd failed: %m"); return; } @@ -1059,7 +1059,7 @@ int idbm_verify_param(recinfo_t *info, char *name) if (strcmp(name, info[i].name)) continue; - log_debug(7, "verify %s %d\n", name, info[i].can_modify); + log_debug(7, "verify %s %d", name, info[i].can_modify); if (info[i].can_modify) return 0; else { @@ -1162,20 +1162,20 @@ static void idbm_sync_config(void) idbm_recinfo_node(&db->nrec, db->ninfo); if (!db->get_config_file) { - log_debug(1, "Could not get config file. No config file fn\n"); + log_debug(1, "Could not get config file. No config file fn"); return; } config_file = db->get_config_file(); if (!config_file) { - log_debug(1, "Could not get config file for sync config\n"); + log_debug(1, "Could not get config file for sync config"); return; } f = fopen(config_file, "r"); if (!f) { log_debug(1, "cannot open configuration file %s. " - "Default location is %s.\n", + "Default location is %s.", config_file, CONFIG_FILE); return; } @@ -1331,7 +1331,7 @@ int idbm_lock(void) if (access(LOCK_DIR, F_OK) != 0) { if (mkdir(LOCK_DIR, 0660) != 0) { - log_error("Could not open %s: %s\n", LOCK_DIR, + log_error("Could not open %s: %s", LOCK_DIR, strerror(errno)); return ISCSI_ERR_IDBM; } @@ -1411,7 +1411,7 @@ static int __idbm_rec_read(node_rec_t *out_rec, char *conf) f = fopen(conf, "r"); if (!f) { - log_debug(5, "Could not open %s err %s\n", conf, + log_debug(5, "Could not open %s err %s", conf, strerror(errno)); rc = ISCSI_ERR_IDBM; goto unlock; @@ -1553,7 +1553,7 @@ static int idbm_for_each_drec(int type, char *config_root, void *data, !strcmp(entity_dent->d_name, "..")) continue; - log_debug(5, "found %s\n", entity_dent->d_name); + log_debug(5, "found %s", entity_dent->d_name); tmp_port = strchr(entity_dent->d_name, ','); if (!tmp_port) @@ -1810,7 +1810,7 @@ int idbm_for_each_portal(int *found, void *data, idbm_portal_op_fn *fn, !strcmp(portal_dent->d_name, "..")) continue; - log_debug(5, "found %s\n", portal_dent->d_name); + log_debug(5, "found %s", portal_dent->d_name); tmp_port = strchr(portal_dent->d_name, ','); if (!tmp_port) continue; @@ -1852,7 +1852,7 @@ int idbm_for_each_node(int *found, void *data, idbm_node_op_fn *fn) !strcmp(node_dent->d_name, "..")) continue; - log_debug(5, "searching %s\n", node_dent->d_name); + log_debug(5, "searching %s", node_dent->d_name); curr_rc = fn(found, data, node_dent->d_name); /* less than zero means it was not a match */ if (curr_rc > 0 && !rc) @@ -1928,7 +1928,7 @@ idbm_discovery_read(discovery_rec_t *out_rec, int drec_type, snprintf(portal, PATH_MAX, "%s/%s,%d", disc_type_to_config_vals[drec_type].config_root, addr, port); - log_debug(5, "Looking for config file %s\n", portal); + log_debug(5, "Looking for config file %s", portal); rc = idbm_lock(); if (rc) @@ -1937,7 +1937,7 @@ idbm_discovery_read(discovery_rec_t *out_rec, int drec_type, f = idbm_open_rec_r(portal, disc_type_to_config_vals[drec_type].config_name); if (!f) { - log_debug(1, "Could not open %s: %s\n", portal, + log_debug(1, "Could not open %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; goto unlock; @@ -1967,7 +1967,7 @@ static FILE *idbm_open_rec_w(char *portal, char *config) FILE *f; int err; - log_debug(5, "Looking for config file %s\n", portal); + log_debug(5, "Looking for config file %s", portal); err = stat(portal, &statb); if (err) @@ -1979,14 +1979,14 @@ static FILE *idbm_open_rec_w(char *portal, char *config) */ if (unlink(portal)) { log_error("Could not convert %s to %s/%s. " - "err %d\n", portal, portal, + "err %d", portal, portal, config, errno); return NULL; } mkdir_portal: if (mkdir(portal, 0660) != 0) { - log_error("Could not make dir %s err %d\n", + log_error("Could not make dir %s err %d", portal, errno); return NULL; } @@ -1996,7 +1996,7 @@ mkdir_portal: strlcat(portal, config, PATH_MAX); f = fopen(portal, "w"); if (!f) - log_error("Could not open %s err %d\n", portal, errno); + log_error("Could not open %s err %d", portal, errno); return f; } @@ -2009,14 +2009,14 @@ static int idbm_rec_write(node_rec_t *rec) portal = malloc(PATH_MAX); if (!portal) { - log_error("Could not alloc portal\n"); + log_error("Could not alloc portal"); return ISCSI_ERR_NOMEM; } snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR); if (access(portal, F_OK) != 0) { if (mkdir(portal, 0660) != 0) { - log_error("Could not make %s: %s\n", portal, + log_error("Could not make %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; goto free_portal; @@ -2026,7 +2026,7 @@ static int idbm_rec_write(node_rec_t *rec) snprintf(portal, PATH_MAX, "%s/%s", NODE_CONFIG_DIR, rec->name); if (access(portal, F_OK) != 0) { if (mkdir(portal, 0660) != 0) { - log_error("Could not make %s: %s\n", portal, + log_error("Could not make %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; goto free_portal; @@ -2069,7 +2069,7 @@ static int idbm_rec_write(node_rec_t *rec) * Old style portal as a file, but with tpgt. Let's update it. */ if (unlink(portal)) { - log_error("Could not convert %s: %s\n", portal, + log_error("Could not convert %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; goto unlock; @@ -2084,7 +2084,7 @@ mkdir_portal: rec->name, rec->conn[0].address, rec->conn[0].port, rec->tpgt); if (stat(portal, &statb)) { if (mkdir(portal, 0660) != 0) { - log_error("Could not make dir %s: %s\n", + log_error("Could not make dir %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; goto unlock; @@ -2097,7 +2097,7 @@ mkdir_portal: open_conf: f = fopen(portal, "w"); if (!f) { - log_error("Could not open %s: %sd\n", portal, strerror(errno)); + log_error("Could not open %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; goto unlock; } @@ -2123,7 +2123,7 @@ idbm_discovery_write(discovery_rec_t *rec) portal = malloc(PATH_MAX); if (!portal) { - log_error("Could not alloc portal\n"); + log_error("Could not alloc portal"); return ISCSI_ERR_NOMEM; } @@ -2135,7 +2135,7 @@ idbm_discovery_write(discovery_rec_t *rec) disc_type_to_config_vals[rec->type].config_root); if (access(portal, F_OK) != 0) { if (mkdir(portal, 0660) != 0) { - log_error("Could not make %s: %s\n", portal, + log_error("Could not make %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; goto unlock; @@ -2149,7 +2149,7 @@ idbm_discovery_write(discovery_rec_t *rec) f = idbm_open_rec_w(portal, disc_type_to_config_vals[rec->type].config_name); if (!f) { - log_error("Could not open %s: %s\n", portal, strerror(errno)); + log_error("Could not open %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; goto unlock; } @@ -2521,10 +2521,10 @@ int idbm_delete_discovery(discovery_rec_t *drec) snprintf(portal, PATH_MAX, "%s/%s,%d", disc_type_to_config_vals[drec->type].config_root, drec->address, drec->port); - log_debug(5, "Removing config file %s\n", portal); + log_debug(5, "Removing config file %s", portal); if (stat(portal, &statb)) { - log_debug(5, "Could not stat %s to delete disc err %d\n", + log_debug(5, "Could not stat %s to delete disc err %d", portal, errno); goto free_portal; } @@ -2537,7 +2537,7 @@ int idbm_delete_discovery(discovery_rec_t *drec) } if (unlink(portal)) - log_debug(5, "Could not remove %s err %d\n", portal, errno); + log_debug(5, "Could not remove %s err %d", portal, errno); memset(portal, 0, PATH_MAX); snprintf(portal, PATH_MAX, "%s/%s,%d", @@ -2587,7 +2587,7 @@ static int idbm_remove_disc_to_node_link(node_rec_t *rec, goto done; } - log_debug(7, "found drec %s %d\n", + log_debug(7, "found drec %s %d", tmprec->disc_address, tmprec->disc_port); /* rm link from discovery source to node */ memset(portal, 0, PATH_MAX); @@ -2601,7 +2601,7 @@ static int idbm_remove_disc_to_node_link(node_rec_t *rec, if (!stat(portal, &statb)) { if (unlink(portal)) { - log_error("Could not remove link %s: %s\n", + log_error("Could not remove link %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; } else @@ -2638,7 +2638,7 @@ int idbm_delete_node(node_rec_t *rec) memset(portal, 0, PATH_MAX); snprintf(portal, PATH_MAX, "%s/%s/%s,%d", NODE_CONFIG_DIR, rec->name, rec->conn[0].address, rec->conn[0].port); - log_debug(5, "Removing config file %s iface id %s\n", + log_debug(5, "Removing config file %s iface id %s", portal, rec->iface.name); rc = idbm_lock(); @@ -2656,14 +2656,14 @@ int idbm_delete_node(node_rec_t *rec) if (!stat(portal, &statb)) goto rm_conf; - log_error("Could not stat %s to delete node: %s\n", + log_error("Could not stat %s to delete node: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; goto unlock; rm_conf: if (unlink(portal)) { - log_error("Could not remove %s: %s\n", portal, strerror(errno)); + log_error("Could not remove %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; goto unlock; } @@ -2841,7 +2841,7 @@ int idbm_init(idbm_get_config_file_fn *fn) /* make sure root db dir is there */ if (access(ISCSI_CONFIG_ROOT, F_OK) != 0) { if (mkdir(ISCSI_CONFIG_ROOT, 0660) != 0) { - log_error("Could not make %s %d\n", ISCSI_CONFIG_ROOT, + log_error("Could not make %s %d", ISCSI_CONFIG_ROOT, errno); return errno; } diff --git a/usr/iface.c b/usr/iface.c index 940ee23..0a7f0bb 100644 --- a/usr/iface.c +++ b/usr/iface.c @@ -227,7 +227,7 @@ int iface_conf_delete(struct iface_rec *iface) def_iface = iface_match_default(iface); if (def_iface) { log_error("iface %s is a special interface and " - "cannot be deleted.\n", iface->name); + "cannot be deleted.", iface->name); return ISCSI_ERR_INVAL; } @@ -259,7 +259,7 @@ int iface_conf_write(struct iface_rec *iface) def_iface = iface_match_default(iface); if (def_iface) { log_error("iface %s is a special interface and " - "is not stored in %s.\n", iface->name, + "is not stored in %s.", iface->name, IFACE_CONFIG_DIR); return ISCSI_ERR_INVAL; } @@ -299,7 +299,7 @@ int iface_conf_update(struct list_head *params, struct iface_rec *iface) def_iface = iface_match_default(iface); if (def_iface) { log_error("iface %s is a special interface and " - "cannot be modified.\n", iface->name); + "cannot be modified.", iface->name); return ISCSI_ERR_INVAL; } @@ -472,7 +472,7 @@ static int iface_setup_binding_from_kern_iface(void *data, if (!strlen(hinfo->iface.hwaddress)) { log_error("Invalid offload iSCSI host %u. Missing " - "hwaddress. Try upgrading %s driver.\n", + "hwaddress. Try upgrading %s driver.", hinfo->host_no, hinfo->iface.transport_name); return 0; } @@ -1032,7 +1032,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface, * host then the MAC must be for network card, so boot * is not going to be offloaded. */ - log_debug(3, "Could not match %s to host\n", + log_debug(3, "Could not match %s to host", context->mac); return 0; } @@ -1069,7 +1069,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface, sizeof(iface->subnet_mask)); strlcpy(iface->gateway, context->gateway, sizeof(iface->gateway)); - log_debug(1, "iface " iface_fmt "\n", iface_str(iface)); + log_debug(1, "iface " iface_fmt "", iface_str(iface)); return 1; } @@ -1094,7 +1094,7 @@ int iface_create_ifaces_from_boot_contexts(struct list_head *ifaces, /* use dummy name. If valid it will get overwritten below */ iface = iface_alloc(DEFAULT_IFACENAME, &rc); if (!iface) { - log_error("Could not setup iface %s for boot\n", + log_error("Could not setup iface %s for boot", context->iface); goto fail; } @@ -1430,7 +1430,7 @@ int iface_get_param_count(struct iface_rec *iface, int iface_all) int num_found = 0, rc; struct iface_param_count iface_params; - log_debug(8, "In iface_get_param_count\n"); + log_debug(8, "In iface_get_param_count"); iface_params.primary = iface; iface_params.count = 0; @@ -1441,7 +1441,7 @@ int iface_get_param_count(struct iface_rec *iface, int iface_all) else rc = __iface_get_param_count(&iface_params, iface); - log_debug(8, "iface_get_param_count: rc = %d, count = %d\n", + log_debug(8, "iface_get_param_count: rc = %d, count = %d", rc, iface_params.count); return iface_params.count; } @@ -2523,7 +2523,7 @@ int iface_build_net_config(struct iface_rec *iface, int iface_all, int num_found = 0, rc; struct iface_net_config net_config; - log_debug(8, "In iface_build_net_config\n"); + log_debug(8, "In iface_build_net_config"); net_config.primary = iface; net_config.iovs = iovs; @@ -2535,7 +2535,7 @@ int iface_build_net_config(struct iface_rec *iface, int iface_all, else rc = __iface_build_net_config(&net_config, iface); - log_debug(8, "iface_build_net_config: rc = %d, count = %d\n", + log_debug(8, "iface_build_net_config: rc = %d, count = %d", rc, net_config.count); return net_config.count; } diff --git a/usr/initiator.c b/usr/initiator.c index b25ded8..3b39c5d 100644 --- a/usr/initiator.c +++ b/usr/initiator.c @@ -233,7 +233,7 @@ __check_iscsi_status_class(iscsi_session_t *session, int cid, } case ISCSI_STATUS_CLS_TARGET_ERR: log_error("conn %d login rejected: target error " - "(%02x/%02x)\n", conn->id, status_class, status_detail); + "(%02x/%02x)", conn->id, status_class, status_detail); /* * We have no idea what the problem is. But spec says initiator * may retry later. @@ -241,7 +241,7 @@ __check_iscsi_status_class(iscsi_session_t *session, int cid, return CONN_LOGIN_RETRY; default: log_error("conn %d login response with unknown status " - "class 0x%x, detail 0x%x\n", conn->id, status_class, + "class 0x%x, detail 0x%x", conn->id, status_class, status_detail); break; } @@ -276,7 +276,7 @@ __session_conn_create(iscsi_session_t *session, int cid) conn->logout_timeout = conn_rec->timeo.logout_timeout; if (!conn->logout_timeout) { log_error("Invalid timeo.logout_timeout. Must be greater " - "than zero. Using default %d.\n", + "than zero. Using default %d.", DEF_LOGOUT_TIMEO); conn->logout_timeout = DEF_LOGOUT_TIMEO; } @@ -284,7 +284,7 @@ __session_conn_create(iscsi_session_t *session, int cid) conn->login_timeout = conn_rec->timeo.login_timeout; if (!conn->login_timeout) { log_error("Invalid timeo.login_timeout. Must be greater " - "than zero. Using default %d.\n", + "than zero. Using default %d.", DEF_LOGIN_TIMEO); conn->login_timeout = DEF_LOGIN_TIMEO; } @@ -296,14 +296,14 @@ __session_conn_create(iscsi_session_t *session, int cid) conn->noop_out_timeout = conn_rec->timeo.noop_out_timeout; if (conn->noop_out_interval && !conn->noop_out_timeout) { log_error("Invalid timeo.noop_out_timeout. Must be greater " - "than zero. Using default %d.\n", + "than zero. Using default %d.", DEF_NOOP_OUT_TIMEO); conn->noop_out_timeout = DEF_NOOP_OUT_TIMEO; } if (conn->noop_out_timeout && !conn->noop_out_interval) { log_error("Invalid timeo.noop_out_interval. Must be greater " - "than zero. Using default %d.\n", + "than zero. Using default %d.", DEF_NOOP_OUT_INTERVAL); conn->noop_out_interval = DEF_NOOP_OUT_INTERVAL; } @@ -445,7 +445,7 @@ static void iscsi_flush_context_pool(struct iscsi_session *session) static void __session_destroy(iscsi_session_t *session) { - log_debug(1, "destroying session\n"); + log_debug(1, "destroying session"); list_del(&session->list); iscsi_flush_context_pool(session); session_release(session); @@ -523,7 +523,7 @@ queue_delayed_reopen(queue_task_t *qtask, int delay) { iscsi_conn_t *conn = qtask->conn; - log_debug(4, "Requeue reopen attempt in %d secs\n", delay); + log_debug(4, "Requeue reopen attempt in %d secs", delay); /* * iscsi_login_eh can handle the login resched as @@ -577,7 +577,7 @@ static void iscsi_uio_poll_login_timedout(void *data) struct iscsi_conn *conn = qtask->conn; iscsi_session_t *session = conn->session; - log_debug(3, "timeout waiting for UIO ...\n"); + log_debug(3, "timeout waiting for UIO ..."); mgmt_ipc_write_rsp(qtask, ISCSI_ERR_TRANS_TIMEOUT); conn_delete_timers(conn); __session_destroy(session); @@ -666,7 +666,7 @@ __session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop, return; queue_reopen: - log_debug(4, "Waiting %u seconds before trying to reconnect.\n", delay); + log_debug(4, "Waiting %u seconds before trying to reconnect.", delay); queue_delayed_reopen(qtask, delay); } @@ -699,7 +699,7 @@ static int iscsi_retry_initial_login(struct iscsi_conn *conn) timeout.tv_sec = initial_login_retry_max * conn->login_timeout; if (gettimeofday(&now, NULL)) { log_error("Could not get time of day. Dropping down to " - "max retry check.\n"); + "max retry check."); return initial_login_retry_max > conn->session->reopen_cnt; } timeradd(&conn->initial_connect_time, &timeout, &fail_time); @@ -710,7 +710,7 @@ static int iscsi_retry_initial_login(struct iscsi_conn *conn) */ if (timercmp(&now, &fail_time, >)) { log_debug(1, "Giving up on initial login attempt after " - "%u seconds.\n", + "%u seconds.", initial_login_retry_max * conn->login_timeout); return 0; } @@ -817,7 +817,7 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask, break; default: - log_error("Ignoring login error %d in conn state %d.\n", + log_error("Ignoring login error %d in conn state %d.", err, conn->state); break; } @@ -891,7 +891,7 @@ __conn_error_handle(iscsi_session_t *session, iscsi_conn_t *conn) "let connection stop"); return; default: - log_debug(8, "invalid state %d\n", conn->state); + log_debug(8, "invalid state %d", conn->state); return; } @@ -948,7 +948,7 @@ static void iscsi_login_redirect(iscsi_conn_t *conn) iscsi_session_t *session = conn->session; iscsi_login_context_t *c = &conn->login_context; - log_debug(3, "login redirect ...\n"); + log_debug(3, "login redirect ..."); if (session->r_stage == R_STAGE_NO_CHANGE) session->r_stage = R_STAGE_SESSION_REDIRECT; @@ -1017,7 +1017,7 @@ static void conn_send_nop_out(void *data) actor_timer(&conn->nop_out_timer, conn->noop_out_timeout, conn_nop_out_timeout, conn); - log_debug(3, "noop out timeout timer %p start, timeout %d\n", + log_debug(3, "noop out timeout timer %p start, timeout %d", &conn->nop_out_timer, conn->noop_out_timeout); } @@ -1120,7 +1120,7 @@ setup_full_feature_phase(iscsi_conn_t *conn) if (conn->userspace_nop && conn->noop_out_interval) { actor_timer(&conn->nop_out_timer, conn->noop_out_interval, conn_send_nop_out, conn); - log_debug(3, "noop out timer %p start\n", + log_debug(3, "noop out timer %p start", &conn->nop_out_timer); } } @@ -1135,7 +1135,7 @@ static void iscsi_logout_timedout(void *data) * assume we were in ISCSI_CONN_STATE_IN_LOGOUT or there * was some nasty error */ - log_debug(3, "logout timeout, dropping conn...\n"); + log_debug(3, "logout timeout, dropping conn..."); __conn_error_handle(conn->session, conn); } @@ -1166,7 +1166,7 @@ static int iscsi_send_logout(iscsi_conn_t *conn) iscsi_sched_ev_context(ev_context, conn, conn->logout_timeout, EV_CONN_LOGOUT_TIMER); - log_debug(3, "logout timeout timer %u\n", + log_debug(3, "logout timeout timer %u", conn->logout_timeout * 1000); } @@ -1215,7 +1215,7 @@ static void iscsi_recv_logout_rsp(iscsi_conn_t *conn, struct iscsi_hdr *hdr) { struct iscsi_logout_rsp *logout_rsp = (struct iscsi_logout_rsp *)hdr; - log_debug(3, "Recv: logout response %d\n", logout_rsp->response); + log_debug(3, "Recv: logout response %d", logout_rsp->response); if (logout_rsp->response == 2 || logout_rsp->response == 3) { conn->session->def_time2wait = ntohs(logout_rsp->t2wait); log_debug(4, "logout rsp returned time2wait %u", @@ -1233,7 +1233,7 @@ static void iscsi_recv_async_msg(iscsi_conn_t *conn, struct iscsi_hdr *hdr) unsigned int senselen; struct scsi_sense_hdr sshdr; - log_debug(3, "Read AEN %d\n", async_hdr->async_event); + log_debug(3, "Read AEN %d", async_hdr->async_event); switch (async_hdr->async_event) { case ISCSI_ASYNC_MSG_SCSI_EVENT: @@ -1251,33 +1251,33 @@ static void iscsi_recv_async_msg(iscsi_conn_t *conn, struct iscsi_hdr *hdr) break; case ISCSI_ASYNC_MSG_REQUEST_LOGOUT: log_warning("Target requests logout within %u seconds for " - "connection\n", ntohs(async_hdr->param3)); + "connection", ntohs(async_hdr->param3)); if (iscsi_send_logout(conn)) log_error("Could not send logout in response to" - "logout request aen\n"); + "logout request aen"); break; case ISCSI_ASYNC_MSG_DROPPING_CONNECTION: log_warning("Target dropping connection %u, reconnect min %u " - "max %u\n", ntohs(async_hdr->param1), + "max %u", ntohs(async_hdr->param1), ntohs(async_hdr->param2), ntohs(async_hdr->param3)); session->def_time2wait = (uint32_t)ntohs(async_hdr->param2) & 0x0000FFFFFL; break; case ISCSI_ASYNC_MSG_DROPPING_ALL_CONNECTIONS: log_warning("Target dropping all connections, reconnect min %u " - "max %u\n", ntohs(async_hdr->param2), + "max %u", ntohs(async_hdr->param2), ntohs(async_hdr->param3)); session->def_time2wait = (uint32_t)ntohs(async_hdr->param2) & 0x0000FFFFFL; break; case ISCSI_ASYNC_MSG_PARAM_NEGOTIATION: log_warning("Received async event param negotiation, " - "dropping session\n"); + "dropping session"); __conn_error_handle(session, conn); break; case ISCSI_ASYNC_MSG_VENDOR_SPECIFIC: default: - log_warning("AEN not supported\n"); + log_warning("AEN not supported"); } } @@ -1392,7 +1392,7 @@ static void session_conn_recv_pdu(void *data) break; default: iscsi_ev_context_put(ev_context); - log_error("Invalid state. Dropping PDU.\n"); + log_error("Invalid state. Dropping PDU."); } } @@ -1476,7 +1476,7 @@ static void session_increase_wq_priority(struct iscsi_session *session) fail: log_error("Could not set session%d priority. " "READ/WRITE throughout and latency could be " - "affected.\n", session->id); + "affected.", session->id); } static int session_ipc_create(struct iscsi_session *session) @@ -1782,7 +1782,7 @@ static void session_conn_uio_poll(void *data) if (iscsi_conn_connect(conn, qtask)) { int delay = ISCSI_CONN_ERR_REOPEN_DELAY; - log_debug(4, "Waiting %u seconds before trying to reconnect.\n", + log_debug(4, "Waiting %u seconds before trying to reconnect.", delay); queue_delayed_reopen(qtask, delay); } @@ -1907,7 +1907,7 @@ static int __session_login_task(node_rec_t *rec, queue_task_t *qtask) (!(t->caps & CAP_RECOVERY_L1) && rec->session.iscsi.ERL > 1)) { log_error("Transport '%s' does not support ERL %d." - "Setting ERL to ERL0.\n", + "Setting ERL to ERL0.", t->name, rec->session.iscsi.ERL); rec->session.iscsi.ERL = 0; } @@ -1940,14 +1940,14 @@ static int __session_login_task(node_rec_t *rec, queue_task_t *qtask) if (!(t->caps & CAP_MARKERS) && rec->conn[0].iscsi.IFMarker) { log_error("Transport '%s' does not support IFMarker. " - "Disabling IFMarkers.\n", t->name); + "Disabling IFMarkers.", t->name); rec->conn[0].iscsi.IFMarker = 0; } if (!(t->caps & CAP_MARKERS) && rec->conn[0].iscsi.OFMarker) { log_error("Transport '%s' does not support OFMarker." - "Disabling OFMarkers.\n", t->name); + "Disabling OFMarkers.", t->name); rec->conn[0].iscsi.OFMarker = 0; } @@ -1994,7 +1994,7 @@ static int __session_login_task(node_rec_t *rec, queue_task_t *qtask) if (iscsi_conn_connect(conn, qtask)) { log_debug(4, "Initial connect failed. Waiting %u seconds " - "before trying to reconnect.\n", + "before trying to reconnect.", ISCSI_CONN_ERR_REOPEN_DELAY); queue_delayed_reopen(qtask, ISCSI_CONN_ERR_REOPEN_DELAY); } @@ -2064,7 +2064,7 @@ static int queue_session_login_task_retry(struct login_task_retry_info *info, } info->retry_count++; - log_debug(4, "queue session setup attempt in %d secs, retries %d\n", + log_debug(4, "queue session setup attempt in %d secs, retries %d", 3, info->retry_count); actor_timer(&info->retry_actor, 3, session_login_task_retry, info); return 0; @@ -2104,7 +2104,7 @@ iscsi_sync_session(node_rec_t *rec, queue_task_t *qtask, uint32_t sid) session->id = sid; session->hostno = iscsi_sysfs_get_host_no_from_sid(sid, &err); if (err) { - log_error("Could not get hostno for session %d\n", sid); + log_error("Could not get hostno for session %d", sid); goto destroy_session; } @@ -2125,7 +2125,7 @@ iscsi_sync_session(node_rec_t *rec, queue_task_t *qtask, uint32_t sid) destroy_session: __session_destroy(session); - log_error("Could not sync session%d err %d\n", sid, err); + log_error("Could not sync session%d err %d", sid, err); return err; } @@ -2136,7 +2136,7 @@ static int session_unbind(struct iscsi_session *session) err = ipc->unbind_session(session->t->handle, session->id); if (err) /* older kernels did not support unbind */ - log_debug(2, "Could not unbind session %d.\n", err); + log_debug(2, "Could not unbind session %d.", err); return err; } @@ -2316,7 +2316,8 @@ static int session_in_use(int sid) if (libmount_init()) { log_error("Failed to initialize libmount, " - "not checking for active mounts on session [%d].\n", sid); + "not checking for active mounts on session [%d].", + sid); return 0; } @@ -2336,7 +2337,7 @@ int session_logout_task(int sid, queue_task_t *qtask) session = session_find_by_sid(sid); if (!session) { - log_debug(1, "session sid %d not found.\n", sid); + log_debug(1, "session sid %d not found.", sid); return ISCSI_ERR_SESS_NOT_FOUND; } conn = &session->conn[0]; @@ -2351,13 +2352,13 @@ int session_logout_task(int sid, queue_task_t *qtask) session->r_stage == R_STAGE_SESSION_REDIRECT))) { invalid_state: log_error("session in invalid state for logout. " - "Try again later\n"); + "Try again later"); return ISCSI_ERR_INTERNAL; } if (dconfig->safe_logout && session_in_use(sid)) { log_error("Session is actively in use for mounted storage, " - "and iscsid.safe_logout is configured.\n"); + "and iscsid.safe_logout is configured."); return ISCSI_ERR_BUSY; } @@ -2382,7 +2383,7 @@ invalid_state: return ISCSI_SUCCESS; } - log_error("Could not send logout pdu. Dropping session\n"); + log_error("Could not send logout pdu. Dropping session"); /* fallthrough */ default: rc = session_conn_shutdown(conn, qtask, ISCSI_SUCCESS); @@ -2400,7 +2401,7 @@ iscsi_host_send_targets(queue_task_t *qtask, int host_no, int do_login, t = iscsi_sysfs_get_transport_by_hba(host_no); if (!t) { - log_error("Invalid host no %d for sendtargets\n", host_no); + log_error("Invalid host no %d for sendtargets", host_no); return ISCSI_ERR_TRANS_NOT_FOUND; } if (!(t->caps & CAP_SENDTARGETS_OFFLOAD)) diff --git a/usr/initiator_common.c b/usr/initiator_common.c index eb03b23..e30e419 100644 --- a/usr/initiator_common.c +++ b/usr/initiator_common.c @@ -143,7 +143,7 @@ iscsi_copy_operational_params(struct iscsi_conn *conn, if (conn->max_recv_dlength < ISCSI_MIN_MAX_RECV_SEG_LEN || conn->max_recv_dlength > ISCSI_MAX_MAX_RECV_SEG_LEN) { log_error("Invalid iscsi.MaxRecvDataSegmentLength. Must be " - "within %u and %u. Setting to %u\n", + "within %u and %u. Setting to %u", ISCSI_MIN_MAX_RECV_SEG_LEN, ISCSI_MAX_MAX_RECV_SEG_LEN, DEF_INI_MAX_RECV_SEG_LEN); @@ -160,7 +160,7 @@ iscsi_copy_operational_params(struct iscsi_conn *conn, if (conn->max_xmit_dlength < ISCSI_MIN_MAX_RECV_SEG_LEN || conn->max_xmit_dlength > ISCSI_MAX_MAX_RECV_SEG_LEN) { log_error("Invalid iscsi.MaxXmitDataSegmentLength. Must be " - "within %u and %u. Setting to %u\n", + "within %u and %u. Setting to %u", ISCSI_MIN_MAX_RECV_SEG_LEN, ISCSI_MAX_MAX_RECV_SEG_LEN, DEF_INI_MAX_RECV_SEG_LEN); @@ -181,7 +181,7 @@ iscsi_copy_operational_params(struct iscsi_conn *conn, if (session->first_burst < ISCSI_MIN_FIRST_BURST_LEN || session->first_burst > ISCSI_MAX_FIRST_BURST_LEN) { log_error("Invalid iscsi.FirstBurstLength of %u. Must be " - "within %u and %u. Setting to %u\n", + "within %u and %u. Setting to %u", session->first_burst, ISCSI_MIN_FIRST_BURST_LEN, ISCSI_MAX_FIRST_BURST_LEN, @@ -194,7 +194,7 @@ iscsi_copy_operational_params(struct iscsi_conn *conn, if (session->max_burst < ISCSI_MIN_MAX_BURST_LEN || session->max_burst > ISCSI_MAX_MAX_BURST_LEN) { log_error("Invalid iscsi.MaxBurstLength of %u. Must be " - "within %u and %u. Setting to %u\n", + "within %u and %u. Setting to %u", session->max_burst, ISCSI_MIN_MAX_BURST_LEN, ISCSI_MAX_MAX_BURST_LEN, DEF_INI_MAX_BURST_LEN); session_conf->MaxBurstLength = DEF_INI_MAX_BURST_LEN; @@ -203,7 +203,7 @@ iscsi_copy_operational_params(struct iscsi_conn *conn, if (session->first_burst > session->max_burst) { log_error("Invalid iscsi.FirstBurstLength of %u. Must be " - "less than iscsi.MaxBurstLength. Setting to %u\n", + "less than iscsi.MaxBurstLength. Setting to %u", session->first_burst, session->max_burst); session_conf->FirstBurstLength = session->max_burst; session->first_burst = session->max_burst; @@ -637,7 +637,7 @@ int iscsi_set_net_config(struct iscsi_transport *t, iscsi_session_t *session, set */ hostno = iscsi_sysfs_get_host_no_from_hwinfo(iface, &rc); if (rc) { - log_debug(4, "Couldn't get host no.\n"); + log_debug(4, "Couldn't get host no."); return rc; } @@ -664,7 +664,7 @@ int iscsi_host_set_net_params(struct iface_rec *iface, struct host_info hinfo; log_debug(3, "setting iface %s, dev %s, set ip %s, hw %s, " - "transport %s.\n", + "transport %s.", iface->name, iface->netdev, iface->ipaddress, iface->hwaddress, iface->transport_name); @@ -675,12 +675,12 @@ int iscsi_host_set_net_params(struct iface_rec *iface, if (!iface_is_bound_by_ipaddr(iface)) { if (t->template->set_host_ip == SET_HOST_IP_REQ) { log_warning("Please set the iface.ipaddress for iface " - "%s, then retry the login command.\n", + "%s, then retry the login command.", iface->name); return EINVAL; } else if (t->template->set_host_ip == SET_HOST_IP_OPT) { log_info("Optional iface.ipaddress for iface %s " - "not set.\n", iface->name); + "not set.", iface->name); return 0; } else { return EINVAL; @@ -113,14 +113,14 @@ static int get_hwaddress_from_netdev(char *netdev, char *hwaddress) (void *)&(s4->sin_addr), buf, INET_ADDRSTRLEN)) continue; - log_debug(4, "name %s addr %s\n", ifa->ifa_name, buf); + log_debug(4, "name %s addr %s", ifa->ifa_name, buf); break; case AF_INET6: s6 = (struct sockaddr_in6 *)(ifa->ifa_addr); if (!inet_ntop(ifa->ifa_addr->sa_family, (void *)&(s6->sin6_addr), buf, INET6_ADDRSTRLEN)) continue; - log_debug(4, "name %s addr %s\n", ifa->ifa_name, buf); + log_debug(4, "name %s addr %s", ifa->ifa_name, buf); break; default: continue; @@ -239,7 +239,7 @@ static int bind_conn_to_iface(iscsi_conn_t *conn, struct iface_rec *iface) if (setsockopt(conn->socket_fd, SOL_SOCKET, SO_BINDTODEVICE, session->netdev, strlen(session->netdev) + 1) < 0) { - log_error("Could not bind connection %d to %s\n", + log_error("Could not bind connection %d to %s", conn->id, session->netdev); return -1; } @@ -357,7 +357,7 @@ iscsi_io_tcp_poll(iscsi_conn_t *conn, int timeout_ms) len = sizeof(int); if (getsockopt(conn->socket_fd, SOL_SOCKET, SO_ERROR, (char *) &rc, &len) < 0) { - log_error("getsockopt for connect poll failed\n"); + log_error("getsockopt for connect poll failed"); return -1; } if (rc) { @@ -366,7 +366,7 @@ iscsi_io_tcp_poll(iscsi_conn_t *conn, int timeout_ms) conn->host, sizeof(conn->host), serv, sizeof(serv), NI_NUMERICHOST|NI_NUMERICSERV); - log_error("connect to %s:%s failed (%s)\n", + log_error("connect to %s:%s failed (%s)", conn->host, serv, strerror(rc)); return -rc; } diff --git a/usr/iscsi_net_util.c b/usr/iscsi_net_util.c index 6d0ebf9..848b4c6 100644 --- a/usr/iscsi_net_util.c +++ b/usr/iscsi_net_util.c @@ -188,7 +188,7 @@ int net_setup_netdev(char *netdev, char *local_ip, char *mask, char *gateway, int ret; if (!strlen(netdev)) { - log_error("No netdev name in fw entry.\n"); + log_error("No netdev name in fw entry."); return EINVAL; } @@ -203,13 +203,13 @@ int net_setup_netdev(char *netdev, char *local_ip, char *mask, char *gateway, * has already been handled (2 targets in IBFT may share one NIC) */ if (!inet_aton(local_ip, &sk_ipaddr.sin_addr)) { - log_error("Invalid or missing ipaddr in fw entry\n"); + log_error("Invalid or missing ipaddr in fw entry"); ret = EINVAL; goto done; } if (!inet_aton(mask, &sk_netmask.sin_addr)) { - log_error("Invalid or missing netmask in fw entry\n"); + log_error("Invalid or missing netmask in fw entry"); ret = EINVAL; goto done; } @@ -217,7 +217,7 @@ int net_setup_netdev(char *netdev, char *local_ip, char *mask, char *gateway, inet_aton("255.255.255.255", &sk_hostmask.sin_addr); if (!inet_aton(remote_ip, &sk_tgt_ipaddr.sin_addr)) { - log_error("Invalid or missing target ipaddr in fw entry\n"); + log_error("Invalid or missing target ipaddr in fw entry"); ret = EINVAL; goto done; } @@ -317,7 +317,7 @@ int net_ifup_netdev(char *netdev) int ret = 0; if (!strlen(netdev)) { - log_error("No netdev name in fw entry.\n"); + log_error("No netdev name in fw entry."); return EINVAL; } @@ -338,11 +338,11 @@ int net_ifup_netdev(char *netdev) } if (ifr.ifr_flags & IFF_UP) { - log_debug(3, "%s up\n", netdev); + log_debug(3, "%s up", netdev); goto done; } - log_debug(3, "bringing %s up\n", netdev); + log_debug(3, "bringing %s up", netdev); /* Bring up interface */ memset(&ifr, 0, sizeof(ifr)); diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c index c916ed8..3a37a48 100644 --- a/usr/iscsi_sysfs.c +++ b/usr/iscsi_sysfs.c @@ -137,7 +137,7 @@ static int read_transports(void) if (list_empty(&t->list)) free(t); else - log_error("Could not update %s.\n", + log_error("Could not update %s.", t->name); continue; } @@ -147,7 +147,7 @@ static int read_transports(void) if (list_empty(&t->list)) free(t); else - log_error("Could not update %s.\n", + log_error("Could not update %s.", t->name); continue; } @@ -272,7 +272,7 @@ uint32_t iscsi_sysfs_get_host_no_from_sid(uint32_t sid, int *err) if (!sysfs_lookup_devpath_by_subsys_id(devpath, sizeof(devpath), ISCSI_SESSION_SUBSYS, id)) { log_error("Could not lookup devpath for %s. Possible sysfs " - "incompatibility.\n", id); + "incompatibility.", id); *err = ISCSI_ERR_SYSFS_LOOKUP; return 0; } @@ -280,7 +280,7 @@ uint32_t iscsi_sysfs_get_host_no_from_sid(uint32_t sid, int *err) session_dev = sysfs_device_get(devpath); if (!session_dev) { log_error("Could not get dev for %s. Possible sysfs " - "incompatibility.\n", id); + "incompatibility.", id); *err = ISCSI_ERR_SYSFS_LOOKUP; return 0; } @@ -305,7 +305,7 @@ uint32_t iscsi_sysfs_get_host_no_from_sid(uint32_t sid, int *err) if (!host_dev) { log_error("Could not get host dev for %s. Possible " - "sysfs incompatibility.\n", id); + "sysfs incompatibility.", id); *err = ISCSI_ERR_SYSFS_LOOKUP; return 0; } @@ -741,7 +741,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, int host_no, ret = sysfs_get_str(host_id, ISCSI_HOST_SUBSYS, "hwaddress", iface->hwaddress, sizeof(iface->hwaddress)); if (ret) - log_debug(7, "could not read hwaddress for host%d\n", host_no); + log_debug(7, "could not read hwaddress for host%d", host_no); if (iface_kern_id) ret = sysfs_get_str(iface_kern_id, ISCSI_IFACE_SUBSYS, @@ -752,14 +752,14 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, int host_no, ret = sysfs_get_str(host_id, ISCSI_HOST_SUBSYS, "ipaddress", iface->ipaddress, sizeof(iface->ipaddress)); if (ret) - log_debug(7, "could not read local address for host%d\n", + log_debug(7, "could not read local address for host%d", host_no); /* if not found just print out default */ ret = sysfs_get_str(host_id, ISCSI_HOST_SUBSYS, "netdev", iface->netdev, sizeof(iface->netdev)); if (ret) - log_debug(7, "could not read netdev for host%d\n", host_no); + log_debug(7, "could not read netdev for host%d", host_no); /* * For drivers like qla4xxx we can only set the iname at the @@ -799,7 +799,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, int host_no, * global iname so we can just fill it in here. */ log_debug(7, "Could not read initiatorname for " - "host%d\n", host_no); + "host%d", host_no); /* optional so do not return error */ ret = 0; } @@ -825,7 +825,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, int host_no, iface->name, sizeof(iface->name)); if (ret) { log_debug(7, "could not read iface name for " - "session %s\n", session); + "session %s", session); /* * if the ifacename file is not there then we are * using a older kernel and can try to find the @@ -834,7 +834,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, int host_no, */ if (iface_get_by_net_binding(iface, iface)) log_debug(7, "Could not find iface for session " - "bound to:" iface_fmt "\n", + "bound to:" iface_fmt "", iface_str(iface)); } } @@ -1231,7 +1231,7 @@ int iscsi_sysfs_get_sid_from_path(char *session) return sid; if (lstat(session, &statb)) { - log_error("%s is an invalid session ID or path\n", session); + log_error("%s is an invalid session ID or path", session); exit(1); } @@ -1248,7 +1248,7 @@ int iscsi_sysfs_get_sid_from_path(char *session) dev = sysfs_device_get(devpath); if (!dev) { log_error("Could not get dev for %s. Possible sysfs " - "incompatibility.\n", devpath); + "incompatibility.", devpath); return -1; } @@ -1522,7 +1522,7 @@ int iscsi_sysfs_get_device_state(char *state, int host_no, int target, int lun) snprintf(id, sizeof(id), "%d:0:%d:%d", host_no, target, lun); if (sysfs_get_str(id, SCSI_SUBSYS, "state", state, SCSI_MAX_STATE_VALUE)) { - log_debug(3, "Could not read attr state for %s\n", id); + log_debug(3, "Could not read attr state for %s", id); return ISCSI_ERR_SYSFS_LOOKUP; } @@ -1543,7 +1543,7 @@ char *iscsi_sysfs_get_blockdev_from_lun(int host_no, int target, int lun) snprintf(id, sizeof(id), "%d:0:%d:%d", host_no, target, lun); if (!sysfs_lookup_devpath_by_subsys_id(devpath, sizeof(devpath), SCSI_SUBSYS, id)) { - log_debug(3, "Could not lookup devpath for %s %s\n", + log_debug(3, "Could not lookup devpath for %s %s", SCSI_SUBSYS, id); return NULL; } @@ -1571,7 +1571,7 @@ char *iscsi_sysfs_get_blockdev_from_lun(int host_no, int target, int lun) * 2.6.25 dropped the symlink and now block is a dir. */ if (lstat(path_full, &statbuf)) { - log_error("Could not stat block path %s err %d\n", + log_error("Could not stat block path %s err %d", path_full, errno); break; } @@ -1590,7 +1590,7 @@ char *iscsi_sysfs_get_blockdev_from_lun(int host_no, int target, int lun) /* it should not be this hard should it? :) */ blk_dirfd = opendir(path_full); if (!blk_dirfd) { - log_debug(3, "Could not open blk path %s\n", + log_debug(3, "Could not open blk path %s", path_full); break; } @@ -1626,7 +1626,7 @@ static uint32_t get_target_no_from_sid(uint32_t sid, int *err) snprintf(id, sizeof(id), "session%u", sid); if (!sysfs_lookup_devpath_by_subsys_id(devpath, sizeof(devpath), ISCSI_SESSION_SUBSYS, id)) { - log_debug(3, "Could not lookup devpath for %s %s\n", + log_debug(3, "Could not lookup devpath for %s %s", ISCSI_SESSION_SUBSYS, id); return 0; } @@ -1799,7 +1799,7 @@ int iscsi_sysfs_for_each_device(void *data, int host_no, uint32_t sid, snprintf(id, sizeof(id), "session%u", sid); if (!sysfs_lookup_devpath_by_subsys_id(devpath, sizeof(devpath), ISCSI_SESSION_SUBSYS, id)) { - log_debug(3, "Could not lookup devpath for %s %s\n", + log_debug(3, "Could not lookup devpath for %s %s", ISCSI_SESSION_SUBSYS, id); return ISCSI_ERR_SYSFS_LOOKUP; } @@ -1883,7 +1883,7 @@ pid_t iscsi_sysfs_scan_host(int hostno, int async) snprintf(id, sizeof(id), ISCSI_HOST_ID, hostno); sysfs_set_param(id, SCSI_HOST_SUBSYS, "scan", write_buf, strlen(write_buf)); - log_debug(4, "scanning host%d completed\n", hostno); + log_debug(4, "scanning host%d completed", hostno); } else if (pid > 0) { log_debug(4, "scanning host%d from pid %d", hostno, pid); } else diff --git a/usr/iscsi_util.c b/usr/iscsi_util.c index 9dbfbfd..a4f33cf 100644 --- a/usr/iscsi_util.c +++ b/usr/iscsi_util.c @@ -148,10 +148,10 @@ int increase_max_files(void) err = getrlimit(RLIMIT_NOFILE, &rl); if (err) { - log_debug(1, "Could not get file limit (err %d)\n", errno); + log_debug(1, "Could not get file limit (err %d)", errno); return errno; } - log_debug(1, "Max file limits %lu %lu\n", rl.rlim_cur, rl.rlim_max); + log_debug(1, "Max file limits %lu %lu", rl.rlim_cur, rl.rlim_max); if (rl.rlim_cur < ISCSI_MAX_FILES) rl.rlim_cur = ISCSI_MAX_FILES; @@ -160,7 +160,7 @@ int increase_max_files(void) err = setrlimit(RLIMIT_NOFILE, &rl); if (err) { - log_debug(1, "Could not set file limit to %lu/%lu (err %d)\n", + log_debug(1, "Could not set file limit to %lu/%lu (err %d)", rl.rlim_cur, rl.rlim_max, errno); return errno; } @@ -319,7 +319,7 @@ int __iscsi_match_session(node_rec_t *rec, char *targetname, unsigned sid) { if (!rec) { - log_debug(6, "no rec info to match\n"); + log_debug(6, "no rec info to match"); return 1; } diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c index 0cdc1bb..aa7cf07 100644 --- a/usr/iscsiadm.c +++ b/usr/iscsiadm.c @@ -278,7 +278,7 @@ static void kill_iscsid(int priority) if (rc) { iscsi_err_print_msg(rc); log_error("Could not stop iscsid. Trying sending iscsid " - "SIGTERM or SIGKILL signals manually\n"); + "SIGTERM or SIGKILL signals manually"); } } @@ -303,7 +303,7 @@ static int print_ifaces(struct iface_rec *iface, int info_level) if (iface) { err = iface_conf_read(iface); if (err) { - log_error("Could not read iface %s.\n", + log_error("Could not read iface %s.", iface->name); return err; } @@ -403,7 +403,7 @@ __logout_by_startup(void *data, struct list_head *list, * this is due to a HW driver or some other driver * not hooked in */ - log_debug(7, "could not read data for [%s,%s.%d]\n", + log_debug(7, "could not read data for [%s,%s.%d]", info->targetname, info->persistent_address, info->persistent_port); return -1; @@ -1240,7 +1240,7 @@ sw_discovery: case DISCOVERY_TYPE_ISNS: return do_isns(drec, ifaces, info_level, do_login, op); default: - log_debug(1, "Unknown Discovery Type : %d\n", drec->type); + log_debug(1, "Unknown Discovery Type : %d", drec->type); return ISCSI_ERR_UNKNOWN_DISCOVERY_TYPE; } } @@ -1286,7 +1286,7 @@ static int iface_apply_net_config(struct iface_rec *iface, int op) int fd; log_debug(8, "Calling iscsid, to apply net config for" - "iface.name = %s\n", iface->name); + "iface.name = %s", iface->name); if (op == OP_APPLY_ALL) iface_all = 1; @@ -1632,7 +1632,7 @@ static int delete_host_chap_info(uint32_t host_no, uint16_t chap_tbl_idx) goto exit_delete_chap; } - log_info("Deleteing CHAP index: %d\n", chap_tbl_idx); + log_info("Deleteing CHAP index: %d", chap_tbl_idx); rc = ipc->delete_chap(t->handle, host_no, chap_tbl_idx); if (rc < 0) { log_error("CHAP Delete failed."); @@ -2649,7 +2649,7 @@ static int exec_fw_disc_op(discovery_rec_t *drec, struct list_head *ifaces, rc = fw_get_targets(&targets); if (rc) { log_error("Could not get list of targets from firmware. " - "(err %d)\n", rc); + "(err %d)", rc); return rc; } rc = iface_create_ifaces_from_boot_contexts(&new_ifaces, &targets); @@ -2662,7 +2662,7 @@ discover_fw_tgts: rc = idbm_bind_ifaces_to_nodes(discovery_fw, drec, ifaces, &rec_list); if (rc) - log_error("Could not perform fw discovery.\n"); + log_error("Could not perform fw discovery."); else rc = exec_disc_op_on_recs(drec, &rec_list, info_level, do_login, op); @@ -2700,7 +2700,7 @@ static int exec_fw_op(discovery_rec_t *drec, struct list_head *ifaces, rc = fw_get_targets(&targets); if (rc) { log_error("Could not get list of targets from firmware. " - "(err %d)\n", rc); + "(err %d)", rc); return rc; } @@ -2709,7 +2709,7 @@ static int exec_fw_op(discovery_rec_t *drec, struct list_head *ifaces, rec = idbm_create_rec_from_boot_context(context); if (!rec) { log_error("Could not convert firmware info to " - "node record.\n"); + "node record."); rc = ISCSI_ERR_NOMEM; break; } @@ -3102,7 +3102,7 @@ static char *iscsi_ping_stat_strs[] = { static char *iscsi_ping_stat_to_str(uint32_t status) { if (status < 0 || status > ISCSI_PING_NO_ARP_RECEIVED) { - log_error("Invalid ping status %u\n", status); + log_error("Invalid ping status %u", status); return NULL; } diff --git a/usr/iscsid.c b/usr/iscsid.c index 033a71f..f8ffd23 100644 --- a/usr/iscsid.c +++ b/usr/iscsid.c @@ -193,7 +193,7 @@ static int sync_session(void *data, struct session_info *info) struct iscsi_transport *t; int rc, retries = 0; - log_debug(7, "sync session [%d][%s,%s.%d][%s]\n", info->sid, + log_debug(7, "sync session [%d][%s,%s.%d][%s]", info->sid, info->targetname, info->persistent_address, info->port, info->iface.hwaddress); @@ -235,7 +235,7 @@ static int sync_session(void *data, struct session_info *info) info->persistent_address, info->persistent_port, &info->iface)) { log_warning("Could not read data from db. Using default and " - "currently negotiated values\n"); + "currently negotiated values"); setup_rec_from_negotiated_values(&rec, info); iface_copy(&rec.iface, &info->iface); } else { @@ -332,7 +332,7 @@ static void missing_iname_warn(char *initiatorname_file) "iqn.yyyy-mm.<reversed domain name>[:identifier].\n\n" "Example: InitiatorName=iqn.2001-04.com.redhat:fc6.\n" "If using hardware iscsi like qla4xxx this message can be " - "ignored.\n", initiatorname_file, initiatorname_file); + "ignored.", initiatorname_file, initiatorname_file); } int main(int argc, char *argv[]) @@ -478,21 +478,21 @@ int main(int argc, char *argv[]) } if (gid && setgid(gid) < 0) { - log_error("Unable to setgid to %d\n", gid); + log_error("Unable to setgid to %d", gid); log_close(log_pid); exit(ISCSI_ERR); } if ((geteuid() == 0) && (getgroups(0, NULL))) { if (setgroups(0, NULL) != 0) { - log_error("Unable to drop supplementary group ids\n"); + log_error("Unable to drop supplementary group ids"); log_close(log_pid); exit(ISCSI_ERR); } } if (uid && setuid(uid) < 0) { - log_error("Unable to setuid to %d\n", uid); + log_error("Unable to setuid to %d", uid); log_close(log_pid); exit(ISCSI_ERR); } diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c index 0e91dee..75bcf22 100644 --- a/usr/iscsid_req.c +++ b/usr/iscsid_req.c @@ -249,7 +249,7 @@ int uip_broadcast(void *buf, size_t buf_len) err = read(fd, &rsp, sizeof(rsp)); if (err == sizeof(rsp)) { log_debug(3, "Broadcasted to uIP with length: %ld " - "cmd: 0x%x rsp: 0x%x\n", buf_len, + "cmd: 0x%x rsp: 0x%x", buf_len, rsp.command, rsp.err); err = 0; break; @@ -269,7 +269,7 @@ int uip_broadcast(void *buf, size_t buf_len) count); err = ISCSI_ERR_AGAIN; } else if (rsp.err != ISCSID_UIP_MGMT_IPC_DEVICE_UP) { - log_debug(3, "Device is not ready\n"); + log_debug(3, "Device is not ready"); err = ISCSI_ERR_AGAIN; } diff --git a/usr/iscsistart.c b/usr/iscsistart.c index 2ddbc1a..7ff2236 100644 --- a/usr/iscsistart.c +++ b/usr/iscsistart.c @@ -126,7 +126,7 @@ static int stop_event_loop(void) rc = iscsid_exec_req(&req, &rsp, 0); if (rc) { iscsi_err_print_msg(rc); - log_error("Could not stop event_loop\n"); + log_error("Could not stop event_loop"); } return rc; } @@ -287,22 +287,22 @@ static void catch_signal(int signo) static int check_params(char *initiatorname) { if (!initiatorname) { - log_error("InitiatorName not set. Exiting %s\n", program_name); + log_error("InitiatorName not set. Exiting %s", program_name); return EINVAL; } if (config_rec.tpgt == PORTAL_GROUP_TAG_UNKNOWN) { - log_error("Portal Group not set. Exiting %s\n", program_name); + log_error("Portal Group not set. Exiting %s", program_name); return EINVAL; } if (!strlen(config_rec.name)) { - log_error("TargetName not set. Exiting %s\n", program_name); + log_error("TargetName not set. Exiting %s", program_name); return EINVAL; } if (!strlen(config_rec.conn[0].address)) { - log_error("IP Address not set. Exiting %s\n", program_name); + log_error("IP Address not set. Exiting %s", program_name); return EINVAL; } @@ -472,7 +472,7 @@ int main(int argc, char *argv[]) mgmt_ipc_fd = mgmt_ipc_listen(); if (mgmt_ipc_fd < 0) { - log_error("Could not setup mgmt ipc\n"); + log_error("Could not setup mgmt ipc"); exit(ISCSI_ERR_NOMEM); } diff --git a/usr/login.c b/usr/login.c index b0be79b..8289b03 100644 --- a/usr/login.c +++ b/usr/login.c @@ -57,7 +57,7 @@ iscsi_add_text(struct iscsi_hdr *pdu, char *data, int max_data_length, if (text + length >= end) { log_warning("Failed to add login text " - "'%s=%s'\n", param, value); + "'%s=%s'", param, value); return 0; } @@ -168,7 +168,7 @@ resolve_address(char *host, char *port, struct sockaddr_storage *ss) if ((rc = getaddrinfo(host, port, &hints, &res))) { log_error("Cannot resolve host %s. getaddrinfo error: " - "[%s]\n", host, gai_strerror(rc)); + "[%s]", host, gai_strerror(rc)); return rc; } @@ -1556,10 +1556,10 @@ iscsi_login(iscsi_session_t *session, int cid, char *buffer, size_t bufsize, repoll: pfd.revents = 0; ret = poll(&pfd, 1, timeout); - log_debug(7, "%s: Poll return %d\n", __FUNCTION__, ret); + log_debug(7, "%s: Poll return %d", __FUNCTION__, ret); if (iscsi_timer_expired(&connection_timer)) { log_warning("Login response timeout. Waited %d " - "seconds and did not get reponse PDU.\n", + "seconds and did not get reponse PDU.", session->conn[0].active_timeout); c->ret = LOGIN_FAILED; return c->ret; @@ -1593,7 +1593,7 @@ repoll: } } else if (ret < 0) { - log_error("Login poll error.\n"); + log_error("Login poll error."); c->ret = LOGIN_FAILED; return c->ret; } diff --git a/usr/netlink.c b/usr/netlink.c index 3984727..57d4693 100644 --- a/usr/netlink.c +++ b/usr/netlink.c @@ -376,7 +376,7 @@ ksendtargets(uint64_t transport_handle, uint32_t host_no, struct sockaddr *addr) else if (addr->sa_family == PF_INET6) addrlen = sizeof(struct sockaddr_in6); else { - log_error("%s unknown addr family %d\n", + log_error("%s unknown addr family %d", __FUNCTION__, addr->sa_family); return -EINVAL; } @@ -386,7 +386,7 @@ ksendtargets(uint64_t transport_handle, uint32_t host_no, struct sockaddr *addr) iov[1].iov_len = sizeof(*ev) + addrlen; rc = __kipc_call(iov, 2); if (rc < 0) { - log_error("sendtargets failed rc%d\n", rc); + log_error("sendtargets failed rc%d", rc); return rc; } return 0; @@ -678,7 +678,7 @@ kset_host_param(uint64_t transport_handle, uint32_t host_no, sprintf(param_str, "%s", (char *)value); break; default: - log_error("invalid type %d\n", type); + log_error("invalid type %d", type); return -EINVAL; } ev->u.set_host_param.len = len = strlen(param_str) + 1; @@ -725,7 +725,7 @@ kset_param(uint64_t transport_handle, uint32_t sid, uint32_t cid, sprintf(param_str, "%s", (char *)value); break; default: - log_error("invalid type %d\n", type); + log_error("invalid type %d", type); return -EINVAL; } ev->u.set_param.len = len = strlen(param_str) + 1; @@ -873,7 +873,7 @@ ktransport_ep_connect(iscsi_conn_t *conn, int non_blocking) else if (dst_addr->sa_family == PF_INET6) addrlen = sizeof(struct sockaddr_in6); else { - log_error("%s unknown addr family %d\n", + log_error("%s unknown addr family %d", __FUNCTION__, dst_addr->sa_family); return -EINVAL; } @@ -1079,7 +1079,7 @@ ksend_ping(uint64_t transport_handle, uint32_t host_no, struct sockaddr *addr, else if (addr->sa_family == PF_INET6) addrlen = sizeof(struct sockaddr_in6); else { - log_error("%s unknown addr family %d\n", + log_error("%s unknown addr family %d", __FUNCTION__, addr->sa_family); return -EINVAL; } @@ -1520,7 +1520,7 @@ static int ctldev_handle(void) nlh = (struct nlmsghdr *)nlm_ev; ev = (struct iscsi_uevent *)NLMSG_DATA(nlm_ev); - log_debug(7, "%s got event type %u\n", __FUNCTION__, ev->type); + log_debug(7, "%s got event type %u", __FUNCTION__, ev->type); /* drivers like qla4xxx can be inserted after iscsid is started */ switch (ev->type) { case ISCSI_KEVENT_CREATE_SESSION: @@ -1563,15 +1563,15 @@ static int ctldev_handle(void) case ISCSI_KEVENT_HOST_EVENT: switch (ev->r.host_event.code) { case ISCSI_EVENT_LINKUP: - log_warning("Host%u: Link Up.\n", + log_warning("Host%u: Link Up.", ev->r.host_event.host_no); break; case ISCSI_EVENT_LINKDOWN: - log_warning("Host%u: Link Down.\n", + log_warning("Host%u: Link Down.", ev->r.host_event.host_no); break; default: - log_debug(7, "Host%u: Unknwon host event: %u.\n", + log_debug(7, "Host%u: Unknwon host event: %u.", ev->r.host_event.host_no, ev->r.host_event.code); } @@ -1611,7 +1611,7 @@ static int ctldev_handle(void) * nl interface. */ log_debug(1, "Could not verify connection %d:%d. Dropping " - "event.\n", sid, cid); + "event.", sid, cid); drop_data(nlh); return -ENXIO; } diff --git a/usr/strings.c b/usr/strings.c index 638cb4d..da5df28 100644 --- a/usr/strings.c +++ b/usr/strings.c @@ -74,7 +74,7 @@ int str_enlarge_data(struct str_buffer *s, int length) if (s) { s->data_length += length; if (s->data_length > s->allocated_length) { - log_debug(7, "enlarge buffer from %lu to %lu\n", + log_debug(7, "enlarge buffer from %lu to %lu", s->allocated_length, s->data_length); new_buf = realloc(s->buffer, s->data_length); if (!new_buf) { diff --git a/usr/sysfs.c b/usr/sysfs.c index bbb00c0..6520bf6 100644 --- a/usr/sysfs.c +++ b/usr/sysfs.c @@ -82,7 +82,7 @@ int sysfs_init(void) remove_trailing_chars(sysfs_path, '/'); } else strlcpy(sysfs_path, "/sys", sizeof(sysfs_path)); - dbg("sysfs_path='%s'\n", sysfs_path); + dbg("sysfs_path='%s'", sysfs_path); INIT_LIST_HEAD(&dev_list); INIT_LIST_HEAD(&attr_list); @@ -123,7 +123,7 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, if (pos == NULL) return; strlcpy(dev->kernel, &pos[1], sizeof(dev->kernel)); - dbg("kernel='%s'\n", dev->kernel); + dbg("kernel='%s'", dev->kernel); /* some devices have '!' in their name, change that to '/' */ pos = dev->kernel; @@ -138,7 +138,7 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, while (isdigit(pos[-1])) pos--; strlcpy(dev->kernel_number, pos, sizeof(dev->kernel_number)); - dbg("kernel_number='%s'\n", dev->kernel_number); + dbg("kernel_number='%s'", dev->kernel_number); } int sysfs_resolve_link(char *devpath, size_t size) @@ -155,11 +155,11 @@ int sysfs_resolve_link(char *devpath, size_t size) if (len <= 0) return -1; link_target[len] = '\0'; - dbg("path link '%s' points to '%s'\n", devpath, link_target); + dbg("path link '%s' points to '%s'", devpath, link_target); for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) ; - dbg("base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); + dbg("base '%s', tail '%s', back %i", devpath, &link_target[back * 3], back); for (i = 0; i <= back; i++) { char *pos = strrchr(devpath, '/'); @@ -167,7 +167,7 @@ int sysfs_resolve_link(char *devpath, size_t size) return -1; pos[0] = '\0'; } - dbg("after moving back '%s'\n", devpath); + dbg("after moving back '%s'", devpath); strlcat(devpath, "/", size); strlcat(devpath, &link_target[back * 3], size); return 0; @@ -195,7 +195,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strncmp(devpath, "/block/", 7) != 0) return NULL; - dbg("open '%s'\n", devpath); + dbg("open '%s'", devpath); strlcpy(devpath_real, devpath, sizeof(devpath_real)); remove_trailing_chars(devpath_real, '/'); if (devpath[0] == '\0' ) @@ -204,7 +204,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) /* look for device already in cache (we never put an untranslated path in the cache) */ list_for_each_entry(dev_loop, &dev_list, node) { if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg("found in cache '%s'\n", dev_loop->devpath); + dbg("found in cache '%s'", dev_loop->devpath); return dev_loop; } } @@ -213,7 +213,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strlcpy(path, sysfs_path, sizeof(path)); strlcat(path, devpath_real, sizeof(path)); if (lstat(path, &statbuf) != 0) { - dbg("stat '%s' failed: %s\n", path, strerror(errno)); + dbg("stat '%s' failed: %s", path, strerror(errno)); return NULL; } if (S_ISLNK(statbuf.st_mode)) { @@ -223,14 +223,14 @@ struct sysfs_device *sysfs_device_get(const char *devpath) /* now look for device in cache after path translation */ list_for_each_entry(dev_loop, &dev_list, node) { if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg("found in cache '%s'\n", dev_loop->devpath); + dbg("found in cache '%s'", dev_loop->devpath); return dev_loop; } } } /* it is a new device */ - dbg("new uncached device '%s'\n", devpath_real); + dbg("new uncached device '%s'", devpath_real); dev = malloc(sizeof(struct sysfs_device)); if (dev == NULL) return NULL; @@ -246,7 +246,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) if (len > 0) { /* get subsystem from "subsystem" link */ link_target[len] = '\0'; - dbg("subsystem link '%s' points to '%s'\n", link_path, link_target); + dbg("subsystem link '%s' points to '%s'", link_path, link_target); pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); @@ -275,13 +275,13 @@ struct sysfs_device *sysfs_device_get(const char *devpath) len = readlink(link_path, link_target, sizeof(link_target)); if (len > 0) { link_target[len] = '\0'; - dbg("driver link '%s' points to '%s'\n", link_path, link_target); + dbg("driver link '%s' points to '%s'", link_path, link_target); pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); } - dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'\n", dev->devpath, dev->subsystem, dev->driver); + dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'", dev->devpath, dev->subsystem, dev->driver); list_add(&dev->node, &dev_list); return dev; @@ -292,14 +292,14 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) char parent_devpath[PATH_SIZE]; char *pos; - dbg("open '%s'\n", dev->devpath); + dbg("open '%s'", dev->devpath); /* look if we already know the parent */ if (dev->parent != NULL) return dev->parent; strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); - dbg("'%s'\n", parent_devpath); + dbg("'%s'", parent_devpath); /* strip last element */ pos = strrchr(parent_devpath, '/'); @@ -310,12 +310,12 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) if (strncmp(parent_devpath, "/class", 6) == 0) { pos = strrchr(parent_devpath, '/'); if (pos == &parent_devpath[6] || pos == parent_devpath) { - dbg("/class top level, look for device link\n"); + dbg("/class top level, look for device link"); goto device_link; } } if (strcmp(parent_devpath, "/block") == 0) { - dbg("/block top level, look for device link\n"); + dbg("/block top level, look for device link"); goto device_link; } @@ -364,7 +364,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) ssize_t size; size_t sysfs_len; - dbg("open '%s'/'%s'\n", devpath, attr_name); + dbg("open '%s'/'%s'", devpath, attr_name); sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); if(sysfs_len >= sizeof(path_full)) sysfs_len = sizeof(path_full) - 1; @@ -376,23 +376,23 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* look for attribute in cache */ list_for_each_entry(attr_loop, &attr_list, node) { if (strcmp(attr_loop->path, path) == 0) { - dbg("found in cache '%s'\n", attr_loop->path); + dbg("found in cache '%s'", attr_loop->path); return attr_loop->value; } } /* store attribute in cache (also negatives are kept in cache) */ - dbg("new uncached attribute '%s'\n", path_full); + dbg("new uncached attribute '%s'", path_full); attr = malloc(sizeof(struct sysfs_attr)); if (attr == NULL) return NULL; memset(attr, 0x00, sizeof(struct sysfs_attr)); strlcpy(attr->path, path, sizeof(attr->path)); - dbg("add to cache '%s'\n", path_full); + dbg("add to cache '%s'", path_full); list_add(&attr->node, &attr_list); if (lstat(path_full, &statbuf) != 0) { - dbg("stat '%s' failed: %s\n", path_full, strerror(errno)); + dbg("stat '%s' failed: %s", path_full, strerror(errno)); goto out; } @@ -407,7 +407,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) link_target[len] = '\0'; pos = strrchr(link_target, '/'); if (pos != NULL) { - dbg("cache '%s' with link value '%s'\n", path_full, value); + dbg("cache '%s' with link value '%s'", path_full, value); strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); attr->value = attr->value_local; } @@ -426,7 +426,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* read attribute value */ fd = open(path_full, O_RDONLY); if (fd < 0) { - dbg("attribute '%s' can not be opened\n", path_full); + dbg("attribute '%s' can not be opened", path_full); goto out; } size = read(fd, value, sizeof(value)); @@ -439,7 +439,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* got a valid value, store and return it */ value[size] = '\0'; remove_trailing_chars(value, '\n'); - dbg("cache '%s' with attribute value '%s'\n", path_full, value); + dbg("cache '%s' with attribute value '%s'", path_full, value); strlcpy(attr->value_local, value, sizeof(attr->value_local)); attr->value = attr->value_local; @@ -554,14 +554,14 @@ char *sysfs_get_value(const char *id, char *subsys, char *param) if (!sysfs_lookup_devpath_by_subsys_id(devpath, sizeof(devpath), subsys, id)) { - log_debug(3, "Could not lookup devpath for %s %s\n", + log_debug(3, "Could not lookup devpath for %s %s", subsys, id); return NULL; } sysfs_value = sysfs_attr_get_value(devpath, param); if (!sysfs_value) { - log_debug(3, "Could not read attr %s on path %s\n", + log_debug(3, "Could not read attr %s on path %s", param, devpath); return NULL; } @@ -675,7 +675,7 @@ int sysfs_set_param(char *id, char *subsys, char *attr_name, if (!sysfs_lookup_devpath_by_subsys_id(devpath, sizeof(devpath), subsys, id)) { - log_debug(3, "Could not lookup devpath for %s %s\n", + log_debug(3, "Could not lookup devpath for %s %s", subsys, id); return EIO; } @@ -688,19 +688,19 @@ int sysfs_set_param(char *id, char *subsys, char *attr_name, strlcat(path_full, attr_name, sizeof(path_full)); if (lstat(path_full, &statbuf)) { - log_debug(3, "Could not stat %s\n", path_full); + log_debug(3, "Could not stat %s", path_full); return errno; } if ((statbuf.st_mode & S_IWUSR) == 0) { - log_error("Could not write to %s. Invalid permissions.\n", + log_error("Could not write to %s. Invalid permissions.", path_full); return EACCES; } fd = open(path_full, O_WRONLY); if (fd < 0) { - log_error("Could not open %s err %d\n", path_full, errno); + log_error("Could not open %s err %d", path_full, errno); return errno; } diff --git a/usr/transport.c b/usr/transport.c index e778a6e..c96d9c6 100644 --- a/usr/transport.c +++ b/usr/transport.c @@ -149,7 +149,7 @@ int transport_probe_for_offload(void) for (i = 0; ifni[i].if_index && ifni[i].if_name; i++) { struct if_nameindex *n = &ifni[i]; - log_debug(6, "kmod probe found %s\n", n->if_name); + log_debug(6, "kmod probe found %s", n->if_name); strlcpy(if_hwaddr.ifr_name, n->if_name, IFNAMSIZ); if (ioctl(sockfd, SIOCGIFHWADDR, &if_hwaddr) < 0) @@ -281,12 +281,12 @@ int set_transport_template(struct iscsi_transport *t) if (!strcmp(tmpl->name, t->name)) { t->template = tmpl; - log_debug(3, "Matched transport %s\n", t->name); + log_debug(3, "Matched transport %s", t->name); return 0; } } log_error("Could not find template for %s. An updated iscsiadm " - "is probably needed.\n", t->name); + "is probably needed.", t->name); return ENOSYS; } diff --git a/usr/uip_mgmt_ipc.c b/usr/uip_mgmt_ipc.c index f3074ee..1dfc6d0 100644 --- a/usr/uip_mgmt_ipc.c +++ b/usr/uip_mgmt_ipc.c @@ -26,7 +26,7 @@ int uip_broadcast_params(struct iscsi_transport *t, { struct iscsid_uip_broadcast broadcast; - log_debug(3, "broadcasting to uip\n"); + log_debug(3, "broadcasting to uip"); memset(&broadcast, 0, sizeof(broadcast)); |