From 71592f2cac0857b9ddf0e88304b6cd6063721aca Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 1 Nov 2007 17:07:07 +0000 Subject: [PATCH] Cleanups, debug imporvements and minor fixes git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@214 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/config.c | 12 +- iscsi-scst/kernel/conn.c | 6 +- iscsi-scst/kernel/digest.c | 8 +- iscsi-scst/kernel/event.c | 2 +- iscsi-scst/kernel/iscsi.c | 105 +++++++++--------- iscsi-scst/kernel/iscsi_dbg.h | 26 ++++- iscsi-scst/kernel/nthread.c | 76 ++++++------- iscsi-scst/kernel/param.c | 12 +- iscsi-scst/kernel/session.c | 4 +- iscsi-scst/kernel/target.c | 8 +- qla2x00t-full_perf.patch | 9 +- qla2x00t-release.patch | 11 +- qla2x00t/qla2x00-target/qla2x00t.c | 4 +- scst/include/scst_debug.h | 68 ++++++------ scst/src/dev_handlers/scst_cdrom.c | 4 +- scst/src/dev_handlers/scst_changer.c | 2 +- scst/src/dev_handlers/scst_dev_handler.h | 5 +- scst/src/dev_handlers/scst_disk.c | 4 +- scst/src/dev_handlers/scst_modisk.c | 4 +- scst/src/dev_handlers/scst_processor.c | 2 +- scst/src/dev_handlers/scst_raid.c | 2 +- scst/src/dev_handlers/scst_tape.c | 2 +- scst/src/dev_handlers/scst_user.c | 60 +++++----- scst/src/dev_handlers/scst_vdisk.c | 134 +++++++++++------------ scst/src/scst_debug.c | 6 +- scst/src/scst_lib.c | 70 ++++++------ scst/src/scst_main.c | 94 ++++++++-------- scst/src/scst_priv.h | 7 +- scst/src/scst_proc.c | 78 ++++++------- scst/src/scst_targ.c | 114 +++++++++---------- usr/fileio/common.c | 66 +++++------ usr/fileio/debug.c | 8 +- usr/fileio/debug.h | 49 +++++---- usr/fileio/fileio.c | 27 +++-- 34 files changed, 555 insertions(+), 534 deletions(-) diff --git a/iscsi-scst/kernel/config.c b/iscsi-scst/kernel/config.c index 03c465801..24d2a3bf0 100644 --- a/iscsi-scst/kernel/config.c +++ b/iscsi-scst/kernel/config.c @@ -32,6 +32,7 @@ static struct scst_proc_log iscsi_proc_local_trace_tbl[] = { TRACE_CONN_OC, "conn" }, { TRACE_D_IOV, "iov" }, { TRACE_D_DUMP_PDU, "pdu" }, + { TRACE_NET_PG, "net_page" }, { 0, NULL } }; @@ -113,7 +114,7 @@ static __init int iscsi_proc_log_entry_build(struct scst_tgt_template *templ) p = scst_create_proc_entry(root, ISCSI_PROC_VERSION_NAME, &iscsi_version_proc_data); if (p == NULL) { - PRINT_ERROR_PR("Not enough memory to register " + PRINT_ERROR("Not enough memory to register " "target driver %s entry %s in /proc", templ->name, ISCSI_PROC_VERSION_NAME); res = -ENOMEM; @@ -126,7 +127,7 @@ static __init int iscsi_proc_log_entry_build(struct scst_tgt_template *templ) p = scst_create_proc_entry(root, ISCSI_PROC_LOG_ENTRY_NAME, &iscsi_log_proc_data); if (p == NULL) { - PRINT_ERROR_PR("Not enough memory to register " + PRINT_ERROR("Not enough memory to register " "target driver %s entry %s in /proc", templ->name, ISCSI_PROC_LOG_ENTRY_NAME); res = -ENOMEM; @@ -390,7 +391,7 @@ static long ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (cmd == ADD_TARGET) if (target) { err = -EEXIST; - PRINT_ERROR_PR("Target %u already exist!", id); + PRINT_ERROR("Target %u already exist!", id); goto out_unlock; } @@ -401,7 +402,7 @@ static long ioctl(struct file *file, unsigned int cmd, unsigned long arg) } if (!target) { - PRINT_ERROR_PR("can't find the target %u", id); + PRINT_ERROR("can't find the target %u", id); err = -EINVAL; goto out_unlock; } @@ -442,7 +443,7 @@ static long ioctl(struct file *file, unsigned int cmd, unsigned long arg) break; default: - PRINT_ERROR_PR("invalid ioctl cmd %x", cmd); + PRINT_ERROR("invalid ioctl cmd %x", cmd); err = -EINVAL; } @@ -457,6 +458,7 @@ out: static int release(struct inode *inode, struct file *filp) { + TRACE(TRACE_MGMT, "%s", "Releasing allocated resources"); target_del_all(); return 0; } diff --git a/iscsi-scst/kernel/conn.c b/iscsi-scst/kernel/conn.c index d1cb29fbd..9aeb9585e 100644 --- a/iscsi-scst/kernel/conn.c +++ b/iscsi-scst/kernel/conn.c @@ -175,7 +175,7 @@ static void iscsi_state_change(struct sock *sk) if (sk->sk_state != TCP_ESTABLISHED) { if (!conn->closing) { - PRINT_ERROR_PR("Connection with initiator %s (%p) " + PRINT_ERROR("Connection with initiator %s (%p) " "unexpectedly closed!", conn->session->initiator_name, conn); mark_conn_closed(conn); @@ -238,7 +238,7 @@ static int iscsi_socket_bind(struct iscsi_conn *conn) conn->sock = SOCKET_I(conn->file->f_dentry->d_inode); if (conn->sock->ops->sendpage == NULL) { - PRINT_ERROR_PR("Socket for sid %llu doesn't support sendpage()", + PRINT_ERROR("Socket for sid %llu doesn't support sendpage()", session->sid); res = -EINVAL; goto out; @@ -385,7 +385,7 @@ int conn_del(struct iscsi_session *session, struct conn_info *info) if (!conn) return err; - PRINT_INFO_PR("Deleting connection with initiator %s (%p)", + PRINT_INFO("Deleting connection with initiator %s (%p)", conn->session->initiator_name, conn); mark_conn_closed(conn); diff --git a/iscsi-scst/kernel/digest.c b/iscsi-scst/kernel/digest.c index d58278b0a..2241ab7fb 100644 --- a/iscsi-scst/kernel/digest.c +++ b/iscsi-scst/kernel/digest.c @@ -31,7 +31,7 @@ void digest_alg_available(unsigned int *val) #endif if ((*val & DIGEST_CRC32C) && !crc32c) { - PRINT_ERROR_PR("%s", "CRC32C digest algorithm not available " + PRINT_ERROR("%s", "CRC32C digest algorithm not available " "in kernel"); *val |= ~DIGEST_CRC32C; } @@ -70,7 +70,7 @@ static u32 evaluate_crc32_from_sg(struct scatterlist *sg, int total, #ifdef DEBUG_DIGEST_FAILURES if (((scst_random() % 100000) == 752)) { - PRINT_INFO_PR("%s", "Simulating digest failure"); + PRINT_INFO("%s", "Simulating digest failure"); return 0; } #endif @@ -143,7 +143,7 @@ int digest_rx_header(struct iscsi_cmnd *cmnd) crc = digest_header(&cmnd->pdu); if (crc != cmnd->hdigest) { - PRINT_ERROR_PR("%s", "RX header digest failed"); + PRINT_ERROR("%s", "RX header digest failed"); return -EIO; } else TRACE_DBG("RX header digest OK for cmd %p", cmnd); @@ -184,7 +184,7 @@ int digest_rx_data(struct iscsi_cmnd *cmnd) crc = digest_data(req, cmnd->pdu.datasize, offset); if (crc != cmnd->ddigest) { - PRINT_ERROR_PR("%s", "RX data digest failed"); + PRINT_ERROR("%s", "RX data digest failed"); res = -EIO; } else TRACE_DBG("RX data digest OK for cmd %p", cmnd); diff --git a/iscsi-scst/kernel/event.c b/iscsi-scst/kernel/event.c index 19e8b472c..0a4575c9e 100644 --- a/iscsi-scst/kernel/event.c +++ b/iscsi-scst/kernel/event.c @@ -113,7 +113,7 @@ int __init event_init(void) THIS_MODULE); #endif if (!nl) { - PRINT_ERROR_PR("%s", "netlink_kernel_create() failed"); + PRINT_ERROR("%s", "netlink_kernel_create() failed"); return -ENOMEM; } else return 0; diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 68ff0bc61..bc62b847e 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -145,7 +145,7 @@ void cmnd_free(struct iscsi_cmnd *cmnd) if (unlikely(cmnd->on_write_list)) { struct iscsi_scsi_cmd_hdr *req = cmnd_hdr(cmnd); - PRINT_ERROR_PR("cmnd %p still on some list?, %x, %x, %x, %x, %x, %x, %x", + PRINT_ERROR("cmnd %p still on some list?, %x, %x, %x, %x, %x, %x, %x", cmnd, req->opcode, req->scb[0], req->flags, req->itt, be32_to_cpu(req->data_length), req->cmd_sn, be32_to_cpu(cmnd->pdu.datasize)); @@ -153,7 +153,7 @@ void cmnd_free(struct iscsi_cmnd *cmnd) if (cmnd->parent_req) { struct iscsi_scsi_cmd_hdr *req = cmnd_hdr(cmnd->parent_req); - PRINT_ERROR_PR("%p %x %u", req, req->opcode, req->scb[0]); + PRINT_ERROR("%p %x %u", req, req->opcode, req->scb[0]); } sBUG(); } @@ -199,7 +199,7 @@ void cmnd_done(struct iscsi_cmnd *cmnd) scst_tgt_cmd_done(cmnd->scst_cmd); break; default: - PRINT_ERROR_PR("Unexpected cmnd scst state %d", + PRINT_ERROR("Unexpected cmnd scst state %d", cmnd->scst_state); sBUG(); break; @@ -445,7 +445,7 @@ static void iscsi_cmnd_init_write(struct iscsi_cmnd *rsp, int flags) LIST_HEAD(head); if (unlikely(rsp->on_write_list)) { - PRINT_ERROR_PR("cmd already on write list (%x %x %x %x %u %u " + PRINT_ERROR("cmd already on write list (%x %x %x %x %u %u " "%u %u %u %u %u %d %d", cmnd_itt(rsp), cmnd_ttt(rsp), cmnd_opcode(rsp), cmnd_scsicode(rsp), rsp->r2t_sn, @@ -680,7 +680,7 @@ static int check_cmd_sn(struct iscsi_cmnd *cmnd) TRACE_DBG("%d(%d)", cmd_sn, session->exp_cmd_sn); if ((s32)(cmd_sn - session->exp_cmd_sn) >= 0) return 0; - PRINT_ERROR_PR("sequence error (%x,%x)", cmd_sn, session->exp_cmd_sn); + PRINT_ERROR("sequence error (%x,%x)", cmd_sn, session->exp_cmd_sn); return -ISCSI_REASON_PROTOCOL_ERROR; } @@ -778,7 +778,7 @@ static void cmnd_remove_hash(struct iscsi_cmnd *cmnd) list_del(&cmnd->hash_list_entry); cmnd->hashed = 0; } else { - PRINT_ERROR_PR("%p:%x not found", cmnd, cmnd_itt(cmnd)); + PRINT_ERROR("%p:%x not found", cmnd, cmnd_itt(cmnd)); } spin_unlock(&session->cmnd_hash_lock); @@ -838,7 +838,7 @@ static void cmnd_prepare_skip_pdu_set_resid(struct iscsi_cmnd *req) rsp = get_rsp_cmnd(req); rsp_hdr = (struct iscsi_scsi_rsp_hdr *)&rsp->pdu.bhs; if (cmnd_opcode(rsp) != ISCSI_OP_SCSI_RSP) { - PRINT_ERROR_PR("unexpected response command %u", cmnd_opcode(rsp)); + PRINT_ERROR("unexpected response command %u", cmnd_opcode(rsp)); return; } @@ -878,7 +878,7 @@ static int cmnd_prepare_recv_pdu(struct iscsi_conn *conn, if ((offset >= bufflen) || (offset + size > bufflen)) { - PRINT_ERROR_PR("Wrong ltn (%u %u %u)", offset, size, bufflen); + PRINT_ERROR("Wrong ltn (%u %u %u)", offset, size, bufflen); mark_conn_closed(conn); res = -EIO; goto out; @@ -910,7 +910,7 @@ static int cmnd_prepare_recv_pdu(struct iscsi_conn *conn, size -= conn->read_iov[i].iov_len; offset = 0; if (++i >= ISCSI_CONN_IOV_MAX) { - PRINT_ERROR_PR("Initiator %s violated negotiated " + PRINT_ERROR("Initiator %s violated negotiated " "parameters by sending too much data (size " "left %d)", conn->session->initiator_name, size); mark_conn_closed(conn); @@ -1046,14 +1046,14 @@ static int noop_out_start(struct iscsi_cmnd *cmnd) * We don't request a NOP-Out by sending a NOP-In. * See 10.18.2 in the draft 20. */ - PRINT_ERROR_PR("initiator bug %x", cmnd_itt(cmnd)); + PRINT_ERROR("initiator bug %x", cmnd_itt(cmnd)); err = -ISCSI_REASON_PROTOCOL_ERROR; goto out; } if (cmnd_itt(cmnd) == cpu_to_be32(ISCSI_RESERVED_TAG)) { if (!(cmnd->pdu.bhs.opcode & ISCSI_OP_IMMEDIATE)) - PRINT_ERROR_PR("%s","initiator bug!"); + PRINT_ERROR("%s","initiator bug!"); spin_lock(&conn->session->sn_lock); __update_stat_sn(cmnd); err = check_cmd_sn(cmnd); @@ -1061,7 +1061,7 @@ static int noop_out_start(struct iscsi_cmnd *cmnd) if (err) goto out; } else if ((err = cmnd_insert_hash(cmnd)) < 0) { - PRINT_ERROR_PR("Can't insert in hash: ignore this request %x", + PRINT_ERROR("Can't insert in hash: ignore this request %x", cmnd_itt(cmnd)); goto out; } @@ -1183,7 +1183,7 @@ static int scsi_cmnd_start(struct iscsi_cmnd *req) scst_cmd->queue_type = SCST_CMD_QUEUE_UNTAGGED; break; default: - PRINT_ERROR_PR("Unknown task code %x, use ORDERED instead", + PRINT_ERROR("Unknown task code %x, use ORDERED instead", req_hdr->flags & ISCSI_CMD_ATTR_MASK); scst_cmd->queue_type = SCST_CMD_QUEUE_ORDERED; break; @@ -1218,7 +1218,7 @@ static int scsi_cmnd_start(struct iscsi_cmnd *req) dir = scst_cmd_get_data_direction(scst_cmd); if (dir != SCST_DATA_WRITE) { if (!(req_hdr->flags & ISCSI_CMD_FINAL) || req->pdu.datasize) { - PRINT_ERROR_PR("Unexpected unsolicited data (ITT %x " + PRINT_ERROR("Unexpected unsolicited data (ITT %x " "CDB %x", cmnd_itt(req), req_hdr->scb[0]); create_sense_rsp(req, ABORTED_COMMAND, 0xc, 0xc); cmnd_prepare_skip_pdu_set_resid(req); @@ -1234,7 +1234,7 @@ static int scsi_cmnd_start(struct iscsi_cmnd *req) req->sg = scst_cmd_get_sg(scst_cmd); req->bufflen = scst_cmd_get_bufflen(scst_cmd); if (req->r2t_length > req->bufflen) { - PRINT_ERROR_PR("req->r2t_length %d > req->bufflen %d", + PRINT_ERROR("req->r2t_length %d > req->bufflen %d", req->r2t_length, req->bufflen); req->r2t_length = req->bufflen; } @@ -1245,7 +1245,7 @@ static int scsi_cmnd_start(struct iscsi_cmnd *req) if (!session->sess_param.immediate_data && req->pdu.datasize) { - PRINT_ERROR_PR("Initiator %s violated negotiated paremeters: " + PRINT_ERROR("Initiator %s violated negotiated paremeters: " "forbidden immediate data sent (ITT %x, op %x)", session->initiator_name, cmnd_itt(req), req_hdr->scb[0]); res = -EINVAL; @@ -1254,7 +1254,7 @@ static int scsi_cmnd_start(struct iscsi_cmnd *req) if (session->sess_param.initial_r2t && !(req_hdr->flags & ISCSI_CMD_FINAL)) { - PRINT_ERROR_PR("Initiator %s violated negotiated paremeters: " + PRINT_ERROR("Initiator %s violated negotiated paremeters: " "initial R2T is required (ITT %x, op %x)", session->initiator_name, cmnd_itt(req), req_hdr->scb[0]); res = -EINVAL; @@ -1263,7 +1263,7 @@ static int scsi_cmnd_start(struct iscsi_cmnd *req) if (req->pdu.datasize) { if (dir != SCST_DATA_WRITE) { - PRINT_ERROR_PR("pdu.datasize(%d) >0, but dir(%x) isn't WRITE", + PRINT_ERROR("pdu.datasize(%d) >0, but dir(%x) isn't WRITE", req->pdu.datasize, dir); create_sense_rsp(req, ABORTED_COMMAND, 0xc, 0xc); cmnd_prepare_skip_pdu_set_resid(req); @@ -1296,13 +1296,13 @@ static int data_out_start(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd) cmnd->cmd_req = req = cmnd_find_hash(conn->session, req_hdr->itt, req_hdr->ttt); if (!req) { - PRINT_ERROR_PR("unable to find scsi task %x %x", + PRINT_ERROR("unable to find scsi task %x %x", cmnd_itt(cmnd), cmnd_ttt(cmnd)); goto skip_pdu; } if (req->r2t_length < cmnd->pdu.datasize) { - PRINT_ERROR_PR("Invalid data len %x %u %u", cmnd_itt(req), + PRINT_ERROR("Invalid data len %x %u %u", cmnd_itt(req), cmnd->pdu.datasize, req->r2t_length); mark_conn_closed(conn); res = -EINVAL; @@ -1310,7 +1310,7 @@ static int data_out_start(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd) } if (req->r2t_length + offset != cmnd_write_size(req)) { - PRINT_ERROR_PR("Wrong cmd lengths (%x %u %u %u)", + PRINT_ERROR("Wrong cmd lengths (%x %u %u %u)", cmnd_itt(req), req->r2t_length, offset, cmnd_write_size(req)); mark_conn_closed(conn); @@ -1323,7 +1323,7 @@ static int data_out_start(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd) /* Check unsolicited burst data */ if ((req_hdr->ttt == cpu_to_be32(ISCSI_RESERVED_TAG)) && (req->pdu.bhs.flags & ISCSI_FLG_FINAL)) { - PRINT_ERROR_PR("unexpected data from %x %x", + PRINT_ERROR("unexpected data from %x %x", cmnd_itt(cmnd), cmnd_ttt(cmnd)); mark_conn_closed(conn); res = -EINVAL; @@ -1380,7 +1380,7 @@ static void data_out_end(struct iscsi_cmnd *cmnd) req->outstanding_r2t, req->r2t_length); /* ToDo : proper error handling */ if (!(req_hdr->flags & ISCSI_FLG_FINAL) && (req->r2t_length == 0)) - PRINT_ERROR_PR("initiator error %x", cmnd_itt(req)); + PRINT_ERROR("initiator error %x", cmnd_itt(req)); if (!(req_hdr->flags & ISCSI_FLG_FINAL)) goto out; @@ -1409,13 +1409,14 @@ static inline int __cmnd_abort(struct iscsi_cmnd *cmnd) if (cmnd->tmfabort) goto out; - TRACE(TRACE_MGMT, "Aborting cmd %p, scst_cmd %p (scst state %x, " - "itt %x, op %x, r2t_len %x, CDB op %x, size to write %u, " - "is_unsolicited_data %u, outstanding_r2t %u)", - cmnd, cmnd->scst_cmd, cmnd->scst_state, cmnd_itt(cmnd), - cmnd_opcode(cmnd), cmnd->r2t_length, cmnd_scsicode(cmnd), - cmnd_write_size(cmnd), cmnd->is_unsolicited_data, - cmnd->outstanding_r2t); + TRACE_MGMT_DBG("Aborting cmd %p, scst_cmd %p (scst state %x, " + "ref_cnt %d, net_ref_cnt %d, itt %x, op %x, r2t_len %x, " + "CDB op %x, size to write %u, is_unsolicited_data %u, " + "outstanding_r2t %u)", cmnd, cmnd->scst_cmd, cmnd->scst_state, + atomic_read(&cmnd->ref_cnt), atomic_read(&cmnd->net_ref_cnt), + cmnd_itt(cmnd), cmnd_opcode(cmnd), cmnd->r2t_length, + cmnd_scsicode(cmnd), cmnd_write_size(cmnd), + cmnd->is_unsolicited_data, cmnd->outstanding_r2t); iscsi_extracheck_is_rd_thread(cmnd->conn); @@ -1452,7 +1453,7 @@ static int cmnd_abort(struct iscsi_cmnd *req) struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd); if (req_hdr->lun != hdr->lun) { - PRINT_ERROR_PR("ABORT TASK: LUN mismatch: req LUN " + PRINT_ERROR("ABORT TASK: LUN mismatch: req LUN " "%Lx, cmd LUN %Lx, rtt %u", req_hdr->lun, hdr->lun, req_hdr->rtt); err = ISCSI_RESPONSE_FUNCTION_REJECTED; @@ -1461,7 +1462,7 @@ static int cmnd_abort(struct iscsi_cmnd *req) if (before(req_hdr->cmd_sn, hdr->cmd_sn) || (req_hdr->cmd_sn == hdr->cmd_sn)) { - PRINT_ERROR_PR("ABORT TASK: SN mismatch: req SN %x, " + PRINT_ERROR("ABORT TASK: SN mismatch: req SN %x, " "cmd SN %x, rtt %u", req_hdr->cmd_sn, hdr->cmd_sn, req_hdr->rtt); err = ISCSI_RESPONSE_FUNCTION_REJECTED; @@ -1587,7 +1588,7 @@ static void execute_task_management(struct iscsi_cmnd *req) if ((function != ISCSI_FUNCTION_ABORT_TASK) && (req_hdr->rtt != ISCSI_RESERVED_TAG)) { - PRINT_ERROR_PR("Invalid RTT %x (TM fn %x)", req_hdr->rtt, + PRINT_ERROR("Invalid RTT %x (TM fn %x)", req_hdr->rtt, function); err = -1; goto reject; @@ -1717,7 +1718,7 @@ static void logout_exec(struct iscsi_cmnd *req) struct iscsi_cmnd *rsp; struct iscsi_logout_rsp_hdr *rsp_hdr; - PRINT_INFO_PR("Logout received from initiator %s", + PRINT_INFO("Logout received from initiator %s", req->conn->session->initiator_name); TRACE_DBG("%p", req); @@ -1765,7 +1766,7 @@ static void iscsi_cmnd_exec(struct iscsi_cmnd *cmnd) req_cmnd_release(cmnd); break; default: - PRINT_ERROR_PR("unexpected cmnd op %x", cmnd_opcode(cmnd)); + PRINT_ERROR("unexpected cmnd op %x", cmnd_opcode(cmnd)); req_cmnd_release(cmnd); break; } @@ -1866,7 +1867,7 @@ void cmnd_tx_start(struct iscsi_cmnd *cmnd) cmnd_send_pdu(conn, cmnd); break; default: - PRINT_ERROR_PR("unexpected cmnd op %x", cmnd_opcode(cmnd)); + PRINT_ERROR("unexpected cmnd op %x", cmnd_opcode(cmnd)); break; } @@ -1894,13 +1895,13 @@ void cmnd_tx_end(struct iscsi_cmnd *cmnd) case ISCSI_OP_LOGOUT_RSP: break; default: - PRINT_ERROR_PR("unexpected cmnd op %x", cmnd_opcode(cmnd)); + PRINT_ERROR("unexpected cmnd op %x", cmnd_opcode(cmnd)); sBUG(); break; } if (cmnd->should_close_conn) { - PRINT_INFO_PR("Closing connection at initiator %s request", + PRINT_INFO("Closing connection at initiator %s request", conn->session->initiator_name); mark_conn_closed(conn); } @@ -1953,12 +1954,12 @@ static void iscsi_session_push_cmnd(struct iscsi_cmnd *cmnd) } else { cmnd->pending = 1; if (before(cmd_sn, session->exp_cmd_sn)) { /* close the conn */ - PRINT_ERROR_PR("unexpected cmd_sn (%u,%u)", cmd_sn, + PRINT_ERROR("unexpected cmd_sn (%u,%u)", cmd_sn, session->exp_cmd_sn); } if (after(cmd_sn, session->exp_cmd_sn + session->max_queued_cmnds)) { - PRINT_ERROR_PR("too large cmd_sn (%u,%u)", cmd_sn, + PRINT_ERROR("too large cmd_sn (%u,%u)", cmd_sn, session->exp_cmd_sn); } @@ -1983,7 +1984,7 @@ static int check_segment_length(struct iscsi_cmnd *cmnd) struct iscsi_session *session = conn->session; if (cmnd->pdu.datasize > session->sess_param.max_recv_data_length) { - PRINT_ERROR_PR("Initiator %s violated negotiated parameters: " + PRINT_ERROR("Initiator %s violated negotiated parameters: " "data too long (ITT %x, datasize %u, " "max_recv_data_length %u", session->initiator_name, cmnd_itt(cmnd), cmnd->pdu.datasize, @@ -2040,7 +2041,7 @@ int cmnd_rx_start(struct iscsi_cmnd *cmnd) if (unlikely(rc < 0)) { struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd); - PRINT_ERROR_PR("Error %d (iSCSI opcode %x, ITT %x, op %x)", rc, + PRINT_ERROR("Error %d (iSCSI opcode %x, ITT %x, op %x)", rc, cmnd_opcode(cmnd), cmnd_itt(cmnd), (cmnd_opcode(cmnd) == ISCSI_OP_SCSI_CMD ? hdr->scb[0] : -1)); @@ -2082,7 +2083,7 @@ void cmnd_rx_end(struct iscsi_cmnd *cmnd) req_cmnd_release(cmnd); break; default: - PRINT_ERROR_PR("unexpected cmnd op %x", cmnd_opcode(cmnd)); + PRINT_ERROR("unexpected cmnd op %x", cmnd_opcode(cmnd)); req_cmnd_release(cmnd); break; } @@ -2240,7 +2241,7 @@ static int iscsi_xmit_response(struct scst_cmd *scst_cmd) resp_flags, req->bufflen, req->sg); if ((req->bufflen != 0) && !(resp_flags & SCST_TSC_FLAG_STATUS)) { - PRINT_ERROR_PR("%s", "Sending DATA without STATUS is unsupported"); + PRINT_ERROR("%s", "Sending DATA without STATUS is unsupported"); scst_set_cmd_error(scst_cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); resp_flags = scst_cmd_get_tgt_resp_flags(scst_cmd); @@ -2313,7 +2314,7 @@ static void iscsi_send_task_mgmt_resp(struct iscsi_cmnd *req, int status) (struct iscsi_task_mgt_hdr *)&req->pdu.bhs; struct iscsi_task_rsp_hdr *rsp_hdr; - TRACE(TRACE_MGMT, "req %p, status %d", req, status); + TRACE(TRACE_MGMT, "TM req %p finished, status %d", req, status); rsp = iscsi_cmnd_create_rsp_cmnd(req); rsp_hdr = (struct iscsi_task_rsp_hdr *)&rsp->pdu.bhs; @@ -2360,7 +2361,7 @@ static void iscsi_task_mgmt_fn_done(struct scst_mgmt_cmd *scst_mcmd) scst_mgmt_cmd_get_tgt_priv(scst_mcmd); int status = iscsi_get_mgmt_response(scst_mgmt_cmd_get_status(scst_mcmd)); - TRACE(TRACE_MGMT, "scst_mcmd %p, status %d", scst_mcmd, + TRACE_MGMT_DBG("req %p, scst_mcmd %p, scst status %d", req, scst_mcmd, scst_mgmt_cmd_get_status(scst_mcmd)); iscsi_send_task_mgmt_resp(req, status); @@ -2408,13 +2409,13 @@ static __init int iscsi_run_threads(int count, char *name, int (*fn)(void *)) thr = kmalloc(sizeof(*thr), GFP_KERNEL); if (!thr) { res = -ENOMEM; - PRINT_ERROR_PR("Failed to allocate thr %d", res); + PRINT_ERROR("Failed to allocate thr %d", res); goto out; } thr->thr = kthread_run(fn, NULL, "%s%d", name, i); if (IS_ERR(thr->thr)) { res = PTR_ERR(thr->thr); - PRINT_ERROR_PR("kthread_create() failed: %d", res); + PRINT_ERROR("kthread_create() failed: %d", res); kfree(thr); goto out; } @@ -2445,17 +2446,17 @@ static int __init iscsi_init(void) int err; int num; - PRINT_INFO_PR("iSCSI SCST Target - version %s", ISCSI_VERSION_STRING); + PRINT_INFO("iSCSI SCST Target - version %s", ISCSI_VERSION_STRING); #ifdef NET_PAGE_CALLBACKS_DEFINED err = net_set_get_put_page_callbacks(iscsi_get_page_callback, iscsi_put_page_callback); if (err != 0) { - PRINT_INFO_PR("Unable to set page callbackes: %d", err); + PRINT_INFO("Unable to set page callbackes: %d", err); goto out; } #else - PRINT_INFO_PR("%s", "Patch put_page_callback-.patch " + PRINT_INFO("%s", "Patch put_page_callback-.patch " "not applied on your kernel. Running in the performance " "degraded mode. Refer README file for details"); #endif @@ -2463,7 +2464,7 @@ static int __init iscsi_init(void) BUILD_BUG_ON(MAX_DATA_SEG_LEN != (ISCSI_CONN_IOV_MAX< #define TRACE_D_READ 0x80000000 @@ -23,20 +25,18 @@ #define TRACE_CONN_OC 0x20000000 #define TRACE_D_IOV 0x10000000 #define TRACE_D_DUMP_PDU 0x08000000 +#define TRACE_NET_PG 0x04000000 #define TRACE_D_DATA (TRACE_D_READ | TRACE_D_WRITE) #define TRACE_ALL_NO_DATA (TRACE_ALL & ~TRACE_D_IOV & ~TRACE_D_DUMP_PDU & ~TRACE_D_DATA) -#define LOG_PREFIX "iscsi-scst" - #ifdef DEBUG #define ISCSI_DEFAULT_LOG_FLAGS (TRACE_FUNCTION | TRACE_LINE | TRACE_PID | \ TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MGMT_DEBUG | \ TRACE_MINOR | TRACE_SPECIAL | TRACE_CONN_OC) #else -#define ISCSI_DEFAULT_LOG_FLAGS (TRACE_FUNCTION | TRACE_PID | \ - TRACE_OUT_OF_MEM | TRACE_MGMT | \ +#define ISCSI_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \ TRACE_MINOR | TRACE_SPECIAL) #endif @@ -59,7 +59,22 @@ do { \ if (trace_flag & TRACE_CONN_OC) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ + { \ + __tflag = NO_FLAG; \ + } \ + PRINT(NO_FLAG, "%s" format, __tflag, args); \ + } \ +} while(0) + +#define TRACE_NET_PAGE(format, args...) \ +do { \ + if (trace_flag & TRACE_NET_PG) \ + { \ + char *__tflag = LOG_FLAG; \ + if (debug_print_prefix(trace_flag, LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -69,6 +84,7 @@ do { \ #else /* defined(DEBUG) || defined(TRACING) */ #define TRACE_CONN_CLOSE(format, args...) {} +#define TRACE_NET_PAGE(format, args...) {} #endif #endif diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index 359f5d22f..429357416 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -62,7 +62,7 @@ static void close_conn(struct iscsi_conn *conn) TRACE_ENTRY(); - TRACE_CONN_CLOSE("conn %p, conn_ref_cnt=%d", conn, + TRACE_CONN_CLOSE("Closing connection %p (conn_ref_cnt=%d)", conn, atomic_read(&conn->conn_ref_cnt)); iscsi_extracheck_is_rd_thread(conn); @@ -86,8 +86,8 @@ static void close_conn(struct iscsi_conn *conn) struct list_head *pending_list = &session->pending_list; struct iscsi_cmnd *tmp; - TRACE_CONN_CLOSE("Disposing pending commands on conn " - "%p, conn_ref_cnt=%d", conn, + TRACE_CONN_CLOSE("Disposing pending commands on " + "connection %p (conn_ref_cnt=%d)", conn, atomic_read(&conn->conn_ref_cnt)); list_for_each_entry_safe(cmnd, tmp, pending_list, @@ -172,7 +172,7 @@ static void close_conn(struct iscsi_conn *conn) msleep(50); } - TRACE_CONN_CLOSE("Notifying user space about closing conn %p", conn); + TRACE_CONN_CLOSE("Notifying user space about closing connection %p", conn); event_send(target->tid, session->sid, conn->cid, E_CONN_CLOSE, 0); mutex_lock(&target->target_mutex); @@ -248,7 +248,7 @@ static int do_recv(struct iscsi_conn *conn, int state) "conn %p", res, conn); break; default: - PRINT_ERROR_PR("sock_recvmsg() failed: %d", res); + PRINT_ERROR("sock_recvmsg() failed: %d", res); mark_conn_closed(conn); break; } @@ -283,7 +283,7 @@ static int rx_hdigest(struct iscsi_conn *conn) int res = digest_rx_header(cmnd); if (unlikely(res != 0)) { - PRINT_ERROR_PR("rx header digest for initiator %s failed " + PRINT_ERROR("rx header digest for initiator %s failed " "(%d)", conn->session->initiator_name, res); mark_conn_closed(conn); } @@ -397,7 +397,7 @@ static int recv(struct iscsi_conn *conn) } break; default: - PRINT_ERROR_PR("%d %x", conn->read_state, cmnd_opcode(cmnd)); + PRINT_ERROR("%d %x", conn->read_state, cmnd_opcode(cmnd)); sBUG(); } @@ -408,7 +408,7 @@ static int recv(struct iscsi_conn *conn) goto out; if (conn->read_size) { - PRINT_ERROR_PR("%d %x %d", res, cmnd_opcode(cmnd), conn->read_size); + PRINT_ERROR("%d %x %d", res, cmnd_opcode(cmnd), conn->read_size); sBUG(); } @@ -540,13 +540,13 @@ void iscsi_get_page_callback(struct page *page) struct iscsi_cmnd *cmd = (struct iscsi_cmnd*)page->net_priv; int v; - TRACE_DBG("cmd %p, page %p, _count %d, new net_ref_cnt %d", + TRACE_NET_PAGE("cmd %p, page %p, _count %d, new net_ref_cnt %d", cmd, page, atomic_read(&page->_count), atomic_read(&cmd->net_ref_cnt)+1); v = atomic_inc_return(&cmd->net_ref_cnt); if (v == 1) { - TRACE_DBG("getting cmd %p for page %p", cmd, page); + TRACE_NET_PAGE("getting cmd %p for page %p", cmd, page); cmnd_get(cmd); } } @@ -555,19 +555,30 @@ void iscsi_put_page_callback(struct page *page) { struct iscsi_cmnd *cmd = (struct iscsi_cmnd*)page->net_priv; - TRACE_DBG("cmd %p, page %p, _count %d, new net_ref_cnt %d", + TRACE_NET_PAGE("cmd %p, page %p, _count %d, new net_ref_cnt %d", cmd, page, atomic_read(&page->_count), atomic_read(&cmd->net_ref_cnt)-1); if (atomic_dec_and_test(&cmd->net_ref_cnt)) { int i, sg_cnt = get_pgcnt(cmd->bufflen, cmd->sg[0].offset); for(i = 0; i < sg_cnt; i++) { - TRACE_DBG("Clearing page %p", cmd->sg[i].page); + TRACE_NET_PAGE("Clearing page %p", cmd->sg[i].page); cmd->sg[i].page->net_priv = NULL; } cmnd_put(cmd); } } + +static void check_net_priv(struct iscsi_cmnd *cmd, struct page *page) +{ + if (atomic_read(&cmd->net_ref_cnt) == 0) { + TRACE_DBG("%s", "sendpage() not called get_page(), " + "zeroing net_priv"); + page->net_priv = NULL; + } +} +#else +static inline void check_net_priv(struct iscsi_cmnd *cmd, struct page *page) {} #endif /* This is partially taken from the Ardis code. */ @@ -607,7 +618,7 @@ retry: set_fs(KERNEL_DS); res = vfs_writev(file, (struct iovec __user *)iop, count, &off); set_fs(oldfs); - TRACE(TRACE_D_DATA, "%#Lx:%u: %d(%ld)", + TRACE(TRACE_D_WRITE, "%#Lx:%u: %d(%ld)", (unsigned long long) conn->session->sid, conn->cid, res, (long) iop->iov_len); if (unlikely(res <= 0)) { @@ -642,7 +653,7 @@ retry: sg = write_cmnd->sg; if (sg == NULL) { - PRINT_ERROR_PR("%s", "warning data missing!"); + PRINT_ERROR("%s", "warning data missing!"); return 0; } offset = conn->write_offset; @@ -667,7 +678,7 @@ retry: #ifdef NET_PAGE_CALLBACKS_DEFINED if (unlikely((sg[idx].page->net_priv != NULL) && (sg[idx].page->net_priv != ref_cmd))) { - PRINT_ERROR_PR("net_priv isn't NULL and != ref_cmd " + PRINT_ERROR("net_priv isn't NULL and != ref_cmd " "(write_cmnd %p, ref_cmd %p, sg %p, idx %d, " "net_priv %p)", write_cmnd, ref_cmd, sg, idx, sg[idx].page->net_priv); @@ -679,7 +690,7 @@ retry: if (size <= sendsize) { retry2: res = sendpage(sock, sg[idx].page, offset, size, flags); - TRACE(TRACE_D_DATA, "%s %#Lx:%u: %d(%lu,%u,%u)", + TRACE(TRACE_D_WRITE, "%s %#Lx:%u: %d(%lu,%u,%u)", sock->ops->sendpage ? "sendpage" : "sock_no_sendpage", (unsigned long long)conn->session->sid, conn->cid, res, sg[idx].page->index, offset, size); @@ -689,13 +700,7 @@ retry2: else goto out_res; } -#ifdef NET_PAGE_CALLBACKS_DEFINED - if (atomic_read(&ref_cmd->net_ref_cnt) == 0) { - TRACE_DBG("%s", "sendpage() not called " - "get_page(), zeroing net_priv"); - sg[idx].page->net_priv = NULL; - } -#endif + check_net_priv(ref_cmd, sg[idx].page); if (res == size) { conn->write_size = 0; return saved_size; @@ -708,7 +713,7 @@ retry2: retry1: res = sendpage(sock, sg[idx].page, offset, sendsize, flags | MSG_MORE); - TRACE(TRACE_D_DATA, "%s %#Lx:%u: %d(%lu,%u,%u)", + TRACE(TRACE_D_WRITE, "%s %#Lx:%u: %d(%lu,%u,%u)", sock->ops->sendpage ? "sendpage" : "sock_no_sendpage", (unsigned long long ) conn->session->sid, conn->cid, res, sg[idx].page->index, offset, sendsize); @@ -718,13 +723,7 @@ retry1: else goto out_res; } -#ifdef NET_PAGE_CALLBACKS_DEFINED - if (atomic_read(&ref_cmd->net_ref_cnt) == 0) { - TRACE_DBG("%s", "sendpage() not called get_page(), " - "zeroing net_priv"); - sg[idx].page->net_priv = NULL; - } -#endif + check_net_priv(ref_cmd, sg[idx].page); if (res == sendsize) { idx++; offset = 0; @@ -742,12 +741,7 @@ out_iov: return saved_size - size; out_res: -#ifdef NET_PAGE_CALLBACKS_DEFINED - if (atomic_read(&ref_cmd->net_ref_cnt) == 0) { - TRACE_DBG("sendpage() returned %d, zeroing net_priv", res); - sg[idx].page->net_priv = NULL; - } -#endif + check_net_priv(ref_cmd, sg[idx].page); if (res == -EAGAIN) goto out; /* else go through */ @@ -757,7 +751,7 @@ err: if (!conn->closing) #endif { - PRINT_ERROR_PR("error %d at sid:cid %#Lx:%u, cmnd %p", res, + PRINT_ERROR("error %d at sid:cid %#Lx:%u, cmnd %p", res, (unsigned long long)conn->session->sid, conn->cid, conn->write_cmnd); } @@ -778,7 +772,7 @@ static int exit_tx(struct iscsi_conn *conn, int res) if (!conn->closing) #endif { - PRINT_ERROR_PR("Sending data failed: initiator %s, " + PRINT_ERROR("Sending data failed: initiator %s, " "write_size %d, write_state %d, res %d", conn->session->initiator_name, conn->write_size, conn->write_state, res); @@ -892,7 +886,7 @@ int iscsi_send(struct iscsi_conn *conn) res = tx_ddigest(cmnd, TX_END); break; default: - PRINT_ERROR_PR("%d %d %x", res, conn->write_state, + PRINT_ERROR("%d %d %x", res, conn->write_state, cmnd_opcode(cmnd)); sBUG(); } @@ -904,7 +898,7 @@ int iscsi_send(struct iscsi_conn *conn) goto out; if (conn->write_size) { - PRINT_ERROR_PR("%d %x %u", res, cmnd_opcode(cmnd), + PRINT_ERROR("%d %x %u", res, cmnd_opcode(cmnd), conn->write_size); sBUG(); } diff --git a/iscsi-scst/kernel/param.c b/iscsi-scst/kernel/param.c index 15cb47a76..2150dbec6 100644 --- a/iscsi-scst/kernel/param.c +++ b/iscsi-scst/kernel/param.c @@ -21,7 +21,7 @@ do { \ if (!info->partial || (info->partial & 1 << key_##word)) \ if (iparam[key_##word] < min || \ iparam[key_##word] > max) { \ - PRINT_ERROR_PR("%s: %u is out of range (%u %u)",\ + PRINT_ERROR("%s: %u is out of range (%u %u)",\ #word, iparam[key_##word], min, max); \ iparam[key_##word] = min; \ } \ @@ -63,21 +63,21 @@ static const char *get_digest_name(int val) static void log_params(struct iscsi_sess_param *param) { - PRINT_INFO_PR("Negotiated parameters: InitialR2T %s, ImmediateData %s, " + PRINT_INFO("Negotiated parameters: InitialR2T %s, ImmediateData %s, " "MaxConnections %d, MaxRecvDataSegmentLength %d, " "MaxXmitDataSegmentLength %d, ", get_bool_name(param->initial_r2t), get_bool_name(param->immediate_data), param->max_connections, param->max_recv_data_length, param->max_xmit_data_length); - PRINT_INFO_PR(" MaxBurstLength %d, FirstBurstLength %d, " + PRINT_INFO(" MaxBurstLength %d, FirstBurstLength %d, " "DefaultTime2Wait %d, DefaultTime2Retain %d, ", param->max_burst_length, param->first_burst_length, param->default_wait_time, param->default_retain_time); - PRINT_INFO_PR(" MaxOutstandingR2T %d, DataPDUInOrder %s, " + PRINT_INFO(" MaxOutstandingR2T %d, DataPDUInOrder %s, " "DataSequenceInOrder %s, ErrorRecoveryLevel %d, ", param->max_outstanding_r2t, get_bool_name(param->data_pdu_inorder), get_bool_name(param->data_sequence_inorder), param->error_recovery_level); - PRINT_INFO_PR(" HeaderDigest %s, DataDigest %s, OFMarker %s, " + PRINT_INFO(" HeaderDigest %s, DataDigest %s, OFMarker %s, " "IFMarker %s, OFMarkInt %d, IFMarkInt %d", get_digest_name(param->header_digest), get_digest_name(param->data_digest), @@ -191,7 +191,7 @@ static int trgt_param(struct iscsi_target *target, struct iscsi_param_info *info trgt_param_set(target, info); prm = &target->trgt_param; - PRINT_INFO_PR("Target parameter changed: queued_cmnds %d", + PRINT_INFO("Target parameter changed: queued_cmnds %d", prm->queued_cmnds); } else trgt_param_get(&target->trgt_param, info); diff --git a/iscsi-scst/kernel/session.c b/iscsi-scst/kernel/session.c index ce20ee09f..6a5b3a35f 100644 --- a/iscsi-scst/kernel/session.c +++ b/iscsi-scst/kernel/session.c @@ -84,7 +84,7 @@ static int iscsi_session_alloc(struct iscsi_target *target, struct session_info session->scst_sess = scst_register_session(target->scst_tgt, 0, name, NULL, NULL); if (session->scst_sess == NULL) { - PRINT_ERROR_PR("%s", "scst_register_session() failed"); + PRINT_ERROR("%s", "scst_register_session() failed"); err = -ENOMEM; goto err; } @@ -151,7 +151,7 @@ int session_del(struct iscsi_target *target, u64 sid) return -ENOENT; if (!list_empty(&session->conn_list)) { - PRINT_ERROR_PR("%llu still have connections", + PRINT_ERROR("%llu still have connections", (unsigned long long)session->sid); return -EBUSY; } diff --git a/iscsi-scst/kernel/target.c b/iscsi-scst/kernel/target.c index c0ac29a76..1f2f830ff 100644 --- a/iscsi-scst/kernel/target.c +++ b/iscsi-scst/kernel/target.c @@ -88,12 +88,12 @@ static int iscsi_target_create(struct target_info *info, u32 tid) TRACE_MGMT_DBG("Creating target tid %u, name %s", tid, name); if (!(len = strlen(name))) { - PRINT_ERROR_PR("The length of the target name is zero %u", tid); + PRINT_ERROR("The length of the target name is zero %u", tid); goto out; } if (!try_module_get(THIS_MODULE)) { - PRINT_ERROR_PR("Fail to get module %u", tid); + PRINT_ERROR("Fail to get module %u", tid); goto out; } @@ -118,7 +118,7 @@ static int iscsi_target_create(struct target_info *info, u32 tid) target->scst_tgt = scst_register(&iscsi_template, target->name); if (!target->scst_tgt) { - PRINT_ERROR_PR("%s", "scst_register() failed"); + PRINT_ERROR("%s", "scst_register() failed"); goto out_free; } @@ -216,7 +216,7 @@ void target_del_all(void) TRACE_ENTRY(); - TRACE(TRACE_MGMT, "%s", "Deleting all targets"); + TRACE_MGMT_DBG("%s", "Deleting all targets"); /* Complete brain damage, ToDo */ while(1) { diff --git a/qla2x00t-full_perf.patch b/qla2x00t-full_perf.patch index fab800ccb..9f989ef64 100644 --- a/qla2x00t-full_perf.patch +++ b/qla2x00t-full_perf.patch @@ -1,17 +1,16 @@ Index: qla2x00t/qla2x00-target/Makefile =================================================================== ---- qla2x00t/qla2x00-target/Makefile (revision 324) +--- qla2x00t/qla2x00-target/Makefile (revision 213) +++ qla2x00t/qla2x00-target/Makefile (working copy) -@@ -35,10 +35,10 @@ INSTALL_DIR := /lib/modules/$(shell unam +@@ -35,9 +35,9 @@ EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_T - EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_TARGET_SUPPORT -Wextra -Wno-unused-parameter + INSTALL_DIR := /lib/modules/$(shell uname -r)/extra -EXTRA_CFLAGS += -DEXTRACHECKS +#EXTRA_CFLAGS += -DEXTRACHECKS #EXTRA_CFLAGS += -DTRACING - -EXTRA_CFLAGS += -DDEBUG_TGT -g +#EXTRA_CFLAGS += -DDEBUG_TGT -g #EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD - #EXTRA_CFLAGS += -DDEBUG_SRR + ifeq ($(KVER),) diff --git a/qla2x00t-release.patch b/qla2x00t-release.patch index 9c266ff0b..ecf4161a7 100644 --- a/qla2x00t-release.patch +++ b/qla2x00t-release.patch @@ -1,18 +1,17 @@ Index: qla2x00t/qla2x00-target/Makefile =================================================================== ---- qla2x00t/qla2x00-target/Makefile (revision 324) +--- qla2x00t/qla2x00-target/Makefile (revision 213) +++ qla2x00t/qla2x00-target/Makefile (working copy) -@@ -35,10 +35,10 @@ INSTALL_DIR := /lib/modules/$(shell unam +@@ -35,9 +35,9 @@ EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_T - EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_TARGET_SUPPORT -Wextra -Wno-unused-parameter + INSTALL_DIR := /lib/modules/$(shell uname -r)/extra -EXTRA_CFLAGS += -DEXTRACHECKS -#EXTRA_CFLAGS += -DTRACING +-EXTRA_CFLAGS += -DDEBUG_TGT -g +#EXTRA_CFLAGS += -DEXTRACHECKS +EXTRA_CFLAGS += -DTRACING - --EXTRA_CFLAGS += -DDEBUG_TGT -g +#EXTRA_CFLAGS += -DDEBUG_TGT -g #EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD - #EXTRA_CFLAGS += -DDEBUG_SRR + ifeq ($(KVER),) diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index d04f8035f..e375a1bd0 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -53,8 +53,8 @@ TRACE_MINOR | TRACE_SPECIAL) #else # ifdef TRACING -#define Q2T_DEFAULT_LOG_FLAGS (TRACE_FUNCTION | TRACE_PID | \ - TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MINOR | TRACE_SPECIAL) +#define Q2T_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MINOR | \ + TRACE_SPECIAL) # endif #endif diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index 10527ae27..ea509d149 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -125,9 +125,16 @@ #define PRINT(log_flag, format, args...) printk(log_flag format "\n", ## args); #define PRINTN(log_flag, format, args...) printk(log_flag format, ## args); +#ifdef LOG_PREFIX +#define __LOG_PREFIX LOG_PREFIX +#else +#define __LOG_PREFIX NULL +#endif + #if defined(DEBUG) || defined(TRACING) -extern int debug_print_prefix(unsigned long trace_flag, const char *func, int line); +extern int debug_print_prefix(unsigned long trace_flag, const char *prefix, + const char *func, int line); extern void debug_print_buffer(const void *data, int len); #define TRACE(trace, format, args...) \ @@ -135,7 +142,8 @@ do { \ if (trace_flag & (trace)) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -148,7 +156,8 @@ do { \ char *__tflag = log_flag; \ if (trace_flag & (trace)) \ { \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -161,7 +170,8 @@ do { \ if (trace_flag & TRACE_BUFF) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -175,7 +185,8 @@ do { \ if (trace_flag & (flag)) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -199,7 +210,8 @@ do { \ if (trace_flag & TRACE_MEMORY) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -212,7 +224,8 @@ do { \ if (trace_flag & TRACE_DEBUG) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -225,7 +238,8 @@ do { \ if (trace_flag & (TRACE_DEBUG|TRACE_SPECIAL)) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -238,7 +252,8 @@ do { \ if (trace_flag & TRACE_MGMT_DEBUG) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -251,7 +266,8 @@ do { \ if (trace_flag & (TRACE_MGMT_DEBUG|TRACE_SPECIAL)) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -259,28 +275,6 @@ do { \ } \ } while(0) -#define PRINT_ERROR_PR(format, args...) \ -do { \ - if (ERROR_FLAG != LOG_FLAG) \ - { \ - TRACE_LOG_FLAG(LOG_FLAG, trace_flag, "%s: ***ERROR*** " format, \ - LOG_PREFIX, args); \ - } \ - TRACE_LOG_FLAG(ERROR_FLAG, trace_flag, "%s: ***ERROR*** " format, \ - LOG_PREFIX, args); \ -} while(0) - -#define PRINT_INFO_PR(format, args...) \ -do { \ - if (INFO_FLAG != LOG_FLAG) \ - { \ - TRACE_LOG_FLAG(LOG_FLAG, trace_flag, "%s: " \ - format, LOG_PREFIX, args); \ - } \ - TRACE_LOG_FLAG(INFO_FLAG, trace_flag, "%s: " \ - format, LOG_PREFIX, args); \ -} while(0) - #define PRINT_ERROR(format, args...) \ do { \ if (ERROR_FLAG != LOG_FLAG) \ @@ -375,17 +369,21 @@ do { \ #define TRACE_EXIT_RES(res) {} #define TRACE_EXIT_HRES(res) {} -#define PRINT_INFO_PR(format, args...) \ +#ifdef LOG_PREFIX + +#define PRINT_INFO(format, args...) \ do { \ PRINT(INFO_FLAG, "%s: " format, LOG_PREFIX, args); \ } while(0) -#define PRINT_ERROR_PR(format, args...) \ +#define PRINT_ERROR(format, args...) \ do { \ PRINT(ERROR_FLAG, "%s: ***ERROR*** " \ format, LOG_PREFIX, args); \ } while(0) +#else + #define PRINT_INFO(format, args...) \ do { \ PRINT(INFO_FLAG, format, args); \ @@ -397,6 +395,8 @@ do { \ format, args); \ } while(0) +#endif /* LOG_PREFIX */ + #endif /* DEBUG */ #if defined(DEBUG) && defined(CONFIG_DEBUG_SLAB) diff --git a/scst/src/dev_handlers/scst_cdrom.c b/scst/src/dev_handlers/scst_cdrom.c index 7f593e01e..5e6c55c6b 100644 --- a/scst/src/dev_handlers/scst_cdrom.c +++ b/scst/src/dev_handlers/scst_cdrom.c @@ -80,7 +80,7 @@ int cdrom_attach(struct scst_device *dev) if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } @@ -123,7 +123,7 @@ int cdrom_attach(struct scst_device *dev) break; } if (!--retries) { - PRINT_ERROR_PR("UA not clear after %d retries", + PRINT_ERROR("UA not clear after %d retries", SCST_DEV_UA_RETRIES); params->block_shift = CDROM_DEF_BLOCK_SHIFT; // res = -ENODEV; diff --git a/scst/src/dev_handlers/scst_changer.c b/scst/src/dev_handlers/scst_changer.c index 40666faeb..2e6bd3cb2 100644 --- a/scst/src/dev_handlers/scst_changer.c +++ b/scst/src/dev_handlers/scst_changer.c @@ -65,7 +65,7 @@ int changer_attach(struct scst_device *dev) if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } diff --git a/scst/src/dev_handlers/scst_dev_handler.h b/scst/src/dev_handlers/scst_dev_handler.h index d74846b2f..89a6e8138 100644 --- a/scst/src/dev_handlers/scst_dev_handler.h +++ b/scst/src/dev_handlers/scst_dev_handler.h @@ -18,7 +18,8 @@ TRACE_LINE | TRACE_FUNCTION | TRACE_MGMT | TRACE_MINOR | \ TRACE_MGMT_DEBUG | TRACE_SPECIAL) #else -#define SCST_DEFAULT_DEV_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MINOR) +#define SCST_DEFAULT_DEV_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \ + TRACE_MINOR | TRACE_SPECIAL) #endif static unsigned long dh_trace_flag = SCST_DEFAULT_DEV_LOG_FLAGS; @@ -72,7 +73,7 @@ static int scst_dev_handler_build_std_proc(struct scst_dev_type *dev_type) p = scst_create_proc_entry(root, DEV_HANDLER_LOG_ENTRY_NAME, &dev_handler_log_proc_data); if (p == NULL) { - PRINT_ERROR_PR("Not enough memory to register dev " + PRINT_ERROR("Not enough memory to register dev " "handler %s entry %s in /proc", dev_type->name, DEV_HANDLER_LOG_ENTRY_NAME); res = -ENOMEM; diff --git a/scst/src/dev_handlers/scst_disk.c b/scst/src/dev_handlers/scst_disk.c index b28ffe565..851448a0e 100644 --- a/scst/src/dev_handlers/scst_disk.c +++ b/scst/src/dev_handlers/scst_disk.c @@ -156,7 +156,7 @@ int disk_attach(struct scst_device *dev) if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } @@ -199,7 +199,7 @@ int disk_attach(struct scst_device *dev) break; } if (!--retries) { - PRINT_ERROR_PR("UA not clear after %d retries", + PRINT_ERROR("UA not clear after %d retries", SCST_DEV_UA_RETRIES); res = -ENODEV; goto out_free_buf; diff --git a/scst/src/dev_handlers/scst_modisk.c b/scst/src/dev_handlers/scst_modisk.c index e1c0df9f8..61f673394 100644 --- a/scst/src/dev_handlers/scst_modisk.c +++ b/scst/src/dev_handlers/scst_modisk.c @@ -156,7 +156,7 @@ int modisk_attach(struct scst_device *dev) if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } @@ -211,7 +211,7 @@ int modisk_attach(struct scst_device *dev) break; } if (!--retries) { - PRINT_ERROR_PR("UA not clear after %d retries", + PRINT_ERROR("UA not clear after %d retries", SCST_DEV_UA_RETRIES); goto out_free_buf; } diff --git a/scst/src/dev_handlers/scst_processor.c b/scst/src/dev_handlers/scst_processor.c index 15c7dab55..5de25edae 100644 --- a/scst/src/dev_handlers/scst_processor.c +++ b/scst/src/dev_handlers/scst_processor.c @@ -65,7 +65,7 @@ int processor_attach(struct scst_device *dev) if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } diff --git a/scst/src/dev_handlers/scst_raid.c b/scst/src/dev_handlers/scst_raid.c index 8bf826622..a6209e933 100644 --- a/scst/src/dev_handlers/scst_raid.c +++ b/scst/src/dev_handlers/scst_raid.c @@ -65,7 +65,7 @@ int raid_attach(struct scst_device *dev) if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } diff --git a/scst/src/dev_handlers/scst_tape.c b/scst/src/dev_handlers/scst_tape.c index 8850f678c..0de4e338e 100644 --- a/scst/src/dev_handlers/scst_tape.c +++ b/scst/src/dev_handlers/scst_tape.c @@ -158,7 +158,7 @@ int tape_attach(struct scst_device *dev) if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 63ac04a2e..961a50a3f 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -236,7 +236,7 @@ static inline int is_need_offs_page(unsigned long buf, int len) static void __dev_user_not_reg(void) { - PRINT_ERROR_PR("%s", "Device not registered"); + PRINT_ERROR("%s", "Device not registered"); return; } @@ -728,7 +728,7 @@ out: return res; out_invalid: - PRINT_ERROR_PR("PARSE failed (ucmd %p, rc %d, invalid %d)", ucmd, rc, + PRINT_ERROR("PARSE failed (ucmd %p, rc %d, invalid %d)", ucmd, rc, info_cdb->flags & SCST_INFO_INVALID); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); @@ -942,7 +942,7 @@ static void dev_user_add_to_ready(struct scst_user_cmd *ucmd) "active (ucmd %p)", ucmd); break; } else { - TRACE(TRACE_MGMT, "Pre unreg sess %p " + TRACE_MGMT_DBG("Pre unreg sess %p " "active (ucmd %p)", found, ucmd); } } @@ -1047,7 +1047,7 @@ out_err: goto out; out_unmap: - PRINT_ERROR_PR("Failed to get %d user pages (rc %d)", + PRINT_ERROR("Failed to get %d user pages (rc %d)", ucmd->num_data_pages, rc); if (rc > 0) { for(i = 0; i < rc; i++) @@ -1074,7 +1074,7 @@ static int dev_user_process_reply_alloc(struct scst_user_cmd *ucmd, int pages; if (ucmd->buff_cached) { if (unlikely((reply->alloc_reply.pbuf & ~PAGE_MASK) != 0)) { - PRINT_ERROR_PR("Supplied pbuf %Lx isn't " + PRINT_ERROR("Supplied pbuf %Lx isn't " "page aligned", reply->alloc_reply.pbuf); goto out_hwerr; } @@ -1141,7 +1141,7 @@ out_process: return res; out_inval: - PRINT_ERROR_PR("%s", "Invalid parse_reply parameter(s)"); + PRINT_ERROR("%s", "Invalid parse_reply parameter(s)"); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); res = -EINVAL; goto out_process; @@ -1220,7 +1220,7 @@ static int dev_user_process_reply_exec(struct scst_user_cmd *ucmd, goto out_busy; if (ucmd->buff_cached) { if (unlikely((ereply->pbuf & ~PAGE_MASK) != 0)) { - PRINT_ERROR_PR("Supplied pbuf %Lx isn't " + PRINT_ERROR("Supplied pbuf %Lx isn't " "page aligned", ereply->pbuf); goto out_hwerr; } @@ -1252,7 +1252,7 @@ static int dev_user_process_reply_exec(struct scst_user_cmd *ucmd, min(sizeof(cmd->sense_buffer), (unsigned int)ereply->sense_len)); if (res < 0) { - PRINT_ERROR_PR("%s", "Unable to get sense data"); + PRINT_ERROR("%s", "Unable to get sense data"); goto out_hwerr_res_set; } } @@ -1267,7 +1267,7 @@ out: return res; out_inval: - PRINT_ERROR_PR("%s", "Invalid exec_reply parameter(s)"); + PRINT_ERROR("%s", "Invalid exec_reply parameter(s)"); out_hwerr: res = -EINVAL; @@ -1374,7 +1374,7 @@ out: return res; out_wrong_state: - PRINT_ERROR_PR("Command's %p subcode %x doesn't match internal " + PRINT_ERROR("Command's %p subcode %x doesn't match internal " "command's state %x or reply->subcode (%x) != ucmd->subcode " "(%x)", ucmd, _IOC_NR(reply->subcode), ucmd->state, reply->subcode, ucmd->user_cmd.subcode); @@ -1761,7 +1761,7 @@ static long dev_user_ioctl(struct file *file, unsigned int cmd, break; default: - PRINT_ERROR_PR("Invalid ioctl cmd %x", cmd); + PRINT_ERROR("Invalid ioctl cmd %x", cmd); res = -EINVAL; goto out; } @@ -1923,7 +1923,7 @@ static void dev_user_unjam_cmd(struct scst_user_cmd *ucmd, int busy, } default: - PRINT_ERROR_PR("Wrong ucmd state %x", state); + PRINT_ERROR("Wrong ucmd state %x", state); sBUG(); break; } @@ -2129,7 +2129,7 @@ static int dev_user_task_mgmt_fn(struct scst_mgmt_cmd *mcmd, spin_lock_irq(&dev->cmd_lists.cmd_list_lock); if (dev->internal_reset_active) { - PRINT_ERROR_PR("Loosing TM cmd %d, because there are other " + PRINT_ERROR("Loosing TM cmd %d, because there are other " "unprocessed TM commands", mcmd->fn); res = SCST_MGMT_STATUS_FAILED; goto out_locked_free; @@ -2138,7 +2138,7 @@ static int dev_user_task_mgmt_fn(struct scst_mgmt_cmd *mcmd, * We are going to miss some TM commands, so replace it * by the hardest one. */ - PRINT_ERROR_PR("Replacing TM cmd %d by TARGET_RESET, because " + PRINT_ERROR("Replacing TM cmd %d by TARGET_RESET, because " "there is another unprocessed TM command", mcmd->fn); ucmd->user_cmd.tm_cmd.fn = SCST_TARGET_RESET; ucmd->internal_reset_tm = 1; @@ -2159,7 +2159,7 @@ static int dev_user_task_mgmt_fn(struct scst_mgmt_cmd *mcmd, if (rc > 0) res = ucmd->result; else { - PRINT_ERROR_PR("Task management command %p timeout", ucmd); + PRINT_ERROR("Task management command %p timeout", ucmd); res = SCST_MGMT_STATUS_FAILED; } @@ -2196,7 +2196,7 @@ static int dev_user_attach(struct scst_device *sdev) } spin_unlock(&dev_list_lock); if (dev == NULL) { - PRINT_ERROR_PR("Device %s not found", sdev->virt_name); + PRINT_ERROR("Device %s not found", sdev->virt_name); res = -EINVAL; goto out; } @@ -2205,7 +2205,7 @@ static int dev_user_attach(struct scst_device *sdev) sdev->dh_priv = dev; - PRINT_INFO_PR("Attached user space SCSI target virtual device \"%s\"", + PRINT_INFO("Attached user space SCSI target virtual device \"%s\"", dev->name); out: @@ -2221,7 +2221,7 @@ static void dev_user_detach(struct scst_device *sdev) TRACE_DBG("virt_id %d", sdev->virt_id); - PRINT_INFO_PR("Detached user space SCSI target virtual device \"%s\"", + PRINT_INFO("Detached user space SCSI target virtual device \"%s\"", dev->name); /* dev will be freed by the caller */ @@ -2306,7 +2306,7 @@ static int dev_user_attach_tgt(struct scst_tgt_dev *tgt_dev) spin_lock_irq(&dev->cmd_lists.cmd_list_lock); if (dev->attach_cmd_active) { - PRINT_ERROR_PR("%s", "ATTACH_SESS command failed, because " + PRINT_ERROR("%s", "ATTACH_SESS command failed, because " "there is another unprocessed ATTACH_SESS command"); res = -EBUSY; goto out_locked_free; @@ -2321,7 +2321,7 @@ static int dev_user_attach_tgt(struct scst_tgt_dev *tgt_dev) if (rc > 0) res = ucmd->result; else { - PRINT_ERROR_PR("%s", "ATTACH_SESS command timeout"); + PRINT_ERROR("%s", "ATTACH_SESS command timeout"); res = -EFAULT; } @@ -2512,7 +2512,7 @@ static void dev_user_setup_functions(struct scst_user_dev *dev) break; default: - PRINT_INFO_PR("Unknown SCSI type %x, using PARSE_CALL " + PRINT_INFO("Unknown SCSI type %x, using PARSE_CALL " "for it", dev->devtype.type); dev->parse_type = SCST_USER_PARSE_CALL; break; @@ -2536,7 +2536,7 @@ static int dev_user_register_dev(struct file *file, TRACE_ENTRY(); if (dev_desc->version != DEV_USER_VERSION) { - PRINT_ERROR_PR("Version mismatch (requested %d, required %d)", + PRINT_ERROR("Version mismatch (requested %d, required %d)", dev_desc->version, DEV_USER_VERSION); res = -EINVAL; goto out; @@ -2547,7 +2547,7 @@ static int dev_user_register_dev(struct file *file, case TYPE_ROM: case TYPE_MOD: if (dev_desc->block_size == 0) { - PRINT_ERROR_PR("Wrong block size %d", dev_desc->block_size); + PRINT_ERROR("Wrong block size %d", dev_desc->block_size); res = -EINVAL; goto out; } @@ -2563,7 +2563,7 @@ static int dev_user_register_dev(struct file *file, } if (!try_module_get(THIS_MODULE)) { - PRINT_ERROR_PR("%s", "Fail to get module"); + PRINT_ERROR("%s", "Fail to get module"); goto out; } @@ -2632,7 +2632,7 @@ static int dev_user_register_dev(struct file *file, list_for_each_entry(d, &dev_list, dev_list_entry) { if (strcmp(d->name, dev->name) == 0) { - PRINT_ERROR_PR("Device %s already exist", + PRINT_ERROR("Device %s already exist", dev->name); res = -EEXIST; spin_unlock(&dev_list_lock); @@ -2660,7 +2660,7 @@ static int dev_user_register_dev(struct file *file, mutex_lock(&dev_priv_mutex); if (file->private_data != NULL) { mutex_unlock(&dev_priv_mutex); - PRINT_ERROR_PR("%s", "Device already registered"); + PRINT_ERROR("%s", "Device already registered"); res = -EINVAL; goto out_unreg_drv; } @@ -2709,7 +2709,7 @@ static int __dev_user_set_opt(struct scst_user_dev *dev, (opt->memory_reuse_type > SCST_USER_MAX_MEM_REUSE_OPT) || (opt->prio_queue_type > SCST_USER_MAX_PRIO_QUEUE_OPT) || (opt->partial_transfers_type > SCST_USER_MAX_PARTIAL_TRANSFERS_OPT)) { - PRINT_ERROR_PR("%s", "Invalid option"); + PRINT_ERROR("%s", "Invalid option"); res = -EINVAL; goto out; } @@ -2913,7 +2913,7 @@ static void dev_user_process_cleanup(struct scst_user_dev *dev) struct list_head *head = &dev->ucmd_hash[i]; struct scst_user_cmd *ucmd, *t; list_for_each_entry_safe(ucmd, t, head, hash_list_entry) { - PRINT_ERROR_PR("Lost ucmd %p (state %x, ref %d)", ucmd, + PRINT_ERROR("Lost ucmd %p (state %x, ref %d)", ucmd, ucmd->state, atomic_read(&ucmd->ucmd_ref)); ucmd_put(ucmd); } @@ -2990,7 +2990,7 @@ static int __init init_scst_user(void) TRACE_ENTRY(); #if defined(CONFIG_HIGHMEM4G) || defined(CONFIG_HIGHMEM64G) - PRINT_ERROR_PR("%s", "HIGHMEM kernel configurations are not supported. " + PRINT_ERROR("%s", "HIGHMEM kernel configurations are not supported. " "Consider change VMSPLIT option or use 64-bit " "configuration instead. See README file for details."); res = -EINVAL; @@ -3039,7 +3039,7 @@ static int __init init_scst_user(void) "scst_usr_cleanupd"); if (IS_ERR(cleanup_thread)) { res = PTR_ERR(cleanup_thread); - PRINT_ERROR_PR("kthread_create() failed: %d", res); + PRINT_ERROR("kthread_create() failed: %d", res); goto out_dev; } diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 6a4181f3e..5f6d40778 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -358,7 +358,7 @@ static int vdisk_attach(struct scst_device *dev) TRACE_DBG("virt_id %d (%s)", dev->virt_id, dev->virt_name); if (dev->virt_id == 0) { - PRINT_ERROR_PR("%s", "Not a virtual device"); + PRINT_ERROR("%s", "Not a virtual device"); res = -EINVAL; goto out; } @@ -379,7 +379,7 @@ static int vdisk_attach(struct scst_device *dev) } if (virt_dev == NULL) { - PRINT_ERROR_PR("Device %s not found", dev->virt_name); + PRINT_ERROR("Device %s not found", dev->virt_name); res = -EINVAL; goto out; } @@ -398,7 +398,7 @@ static int vdisk_attach(struct scst_device *dev) fd = vdisk_open(virt_dev); if (IS_ERR(fd)) { res = PTR_ERR(fd); - PRINT_ERROR_PR("filp_open(%s) returned an error %d", + PRINT_ERROR("filp_open(%s) returned an error %d", virt_dev->file_name, res); goto out; } @@ -411,7 +411,7 @@ static int vdisk_attach(struct scst_device *dev) (fd->f_op->aio_write == NULL)) #endif { - PRINT_ERROR_PR("%s", "Wrong f_op or FS doesn't have " + PRINT_ERROR("%s", "Wrong f_op or FS doesn't have " "required capabilities"); res = -EINVAL; filp_close(fd, NULL); @@ -421,7 +421,7 @@ static int vdisk_attach(struct scst_device *dev) inode = fd->f_dentry->d_inode; if (virt_dev->blockio && !S_ISBLK(inode->i_mode)) { - PRINT_ERROR_PR("File %s is NOT a block device", + PRINT_ERROR("File %s is NOT a block device", virt_dev->file_name); res = -EINVAL; filp_close(fd, NULL); @@ -455,7 +455,7 @@ static int vdisk_attach(struct scst_device *dev) } if (!virt_dev->cdrom_empty) { - PRINT_INFO_PR("Attached SCSI target virtual %s %s " + PRINT_INFO("Attached SCSI target virtual %s %s " "(file=\"%s\", fs=%LdMB, bs=%d, nblocks=%Ld, cyln=%Ld%s)", (dev->handler->type == TYPE_DISK) ? "disk" : "cdrom", virt_dev->name, virt_dev->file_name, @@ -463,7 +463,7 @@ static int vdisk_attach(struct scst_device *dev) virt_dev->nblocks, virt_dev->nblocks/64/32, virt_dev->nblocks < 64*32 ? " !WARNING! cyln less than 1" : ""); } else { - PRINT_INFO_PR("Attached empty SCSI target virtual cdrom %s", + PRINT_INFO("Attached empty SCSI target virtual cdrom %s", virt_dev->name); } @@ -492,7 +492,7 @@ static void vdisk_detach(struct scst_device *dev) TRACE_DBG("virt_id %d", dev->virt_id); - PRINT_INFO_PR("Detached SCSI target virtual device %s (\"%s\")", + PRINT_INFO("Detached SCSI target virtual device %s (\"%s\")", virt_dev->name, virt_dev->file_name); /* virt_dev will be freed by the caller */ @@ -548,7 +548,7 @@ static struct scst_vdisk_thr *vdisk_init_thr_data( if (!virt_dev->cdrom_empty && !virt_dev->nullio) { res->fd = vdisk_open(virt_dev); if (IS_ERR(res->fd)) { - PRINT_ERROR_PR("filp_open(%s) returned an error %ld", + PRINT_ERROR("filp_open(%s) returned an error %ld", virt_dev->file_name, PTR_ERR(res->fd)); goto out_free; } @@ -732,7 +732,7 @@ static int vdisk_do_job(struct scst_cmd *cmd) lba_start, (uint64_t)loff, (uint64_t)data_len); if (unlikely(loff < 0) || unlikely(data_len < 0) || unlikely((loff + data_len) > virt_dev->file_size)) { - PRINT_INFO_PR("Access beyond the end of the device " + PRINT_INFO("Access beyond the end of the device " "(%lld of %lld, len %Ld)", (uint64_t)loff, (uint64_t)virt_dev->file_size, (uint64_t)data_len); scst_set_cmd_error(cmd, SCST_LOAD_SENSE( @@ -1045,7 +1045,7 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd) length = scst_get_buf_first(cmd, &address); TRACE_DBG("length %d", length); if (unlikely(length <= 0)) { - PRINT_ERROR_PR("scst_get_buf_first() failed: %d", length); + PRINT_ERROR("scst_get_buf_first() failed: %d", length); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out_free; @@ -1315,7 +1315,7 @@ static void vdisk_exec_mode_sense(struct scst_cmd *cmd) length = scst_get_buf_first(cmd, &address); if (unlikely(length <= 0)) { - PRINT_ERROR_PR("scst_get_buf_first() failed: %d", length); + PRINT_ERROR("scst_get_buf_first() failed: %d", length); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out_free; @@ -1467,14 +1467,14 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd) length = scst_get_buf_first(cmd, &address); if (unlikely(length <= 0)) { - PRINT_ERROR_PR("scst_get_buf_first() failed: %d", length); + PRINT_ERROR("scst_get_buf_first() failed: %d", length); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out; } if (!(cmd->cdb[1] & PF) || (cmd->cdb[1] & SP)) { - PRINT_ERROR_PR("MODE SELECT: PF and/or SP are wrongly set " + PRINT_ERROR("MODE SELECT: PF and/or SP are wrongly set " "(cdb[1]=%x)", cmd->cdb[1]); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); @@ -1490,7 +1490,7 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd) if (address[offset - 1] == 8) { offset += 8; } else if (address[offset - 1] != 0) { - PRINT_ERROR_PR("%s", "MODE SELECT: Wrong parameters list " + PRINT_ERROR("%s", "MODE SELECT: Wrong parameters list " "lenght"); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_parm_list)); @@ -1499,14 +1499,14 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd) while (length > offset + 2) { if (address[offset] & PS) { - PRINT_ERROR_PR("%s", "MODE SELECT: Illegal PS bit"); + PRINT_ERROR("%s", "MODE SELECT: Illegal PS bit"); scst_set_cmd_error(cmd, SCST_LOAD_SENSE( scst_sense_invalid_field_in_parm_list)); goto out_put; } if ((address[offset] & 0x3f) == 0x8) { /* Caching page */ if (address[offset + 1] != 18) { - PRINT_ERROR_PR("%s", "MODE SELECT: Invalid " + PRINT_ERROR("%s", "MODE SELECT: Invalid " "caching page request"); scst_set_cmd_error(cmd, SCST_LOAD_SENSE( scst_sense_invalid_field_in_parm_list)); @@ -1578,7 +1578,7 @@ static void vdisk_exec_read_capacity(struct scst_cmd *cmd) length = scst_get_buf_first(cmd, &address); if (unlikely(length <= 0)) { - PRINT_ERROR_PR("scst_get_buf_first() failed: %d", length); + PRINT_ERROR("scst_get_buf_first() failed: %d", length); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out; @@ -1630,7 +1630,7 @@ static void vdisk_exec_read_capacity16(struct scst_cmd *cmd) length = scst_get_buf_first(cmd, &address); if (unlikely(length <= 0)) { - PRINT_ERROR_PR("scst_get_buf_first() failed: %d", length); + PRINT_ERROR("scst_get_buf_first() failed: %d", length); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out; @@ -1662,14 +1662,14 @@ static void vdisk_exec_read_toc(struct scst_cmd *cmd) TRACE_ENTRY(); if (cmd->dev->handler->type != TYPE_ROM) { - PRINT_ERROR_PR("%s", "READ TOC for non-CDROM device"); + PRINT_ERROR("%s", "READ TOC for non-CDROM device"); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); goto out; } if (cmd->cdb[2] & 0x0e/*Format*/) { - PRINT_ERROR_PR("%s", "READ TOC: invalid requested data format"); + PRINT_ERROR("%s", "READ TOC: invalid requested data format"); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); goto out; @@ -1677,7 +1677,7 @@ static void vdisk_exec_read_toc(struct scst_cmd *cmd) if ((cmd->cdb[6] != 0 && (cmd->cdb[2] & 0x01)) || (cmd->cdb[6] > 1 && cmd->cdb[6] != 0xAA)) { - PRINT_ERROR_PR("READ TOC: invalid requested track number %x", + PRINT_ERROR("READ TOC: invalid requested track number %x", cmd->cdb[6]); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); @@ -1686,7 +1686,7 @@ static void vdisk_exec_read_toc(struct scst_cmd *cmd) length = scst_get_buf_first(cmd, &address); if (unlikely(length <= 0)) { - PRINT_ERROR_PR("scst_get_buf_first() failed: %d", length); + PRINT_ERROR("scst_get_buf_first() failed: %d", length); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out; @@ -1749,7 +1749,7 @@ static void vdisk_exec_prevent_allow_medium_removal(struct scst_cmd *cmd) virt_dev->prevent_allow_medium_removal = cmd->cdb[4] & 0x01 ? 1 : 0; else { - PRINT_ERROR_PR("%s", "Prevent allow medium removal for " + PRINT_ERROR("%s", "Prevent allow medium removal for " "non-CDROM device"); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); @@ -1781,7 +1781,7 @@ static int vdisk_fsync(struct scst_vdisk_thr *thr, res = sync_page_range(inode, mapping, loff, len); if (unlikely(res != 0)) { - PRINT_ERROR_PR("sync_page_range() failed (%d)", res); + PRINT_ERROR("sync_page_range() failed (%d)", res); if (cmd != NULL) { scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_write_error)); @@ -1806,7 +1806,7 @@ static struct iovec *vdisk_alloc_iv(struct scst_cmd *cmd, kfree(thr->iv); thr->iv = kmalloc(sizeof(*thr->iv) * iv_count, GFP_KERNEL); if (thr->iv == NULL) { - PRINT_ERROR_PR("Unable to allocate iv (%d)", iv_count); + PRINT_ERROR("Unable to allocate iv (%d)", iv_count); scst_set_busy(cmd); goto out; } @@ -1891,7 +1891,7 @@ static void vdisk_exec_read(struct scst_cmd *cmd, length = scst_get_buf_next(cmd, &address); } if (unlikely(length < 0)) { - PRINT_ERROR_PR("scst_get_buf_() failed: %zd", length); + PRINT_ERROR("scst_get_buf_() failed: %zd", length); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out_put; @@ -1911,7 +1911,7 @@ static void vdisk_exec_read(struct scst_cmd *cmd, err = default_llseek(fd, loff, 0/*SEEK_SET*/); } if (err != loff) { - PRINT_ERROR_PR("lseek trouble %Ld != %Ld", (uint64_t)err, + PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err, (uint64_t)loff); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out_set_fs; @@ -1925,7 +1925,7 @@ static void vdisk_exec_read(struct scst_cmd *cmd, } if ((err < 0) || (err < full_len)) { - PRINT_ERROR_PR("readv() returned %Ld from %zd", (uint64_t)err, + PRINT_ERROR("readv() returned %Ld from %zd", (uint64_t)err, full_len); if (err == -EAGAIN) scst_set_busy(cmd); @@ -1978,7 +1978,7 @@ static void vdisk_exec_write(struct scst_cmd *cmd, length = scst_get_buf_next(cmd, &address); } if (unlikely(length < 0)) { - PRINT_ERROR_PR("scst_get_buf_() failed: %zd", length); + PRINT_ERROR("scst_get_buf_() failed: %zd", length); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out_put; @@ -2002,7 +2002,7 @@ restart: err = default_llseek(fd, loff, 0 /*SEEK_SET */ ); } if (err != loff) { - PRINT_ERROR_PR("lseek trouble %Ld != %Ld", (uint64_t)err, + PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err, (uint64_t)loff); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); @@ -2019,7 +2019,7 @@ restart: } if (err < 0) { - PRINT_ERROR_PR("write() returned %Ld from %zd", + PRINT_ERROR("write() returned %Ld from %zd", (uint64_t)err, full_len); if (err == -EAGAIN) scst_set_busy(cmd); @@ -2038,7 +2038,7 @@ restart: "(iv_count=%d)", (int)err, full_len, eiv_count); if (err == 0) { - PRINT_INFO_PR("Suspicious: write() returned 0 from " + PRINT_INFO("Suspicious: write() returned 0 from " "%zd (iv_count=%d)", full_len, eiv_count); } full_len -= err; @@ -2086,7 +2086,7 @@ static int blockio_endio(struct bio *bio, unsigned int bytes_done, int error) error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO; if (unlikely(error != 0)) { - PRINT_ERROR_PR("cmd %p returned error %d", blockio_work->cmd, + PRINT_ERROR("cmd %p returned error %d", blockio_work->cmd, error); /* * The race with other such bio's doesn't matter, since all @@ -2157,7 +2157,7 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr, if (need_new_bio) { bio = bio_alloc(GFP_KERNEL, max_nr_vecs); if (!bio) { - PRINT_ERROR_PR("Failed to create bio " + PRINT_ERROR("Failed to create bio " "for data segment= %d " "cmd %p", j, cmd); goto out_no_bio; @@ -2262,7 +2262,7 @@ static void vdisk_exec_verify(struct scst_cmd *cmd, err = default_llseek(fd, loff, 0/*SEEK_SET*/); } if (err != loff) { - PRINT_ERROR_PR("lseek trouble %Ld != %Ld", (uint64_t)err, + PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err, (uint64_t)loff); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out_set_fs; @@ -2271,7 +2271,7 @@ static void vdisk_exec_verify(struct scst_cmd *cmd, mem_verify = vmalloc(LEN_MEM); if (mem_verify == NULL) { - PRINT_ERROR_PR("Unable to allocate memory %d for verify", + PRINT_ERROR("Unable to allocate memory %d for verify", LEN_MEM); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); @@ -2295,7 +2295,7 @@ static void vdisk_exec_verify(struct scst_cmd *cmd, else err = len_mem; if ((err < 0) || (err < len_mem)) { - PRINT_ERROR_PR("verify() returned %Ld from %zd", + PRINT_ERROR("verify() returned %Ld from %zd", (uint64_t)err, len_mem); if (err == -EAGAIN) scst_set_busy(cmd); @@ -2323,7 +2323,7 @@ static void vdisk_exec_verify(struct scst_cmd *cmd, } if (length < 0) { - PRINT_ERROR_PR("scst_get_buf_() failed: %zd", length); + PRINT_ERROR("scst_get_buf_() failed: %zd", length); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); } @@ -2448,7 +2448,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, p += 5; action = 2; } else { - PRINT_ERROR_PR("Unknown action \"%s\"", p); + PRINT_ERROR("Unknown action \"%s\"", p); res = -EINVAL; goto out_up; } @@ -2460,11 +2460,11 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, p++; *p++ = '\0'; if (*name == '\0') { - PRINT_ERROR_PR("%s", "Name required"); + PRINT_ERROR("%s", "Name required"); res = -EINVAL; goto out_up; } else if (strlen(name) >= sizeof(virt_dev->name)) { - PRINT_ERROR_PR("Name is too long (max %zd " + PRINT_ERROR("Name is too long (max %zd " "characters)", sizeof(virt_dev->name)-1); res = -EINVAL; goto out_up; @@ -2481,7 +2481,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, } } if (virt_dev) { - PRINT_ERROR_PR("Virtual device with name " + PRINT_ERROR("Virtual device with name " "%s already exist", name); res = -EINVAL; goto out_up; @@ -2494,7 +2494,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, p++; *p++ = '\0'; if (*file_name == '\0') { - PRINT_ERROR_PR("%s", "File name required"); + PRINT_ERROR("%s", "File name required"); res = -EINVAL; goto out_up; } @@ -2515,7 +2515,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, block_size = simple_strtoul(p, &pp, 0); p = pp; if ((*p != '\0') && !isspace(*p)) { - PRINT_ERROR_PR("Parse error: \"%s\"", p); + PRINT_ERROR("Parse error: \"%s\"", p); res = -EINVAL; goto out_free_vdev; } @@ -2551,7 +2551,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, virt_dev->o_direct_flag = 1; TRACE_DBG("%s", "O_DIRECT"); #else - PRINT_INFO_PR("%s flag doesn't currently" + PRINT_INFO("%s flag doesn't currently" " work, ignoring it, use fileio_tgt " "in O_DIRECT mode instead", "O_DIRECT"); #endif @@ -2564,7 +2564,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, virt_dev->blockio = 1; TRACE_DBG("%s", "BLOCKIO"); } else { - PRINT_ERROR_PR("Unknown flag \"%s\"", p); + PRINT_ERROR("Unknown flag \"%s\"", p); res = -EINVAL; goto out_free_vdev; } @@ -2573,7 +2573,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, } if (!virt_dev->nullio && (*file_name != '/')) { - PRINT_ERROR_PR("File path \"%s\" is not " + PRINT_ERROR("File path \"%s\" is not " "absolute", file_name); res = -EINVAL; goto out_up; @@ -2622,12 +2622,12 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, } } if (virt_dev == NULL) { - PRINT_ERROR_PR("Device %s not found", name); + PRINT_ERROR("Device %s not found", name); res = -EINVAL; goto out_up; } scst_unregister_virtual_device(virt_dev->virt_id); - PRINT_INFO_PR("Virtual device %s unregistered", + PRINT_INFO("Virtual device %s unregistered", virt_dev->name); TRACE_DBG("virt_id %d unregister", virt_dev->virt_id); @@ -2672,7 +2672,7 @@ static int vcdrom_open(char *p, char *name) } } if (virt_dev) { - PRINT_ERROR_PR("Virtual device with name " + PRINT_ERROR("Virtual device with name " "%s already exist", name); res = -EINVAL; goto out; @@ -2688,7 +2688,7 @@ static int vcdrom_open(char *p, char *name) cdrom_empty = 1; TRACE_DBG("%s", "No media"); } else if (*file_name != '/') { - PRINT_ERROR_PR("File path \"%s\" is not " + PRINT_ERROR("File path \"%s\" is not " "absolute", file_name); res = -EINVAL; goto out; @@ -2760,13 +2760,13 @@ static int vcdrom_close(char *name) } } if (virt_dev == NULL) { - PRINT_ERROR_PR("Virtual device with name " + PRINT_ERROR("Virtual device with name " "%s not found", name); res = -EINVAL; goto out; } scst_unregister_virtual_device(virt_dev->virt_id); - PRINT_INFO_PR("Virtual device %s unregistered", + PRINT_INFO("Virtual device %s unregistered", virt_dev->name); TRACE_DBG("virt_id %d unregister", virt_dev->virt_id); @@ -2801,7 +2801,7 @@ static int vcdrom_change(char *p, char *name) } } if (virt_dev == NULL) { - PRINT_ERROR_PR("Virtual device with name " + PRINT_ERROR("Virtual device with name " "%s not found", name); res = -EINVAL; goto out; @@ -2817,7 +2817,7 @@ static int vcdrom_change(char *p, char *name) virt_dev->cdrom_empty = 1; TRACE_DBG("%s", "No media"); } else if (*file_name != '/') { - PRINT_ERROR_PR("File path \"%s\" is not " + PRINT_ERROR("File path \"%s\" is not " "absolute", file_name); res = -EINVAL; goto out; @@ -2842,7 +2842,7 @@ static int vcdrom_change(char *p, char *name) fd = vdisk_open(virt_dev); if (IS_ERR(fd)) { res = PTR_ERR(fd); - PRINT_ERROR_PR("filp_open(%s) returned an error %d", + PRINT_ERROR("filp_open(%s) returned an error %d", virt_dev->file_name, res); goto out_free; } @@ -2851,7 +2851,7 @@ static int vcdrom_change(char *p, char *name) #else if ((fd->f_op == NULL) || (fd->f_op->aio_read == NULL)) { #endif - PRINT_ERROR_PR("%s", "Wrong f_op or FS doesn't " + PRINT_ERROR("%s", "Wrong f_op or FS doesn't " "have required capabilities"); res = -EINVAL; filp_close(fd, NULL); @@ -2869,7 +2869,7 @@ static int vcdrom_change(char *p, char *name) filp_close(fd, NULL); if (err < 0) { res = err; - PRINT_ERROR_PR("llseek %s returned an error %d", + PRINT_ERROR("llseek %s returned an error %d", virt_dev->file_name, res); goto out_free; } @@ -2883,7 +2883,7 @@ static int vcdrom_change(char *p, char *name) scst_suspend_activity(); if (virt_dev->prevent_allow_medium_removal) { - PRINT_ERROR_PR("Prevent medium removal for " + PRINT_ERROR("Prevent medium removal for " "virtual device with name %s", name); res = -EINVAL; goto out_free_resume; @@ -2897,7 +2897,7 @@ static int vcdrom_change(char *p, char *name) scst_dev_del_all_thr_data(virt_dev->dev); if (!virt_dev->cdrom_empty) { - PRINT_INFO_PR("Changed SCSI target virtual cdrom %s " + PRINT_INFO("Changed SCSI target virtual cdrom %s " "(file=\"%s\", fs=%LdMB, bs=%d, nblocks=%Ld, cyln=%Ld%s)", virt_dev->name, virt_dev->file_name, virt_dev->file_size >> 20, virt_dev->block_size, @@ -2905,7 +2905,7 @@ static int vcdrom_change(char *p, char *name) virt_dev->nblocks < 64*32 ? " !WARNING! cyln less " "than 1" : ""); } else { - PRINT_INFO_PR("Removed media from SCSI target virtual cdrom %s", + PRINT_INFO("Removed media from SCSI target virtual cdrom %s", virt_dev->name); } @@ -2991,7 +2991,7 @@ static int vcdrom_write_proc(char *buffer, char **start, off_t offset, p += 5; action = 2; } else { - PRINT_ERROR_PR("Unknown action \"%s\"", p); + PRINT_ERROR("Unknown action \"%s\"", p); res = -EINVAL; goto out_up; } @@ -3003,11 +3003,11 @@ static int vcdrom_write_proc(char *buffer, char **start, off_t offset, p++; *p++ = '\0'; if (*name == '\0') { - PRINT_ERROR_PR("%s", "Name required"); + PRINT_ERROR("%s", "Name required"); res = -EINVAL; goto out_up; } else if (strlen(name) >= sizeof(virt_dev->name)) { - PRINT_ERROR_PR("Name is too long (max %zd " + PRINT_ERROR("Name is too long (max %zd " "characters)", sizeof(virt_dev->name)-1); res = -EINVAL; goto out_up; @@ -3066,7 +3066,7 @@ static int vdisk_proc_help_build(struct scst_dev_type *dev_type) vcdrom_proc_help_string; p = scst_create_proc_entry(root, VDISK_PROC_HELP, &vdisk_help_proc_data); if (p == NULL) { - PRINT_ERROR_PR("Not enough memory to register dev " + PRINT_ERROR("Not enough memory to register dev " "handler %s entry %s in /proc", dev_type->name, VDISK_PROC_HELP); res = -ENOMEM; @@ -3143,7 +3143,7 @@ static void __exit exit_scst_vdisk(struct scst_dev_type *devtype, list_del(&virt_dev->vdisk_dev_list_entry); - PRINT_INFO_PR("Virtual device %s unregistered", virt_dev->name); + PRINT_INFO("Virtual device %s unregistered", virt_dev->name); TRACE_DBG("virt_id %d", virt_dev->virt_id); kfree(virt_dev->file_name); kfree(virt_dev); diff --git a/scst/src/scst_debug.c b/scst/src/scst_debug.c index dea3b27ed..b4e6fe97b 100644 --- a/scst/src/scst_debug.c +++ b/scst/src/scst_debug.c @@ -28,8 +28,8 @@ static char trace_buf[TRACE_BUF_SIZE]; static spinlock_t trace_buf_lock = SPIN_LOCK_UNLOCKED; -int debug_print_prefix(unsigned long trace_flag, const char *func, - int line) +int debug_print_prefix(unsigned long trace_flag, const char *prefix, + const char *func, int line) { int i = 0; unsigned long flags; @@ -39,6 +39,8 @@ int debug_print_prefix(unsigned long trace_flag, const char *func, if (trace_flag & TRACE_PID) i += snprintf(&trace_buf[i], TRACE_BUF_SIZE, "[%d]: ", current->pid); + if (prefix != NULL) + i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s: ", prefix); if (trace_flag & TRACE_FUNCTION) i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s:", func); if (trace_flag & TRACE_LINE) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 577b41ce7..ede3c8a8b 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -31,7 +31,6 @@ #include #endif -#include "scst_debug.h" #include "scsi_tgt.h" #include "scst_priv.h" #include "scst_mem.h" @@ -191,7 +190,7 @@ void scst_free_device(struct scst_device *dev) if (!list_empty(&dev->dev_tgt_dev_list) || !list_empty(&dev->dev_acg_dev_list)) { - PRINT_ERROR_PR("%s: dev_tgt_dev_list or dev_acg_dev_list " + PRINT_ERROR("%s: dev_tgt_dev_list or dev_acg_dev_list " "is not empty!", __FUNCTION__); sBUG(); } @@ -284,7 +283,7 @@ int scst_destroy_acg(struct scst_acg *acg) TRACE_ENTRY(); if (!list_empty(&acg->acg_sess_list)) { - PRINT_ERROR_PR("%s: acg_sess_list is not empty!", __FUNCTION__); + PRINT_ERROR("%s: acg_sess_list is not empty!", __FUNCTION__); res = -EBUSY; goto out; } @@ -458,7 +457,7 @@ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess, rc = dev->handler->attach_tgt(tgt_dev); TRACE_DBG("%s", "Dev handler's attach_tgt() returned"); if (rc != 0) { - PRINT_ERROR_PR("Device handler's %s attach_tgt() " + PRINT_ERROR("Device handler's %s attach_tgt() " "failed: %d", dev->handler->name, rc); goto out_thr_free; } @@ -635,7 +634,7 @@ int scst_acg_add_dev(struct scst_acg *acg, struct scst_device *dev, lun_t lun, #ifdef EXTRACHECKS list_for_each_entry(acg_dev, &acg->acg_dev_list, acg_dev_list_entry) { if (acg_dev->dev == dev) { - PRINT_ERROR_PR("Device is already in group %s", + PRINT_ERROR("Device is already in group %s", acg->acg_name); res = -EINVAL; goto out; @@ -669,10 +668,10 @@ int scst_acg_add_dev(struct scst_acg *acg, struct scst_device *dev, lun_t lun, out: if (res == 0) { if (dev->virt_name != NULL) { - PRINT_INFO_PR("Added device %s to group %s", + PRINT_INFO("Added device %s to group %s", dev->virt_name, acg->acg_name); } else { - PRINT_INFO_PR("Added device %d:%d:%d:%d to group %s", + PRINT_INFO("Added device %d:%d:%d:%d to group %s", dev->scsi_dev->host->host_no, dev->scsi_dev->channel, dev->scsi_dev->id, dev->scsi_dev->lun, acg->acg_name); @@ -708,7 +707,7 @@ int scst_acg_remove_dev(struct scst_acg *acg, struct scst_device *dev) } if (acg_dev == NULL) { - PRINT_ERROR_PR("Device is not found in group %s", acg->acg_name); + PRINT_ERROR("Device is not found in group %s", acg->acg_name); res = -EINVAL; goto out; } @@ -724,10 +723,10 @@ int scst_acg_remove_dev(struct scst_acg *acg, struct scst_device *dev) out: if (res == 0) { if (dev->virt_name != NULL) { - PRINT_INFO_PR("Removed device %s from group %s", + PRINT_INFO("Removed device %s from group %s", dev->virt_name, acg->acg_name); } else { - PRINT_INFO_PR("Removed device %d:%d:%d:%d from group %s", + PRINT_INFO("Removed device %d:%d:%d:%d from group %s", dev->scsi_dev->host->host_no, dev->scsi_dev->channel, dev->scsi_dev->id, dev->scsi_dev->lun, acg->acg_name); @@ -751,7 +750,7 @@ int scst_acg_add_name(struct scst_acg *acg, const char *name) list_for_each_entry(n, &acg->acn_list, acn_list_entry) { if (strcmp(n->name, name) == 0) { - PRINT_ERROR_PR("Name %s already exists in group %s", + PRINT_ERROR("Name %s already exists in group %s", name, acg->acg_name); res = -EINVAL; goto out; @@ -760,7 +759,7 @@ int scst_acg_add_name(struct scst_acg *acg, const char *name) n = kmalloc(sizeof(*n), GFP_KERNEL); if (n == NULL) { - PRINT_ERROR_PR("%s", "Unable to allocate scst_acn"); + PRINT_ERROR("%s", "Unable to allocate scst_acn"); res = -ENOMEM; goto out; } @@ -768,7 +767,7 @@ int scst_acg_add_name(struct scst_acg *acg, const char *name) len = strlen(name); nm = kmalloc(len + 1, GFP_KERNEL); if (nm == NULL) { - PRINT_ERROR_PR("%s", "Unable to allocate scst_acn->name"); + PRINT_ERROR("%s", "Unable to allocate scst_acn->name"); res = -ENOMEM; goto out_free; } @@ -780,7 +779,7 @@ int scst_acg_add_name(struct scst_acg *acg, const char *name) out: if (res == 0) { - PRINT_INFO_PR("Added name %s to group %s", name, acg->acg_name); + PRINT_INFO("Added name %s to group %s", name, acg->acg_name); } TRACE_EXIT_RES(res); @@ -811,10 +810,10 @@ int scst_acg_remove_name(struct scst_acg *acg, const char *name) } if (res == 0) { - PRINT_INFO_PR("Removed name %s from group %s", name, + PRINT_INFO("Removed name %s from group %s", name, acg->acg_name); } else { - PRINT_ERROR_PR("Unable to find name %s in group %s", name, + PRINT_ERROR("Unable to find name %s in group %s", name, acg->acg_name); } @@ -929,7 +928,7 @@ struct scst_cmd *scst_complete_request_sense(struct scst_cmd *cmd) ((int)sizeof(orig_cmd->sense_buffer) > len) ? len : (int)sizeof(orig_cmd->sense_buffer)); } else { - PRINT_ERROR_PR("%s", "Unable to get the sense via " + PRINT_ERROR("%s", "Unable to get the sense via " "REQUEST SENSE, returning HARDWARE ERROR"); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); } @@ -977,7 +976,7 @@ static void scst_send_release(struct scst_tgt_dev *tgt_dev) req = scsi_allocate_request(scsi_dev, GFP_KERNEL); if (req == NULL) { - PRINT_ERROR_PR("Allocation of scsi_request failed: unable " + PRINT_ERROR("Allocation of scsi_request failed: unable " "to RELEASE device %d:%d:%d:%d", scsi_dev->host->host_no, scsi_dev->channel, scsi_dev->id, scsi_dev->lun); @@ -1034,7 +1033,7 @@ static void scst_send_release(struct scst_tgt_dev *tgt_dev) rc = scsi_execute(scsi_dev, cdb, SCST_DATA_NONE, NULL, 0, sense, SCST_DEFAULT_TIMEOUT, 3, GFP_KERNEL); if (rc) { - PRINT_INFO_PR("scsi_execute() failed: %d", rc); + PRINT_INFO("scsi_execute() failed: %d", rc); goto out_free; } @@ -1088,7 +1087,7 @@ struct scst_session *scst_alloc_session(struct scst_tgt *tgt, int gfp_mask, len = strlen(initiator_name); nm = kmalloc(len + 1, gfp_mask); if (nm == NULL) { - PRINT_ERROR_PR("%s", "Unable to allocate sess->initiator_name"); + PRINT_ERROR("%s", "Unable to allocate sess->initiator_name"); goto out_free; } @@ -1236,7 +1235,7 @@ void scst_free_cmd(struct scst_cmd *cmd) #if defined(EXTRACHECKS) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) if (cmd->scsi_req) { - PRINT_ERROR_PR("%s: %s", __FUNCTION__, "Cmd with unfreed " + PRINT_ERROR("%s: %s", __FUNCTION__, "Cmd with unfreed " "scsi_req!"); scst_release_request(cmd); } @@ -1286,7 +1285,7 @@ void scst_free_cmd(struct scst_cmd *cmd) if (likely(cmd->tgt_dev != NULL)) { #ifdef EXTRACHECKS if (unlikely(!cmd->sent_to_midlev)) { - PRINT_ERROR_PR("Finishing not executed cmd %p (opcode " + PRINT_ERROR("Finishing not executed cmd %p (opcode " "%d, target %s, lun %Ld, sn %ld, expected_sn %ld)", cmd, cmd->cdb[0], cmd->tgtt->name, (uint64_t)cmd->lun, cmd->sn, cmd->tgt_dev->expected_sn); @@ -1381,7 +1380,7 @@ struct scst_mgmt_cmd *scst_alloc_mgmt_cmd(int gfp_mask) mcmd = mempool_alloc(scst_mgmt_mempool, gfp_mask); if (mcmd == NULL) { - PRINT_ERROR_PR("%s", "Allocation of management command " + PRINT_ERROR("%s", "Allocation of management command " "failed, some commands and their data could leak"); goto out; } @@ -1697,8 +1696,9 @@ int scst_get_cdb_info(const uint8_t *cdb_p, int dev_type, #ifdef EXTRACHECKS if (unlikely((info_p->transfer_len == 0) && - (info_p->direction != SCST_DATA_NONE))) { - TRACE_MGMT_DBG("Warning! transfer_len 0, direction %d change on %d", + (info_p->direction != SCST_DATA_NONE)) && + !(info_p->flags & SCST_UNKNOWN_LENGTH)) { + PRINT_ERROR("transfer_len 0, direction %d change on %d", info_p->direction, SCST_DATA_NONE); info_p->direction = SCST_DATA_NONE; } @@ -1725,7 +1725,7 @@ lun_t scst_unpack_lun(const uint8_t *lun, int len) TRACE_BUFF_FLAG(TRACE_DEBUG, "Raw LUN", lun, len); if (len < 2) { - PRINT_ERROR_PR("Illegal lun length %d, expected 2 bytes or " + PRINT_ERROR("Illegal lun length %d, expected 2 bytes or " "more", len); goto out; } @@ -1757,7 +1757,7 @@ lun_t scst_unpack_lun(const uint8_t *lun, int len) case 0: /* peripheral device addressing method */ #if 0 /* Looks like it's legal to use it as flat space addressing method as well */ if (*lun) { - PRINT_ERROR_PR("Illegal BUS INDENTIFIER in LUN " + PRINT_ERROR("Illegal BUS INDENTIFIER in LUN " "peripheral device addressing method 0x%02x, " "expected 0", *lun); break; @@ -1774,13 +1774,13 @@ lun_t scst_unpack_lun(const uint8_t *lun, int len) case 2: /* logical unit addressing method */ if (*lun & 0x3f) { - PRINT_ERROR_PR("Illegal BUS NUMBER in LUN logical unit " + PRINT_ERROR("Illegal BUS NUMBER in LUN logical unit " "addressing method 0x%02x, expected 0", *lun & 0x3f); break; } if (*(lun + 1) & 0xe0) { - PRINT_ERROR_PR("Illegal TARGET in LUN logical unit " + PRINT_ERROR("Illegal TARGET in LUN logical unit " "addressing method 0x%02x, expected 0", (*(lun + 1) & 0xf8) >> 5); break; @@ -1790,7 +1790,7 @@ lun_t scst_unpack_lun(const uint8_t *lun, int len) case 3: /* extended logical unit addressing method */ default: - PRINT_ERROR_PR("Unimplemented LUN addressing method %u", + PRINT_ERROR("Unimplemented LUN addressing method %u", address_method); break; } @@ -1800,7 +1800,7 @@ out: return res; out_err: - PRINT_ERROR_PR("%s", "Multi-level LUN unimplemented"); + PRINT_ERROR("%s", "Multi-level LUN unimplemented"); goto out; } @@ -1820,7 +1820,7 @@ int scst_calc_block_shift(int sector_size) block_shift++; } if (block_shift < 9) { - PRINT_ERROR_PR("Wrong sector size %d", sector_size); + PRINT_ERROR("Wrong sector size %d", sector_size); block_shift = -1; } @@ -2096,7 +2096,7 @@ int scst_block_generic_dev_done(struct scst_cmd *cmd, buffer_size = scst_get_buf_first(cmd, &buffer); if (unlikely(buffer_size <= 0)) { - PRINT_ERROR_PR("%s: Unable to get the buffer " + PRINT_ERROR("%s: Unable to get the buffer " "(%d)", __FUNCTION__, buffer_size); goto out; } @@ -2148,7 +2148,7 @@ int scst_tape_generic_dev_done(struct scst_cmd *cmd, case MODE_SELECT: buffer_size = scst_get_buf_first(cmd, &buffer); if (unlikely(buffer_size <= 0)) { - PRINT_ERROR_PR("%s: Unable to get the buffer (%d)", + PRINT_ERROR("%s: Unable to get the buffer (%d)", __FUNCTION__, buffer_size); goto out; } @@ -2330,7 +2330,7 @@ void scst_alloc_set_UA(struct scst_tgt_dev *tgt_dev, UA_entry = mempool_alloc(scst_ua_mempool, GFP_ATOMIC); if (UA_entry == NULL) { - PRINT_ERROR_PR("%s", "UNIT ATTENTION memory " + PRINT_ERROR("%s", "UNIT ATTENTION memory " "allocation failed. The UNIT ATTENTION " "on some sessions will be missed"); goto out; diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 8a738ffdb..0e76ceae5 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -153,28 +153,28 @@ int scst_register_target_template(struct scst_tgt_template *vtt) INIT_LIST_HEAD(&vtt->tgt_list); if (!vtt->detect) { - PRINT_ERROR_PR("Target driver %s doesn't have a " + PRINT_ERROR("Target driver %s doesn't have a " "detect() method.", vtt->name); res = -EINVAL; goto out_err; } if (!vtt->release) { - PRINT_ERROR_PR("Target driver %s doesn't have a " + PRINT_ERROR("Target driver %s doesn't have a " "release() method.", vtt->name); res = -EINVAL; goto out_err; } if (!vtt->xmit_response) { - PRINT_ERROR_PR("Target driver %s doesn't have a " + PRINT_ERROR("Target driver %s doesn't have a " "xmit_response() method.", vtt->name); res = -EINVAL; goto out_err; } if (vtt->threads_num < 0) { - PRINT_ERROR_PR("Wrong threads_num value %d for " + PRINT_ERROR("Wrong threads_num value %d for " "target \"%s\"", vtt->threads_num, vtt->name); res = -EINVAL; @@ -197,7 +197,7 @@ int scst_register_target_template(struct scst_tgt_template *vtt) goto out_m_up; list_for_each_entry(t, &scst_template_list, scst_template_list_entry) { if (strcmp(t->name, vtt->name) == 0) { - PRINT_ERROR_PR("Target driver %s already registered", + PRINT_ERROR("Target driver %s already registered", vtt->name); mutex_unlock(&scst_mutex); goto out_cleanup; @@ -209,7 +209,7 @@ int scst_register_target_template(struct scst_tgt_template *vtt) res = vtt->detect(vtt); TRACE_DBG("Target driver's detect() returned %d", res); if (res < 0) { - PRINT_ERROR_PR("%s", "The detect() routine failed"); + PRINT_ERROR("%s", "The detect() routine failed"); res = -EINVAL; goto out_cleanup; } @@ -220,7 +220,7 @@ int scst_register_target_template(struct scst_tgt_template *vtt) res = 0; - PRINT_INFO_PR("Target template %s registered successfully", vtt->name); + PRINT_INFO("Target template %s registered successfully", vtt->name); mutex_unlock(&m); @@ -235,7 +235,7 @@ out_cleanup: scst_cleanup_proc_target_dir_entries(vtt); out_err: - PRINT_ERROR_PR("Failed to register target template %s", vtt->name); + PRINT_ERROR("Failed to register target template %s", vtt->name); goto out; } @@ -256,7 +256,7 @@ void scst_unregister_target_template(struct scst_tgt_template *vtt) } } if (!found) { - PRINT_ERROR_PR("Target driver %s isn't registered", vtt->name); + PRINT_ERROR("Target driver %s isn't registered", vtt->name); goto out_up; } @@ -269,7 +269,7 @@ restart: } list_del(&vtt->scst_template_list_entry); - PRINT_INFO_PR("Target template %s unregistered successfully", vtt->name); + PRINT_INFO("Target template %s unregistered successfully", vtt->name); out_up: mutex_unlock(&scst_mutex); @@ -329,7 +329,7 @@ struct scst_tgt *scst_register(struct scst_tgt_template *vtt, mutex_unlock(&scst_mutex); scst_resume_activity(); - PRINT_INFO_PR("Target %s (%p) for template %s registered successfully", + PRINT_INFO("Target %s (%p) for template %s registered successfully", target_name, tgt, vtt->name); out: @@ -348,7 +348,7 @@ out_free_err: tgt = NULL; out_err: - PRINT_ERROR_PR("Failed to register target %s for template %s", + PRINT_ERROR("Failed to register target %s for template %s", target_name, vtt->name); goto out; } @@ -398,7 +398,7 @@ void scst_unregister(struct scst_tgt *tgt) del_timer_sync(&tgt->retry_timer); - PRINT_INFO_PR("Target %p for template %s unregistered successfully", + PRINT_INFO("Target %p for template %s unregistered successfully", tgt, vtt->name); kfree(tgt); @@ -524,13 +524,13 @@ out_up: scst_resume_activity(); if (res == 0) { - PRINT_INFO_PR("Attached SCSI target mid-level at " + PRINT_INFO("Attached SCSI target mid-level at " "scsi%d, channel %d, id %d, lun %d, type %d", scsidp->host->host_no, scsidp->channel, scsidp->id, scsidp->lun, scsidp->type); } else { - PRINT_ERROR_PR("Failed to attach SCSI target mid-level " + PRINT_ERROR("Failed to attach SCSI target mid-level " "at scsi%d, channel %d, id %d, lun %d, type %d", scsidp->host->host_no, scsidp->channel, scsidp->id, scsidp->lun, scsidp->type); @@ -566,7 +566,7 @@ static void scst_unregister_device(struct scsi_device *scsidp) } } if (dev == NULL) { - PRINT_ERROR_PR("%s", "Target device not found"); + PRINT_ERROR("%s", "Target device not found"); goto out_unblock; } @@ -583,7 +583,7 @@ static void scst_unregister_device(struct scsi_device *scsidp) put_disk(dev->rq_disk); scst_free_device(dev); - PRINT_INFO_PR("Detached SCSI target mid-level from scsi%d, channel %d, " + PRINT_INFO("Detached SCSI target mid-level from scsi%d, channel %d, " "id %d, lun %d, type %d", scsidp->host->host_no, scsidp->channel, scsidp->id, scsidp->lun, scsidp->type); @@ -600,7 +600,7 @@ static int scst_dev_handler_check(struct scst_dev_type *dev_handler) int res = 0; if (dev_handler->parse == NULL) { - PRINT_ERROR_PR("scst dev_type driver %s doesn't have a " + PRINT_ERROR("scst dev_type driver %s doesn't have a " "parse() method.", dev_handler->name); res = -EINVAL; goto out; @@ -631,14 +631,14 @@ int scst_register_virtual_device(struct scst_dev_type *dev_handler, TRACE_ENTRY(); if (dev_handler == NULL) { - PRINT_ERROR_PR("%s: valid device handler must be supplied", + PRINT_ERROR("%s: valid device handler must be supplied", __FUNCTION__); res = -EINVAL; goto out; } if (dev_name == NULL) { - PRINT_ERROR_PR("%s: device name must be non-NULL", __FUNCTION__); + PRINT_ERROR("%s: device name must be non-NULL", __FUNCTION__); res = -EINVAL; goto out; } @@ -680,11 +680,11 @@ out_resume: out: if (res > 0) { - PRINT_INFO_PR("Attached SCSI target mid-level to virtual " + PRINT_INFO("Attached SCSI target mid-level to virtual " "device %s (id %d)", dev_name, dev->virt_id); } else { - PRINT_INFO_PR("Failed to attach SCSI target mid-level to " + PRINT_INFO("Failed to attach SCSI target mid-level to " "virtual device %s", dev_name); } @@ -715,7 +715,7 @@ void scst_unregister_virtual_device(int id) } } if (dev == NULL) { - PRINT_ERROR_PR("%s", "Target device not found"); + PRINT_ERROR("%s", "Target device not found"); goto out_unblock; } @@ -729,7 +729,7 @@ void scst_unregister_virtual_device(int id) scst_assign_dev_handler(dev, &scst_null_devtype); - PRINT_INFO_PR("Detached SCSI target mid-level from virtual device %s " + PRINT_INFO("Detached SCSI target mid-level from virtual device %s " "(id %d)", dev->virt_name, dev->virt_id); scst_free_device(dev); @@ -757,7 +757,7 @@ int scst_register_dev_driver(struct scst_dev_type *dev_type) #if !defined(SCSI_EXEC_REQ_FIFO_DEFINED) && !defined(STRICT_SERIALIZING) if (dev_type->exec == NULL) { - PRINT_ERROR_PR("Pass-through dev handlers (handler \"%s\") not " + PRINT_ERROR("Pass-through dev handlers (handler \"%s\") not " "supported. Consider applying on your kernel patch " "scst_exec_req_fifo-.patch or define " "STRICT_SERIALIZING", dev_type->name); @@ -775,7 +775,7 @@ int scst_register_dev_driver(struct scst_dev_type *dev_type) exist = 0; list_for_each_entry(dt, &scst_dev_type_list, dev_type_list_entry) { if (strcmp(dt->name, dev_type->name) == 0) { - PRINT_ERROR_PR("Device type handler \"%s\" already " + PRINT_ERROR("Device type handler \"%s\" already " "exist", dt->name); exist = 1; break; @@ -802,7 +802,7 @@ int scst_register_dev_driver(struct scst_dev_type *dev_type) scst_resume_activity(); if (res == 0) { - PRINT_INFO_PR("Device handler \"%s\" for type %d registered " + PRINT_INFO("Device handler \"%s\" for type %d registered " "successfully", dev_type->name, dev_type->type); } @@ -817,7 +817,7 @@ out_err_res: scst_resume_activity(); out_error: - PRINT_ERROR_PR("Failed to register device handler \"%s\" for type %d", + PRINT_ERROR("Failed to register device handler \"%s\" for type %d", dev_type->name, dev_type->type); goto out; } @@ -840,7 +840,7 @@ void scst_unregister_dev_driver(struct scst_dev_type *dev_type) } } if (!found) { - PRINT_ERROR_PR("Dev handler \"%s\" isn't registered", + PRINT_ERROR("Dev handler \"%s\" isn't registered", dev_type->name); goto out_up; } @@ -859,7 +859,7 @@ void scst_unregister_dev_driver(struct scst_dev_type *dev_type) scst_cleanup_proc_dev_handler_dir_entries(dev_type); - PRINT_INFO_PR("Device handler \"%s\" for type %d unloaded", + PRINT_INFO("Device handler \"%s\" for type %d unloaded", dev_type->name, dev_type->type); out: @@ -889,11 +889,11 @@ int scst_register_virtual_dev_driver(struct scst_dev_type *dev_type) } if (dev_type->type != -1) { - PRINT_INFO_PR("Virtual device handler %s for type %d " + PRINT_INFO("Virtual device handler %s for type %d " "registered successfully", dev_type->name, dev_type->type); } else { - PRINT_INFO_PR("Virtual device handler \"%s\" registered " + PRINT_INFO("Virtual device handler \"%s\" registered " "successfully", dev_type->name); } @@ -902,7 +902,7 @@ out: return res; out_err: - PRINT_ERROR_PR("Failed to register virtual device handler \"%s\"", + PRINT_ERROR("Failed to register virtual device handler \"%s\"", dev_type->name); goto out; } @@ -914,7 +914,7 @@ void scst_unregister_virtual_dev_driver(struct scst_dev_type *dev_type) if (!dev_type->no_proc) scst_cleanup_proc_dev_handler_dir_entries(dev_type); - PRINT_INFO_PR("Device handler \"%s\" unloaded", dev_type->name); + PRINT_INFO("Device handler \"%s\" unloaded", dev_type->name); TRACE_EXIT(); return; @@ -938,7 +938,7 @@ int scst_add_dev_threads(struct scst_device *dev, int num) thr = kmalloc(sizeof(*thr), GFP_KERNEL); if (!thr) { res = -ENOMEM; - PRINT_ERROR_PR("Failed to allocate thr %d", res); + PRINT_ERROR("Failed to allocate thr %d", res); goto out; } strncpy(nm, dev->handler->name, ARRAY_SIZE(nm)-1); @@ -947,7 +947,7 @@ int scst_add_dev_threads(struct scst_device *dev, int num) &dev->cmd_lists, "%sd%d_%d", nm, dev->dev_num, n++); if (IS_ERR(thr->cmd_thread)) { res = PTR_ERR(thr->cmd_thread); - PRINT_ERROR_PR("kthread_create() failed: %d", res); + PRINT_ERROR("kthread_create() failed: %d", res); kfree(thr); goto out; } @@ -1083,7 +1083,7 @@ int scst_assign_dev_handler(struct scst_device *dev, res = handler->attach(dev); TRACE_DBG("New dev handler's attach() returned %d", res); if (res != 0) { - PRINT_ERROR_PR("New device handler's %s attach() " + PRINT_ERROR("New device handler's %s attach() " "failed: %d", handler->name, res); } goto out_thr_null; @@ -1097,7 +1097,7 @@ int scst_assign_dev_handler(struct scst_device *dev, res = handler->attach_tgt(tgt_dev); TRACE_DBG("%s", "Dev handler's attach_tgt() returned"); if (res != 0) { - PRINT_ERROR_PR("Device handler's %s attach_tgt() " + PRINT_ERROR("Device handler's %s attach_tgt() " "failed: %d", handler->name, res); goto out_err_detach_tgt; } @@ -1165,7 +1165,7 @@ void __scst_del_cmd_threads(int num) i = scst_threads_info.nr_cmd_threads; if (num <= 0 || num > i) { - PRINT_ERROR_PR("can not del %d cmd threads from %d", num, i); + PRINT_ERROR("can not del %d cmd threads from %d", num, i); return; } @@ -1203,7 +1203,7 @@ int __scst_add_cmd_threads(int num) thr = kmalloc(sizeof(*thr), GFP_KERNEL); if (!thr) { res = -ENOMEM; - PRINT_ERROR_PR("fail to allocate thr %d", res); + PRINT_ERROR("fail to allocate thr %d", res); goto out_error; } thr->cmd_thread = kthread_run(scst_cmd_thread, @@ -1211,7 +1211,7 @@ int __scst_add_cmd_threads(int num) scst_thread_num++); if (IS_ERR(thr->cmd_thread)) { res = PTR_ERR(thr->cmd_thread); - PRINT_ERROR_PR("kthread_create() failed: %d", res); + PRINT_ERROR("kthread_create() failed: %d", res); kfree(thr); goto out_error; } @@ -1290,7 +1290,7 @@ static int scst_start_all_threads(int num) NULL, "scsi_tgt_init"); if (IS_ERR(scst_threads_info.init_cmd_thread)) { res = PTR_ERR(scst_threads_info.init_cmd_thread); - PRINT_ERROR_PR("kthread_create() for init cmd failed: %d", res); + PRINT_ERROR("kthread_create() for init cmd failed: %d", res); scst_threads_info.init_cmd_thread = NULL; goto out; } @@ -1299,7 +1299,7 @@ static int scst_start_all_threads(int num) NULL, "scsi_tgt_mc"); if (IS_ERR(scst_threads_info.mgmt_cmd_thread)) { res = PTR_ERR(scst_threads_info.mgmt_cmd_thread); - PRINT_ERROR_PR("kthread_create() for mcmd failed: %d", res); + PRINT_ERROR("kthread_create() for mcmd failed: %d", res); scst_threads_info.mgmt_cmd_thread = NULL; goto out; } @@ -1308,7 +1308,7 @@ static int scst_start_all_threads(int num) NULL, "scsi_tgt_mgmt"); if (IS_ERR(scst_threads_info.mgmt_thread)) { res = PTR_ERR(scst_threads_info.mgmt_thread); - PRINT_ERROR_PR("kthread_create() for mgmt failed: %d", res); + PRINT_ERROR("kthread_create() for mgmt failed: %d", res); scst_threads_info.mgmt_thread = NULL; goto out; } @@ -1416,7 +1416,7 @@ static int __init init_scst(void) scst_threads = scst_num_cpus; if (scst_threads < scst_num_cpus) { - PRINT_ERROR_PR("%s", "scst_threads can not be less than " + PRINT_ERROR("%s", "scst_threads can not be less than " "CPUs count"); scst_threads = scst_num_cpus; } @@ -1498,7 +1498,7 @@ static int __init init_scst(void) goto out_thread_free; - PRINT_INFO_PR("SCST version %s loaded successfully (max mem for " + PRINT_INFO("SCST version %s loaded successfully (max mem for " "commands %ld Mb)", SCST_VERSION_STRING, scst_max_cmd_mem >> 20); out: @@ -1577,7 +1577,7 @@ static void __exit exit_scst(void) DEINIT_CACHEP(scst_tgtd_cachep); DEINIT_CACHEP(scst_acgd_cachep); - PRINT_INFO_PR("%s", "SCST unloaded"); + PRINT_INFO("%s", "SCST unloaded"); TRACE_EXIT(); return; diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 09fac7ccd..478b0a34d 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -30,6 +30,8 @@ #include #endif +#define LOG_PREFIX "scst" + #include "scst_debug.h" #define SCST_MAJOR 177 @@ -41,8 +43,6 @@ #define TRACE_SEND_BOT 0x08000000 /** bottom being the edge toward the interupt */ #define TRACE_RECV_BOT 0x04000000 -#define LOG_PREFIX "scst" - #if defined(DEBUG) || defined(TRACING) #define trace_flag scst_trace_flag extern unsigned long scst_trace_flag; @@ -63,8 +63,7 @@ extern unsigned long scst_trace_flag; #else /* DEBUG */ # ifdef TRACING -#define SCST_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MINOR | TRACE_PID | \ - TRACE_SPECIAL) +#define SCST_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MINOR | TRACE_SPECIAL) # else #define SCST_DEFAULT_LOG_FLAGS 0 # endif diff --git a/scst/src/scst_proc.c b/scst/src/scst_proc.c index fe90806b1..5f6c5017c 100644 --- a/scst/src/scst_proc.c +++ b/scst/src/scst_proc.c @@ -266,7 +266,7 @@ int scst_proc_log_entry_write(struct file *file, const char *buf, if (p[strlen(p) - 1] == '\n') { p[strlen(p) - 1] = '\0'; } - PRINT_ERROR_PR("Unknown action \"%s\"", p); + PRINT_ERROR("Unknown action \"%s\"", p); res = -EINVAL; goto out_free; } @@ -313,7 +313,7 @@ int scst_proc_log_entry_write(struct file *file, const char *buf, } } if (level == 0) { - PRINT_ERROR_PR("Unknown token \"%s\"", p); + PRINT_ERROR("Unknown token \"%s\"", p); res = -EINVAL; goto out_free; } @@ -387,7 +387,7 @@ static int __init scst_proc_init_module_log(void) SCST_PROC_LOG_ENTRY_NAME, &scst_log_proc_data); if (!generic) { - PRINT_ERROR_PR("cannot init /proc/%s/%s", + PRINT_ERROR("cannot init /proc/%s/%s", SCST_PROC_ENTRY_NAME, SCST_PROC_LOG_ENTRY_NAME); res = -ENOMEM; } @@ -417,7 +417,7 @@ int scst_proc_group_add_tree(struct scst_acg *acg, const char *name) acg->acg_proc_root = proc_mkdir(name, scst_proc_groups_root); if (acg->acg_proc_root == NULL) { - PRINT_ERROR_PR("Not enough memory to register %s entry in " + PRINT_ERROR("Not enough memory to register %s entry in " "/proc/%s/%s", name, SCST_PROC_ENTRY_NAME, SCST_PROC_GROUPS_ENTRY_NAME); goto out; @@ -428,7 +428,7 @@ int scst_proc_group_add_tree(struct scst_acg *acg, const char *name) SCST_PROC_GROUPS_DEVICES_ENTRY_NAME, &scst_groups_devices_proc_data); if (!generic) { - PRINT_ERROR_PR("cannot init /proc/%s/%s/%s/%s", + PRINT_ERROR("cannot init /proc/%s/%s/%s/%s", SCST_PROC_ENTRY_NAME, SCST_PROC_GROUPS_ENTRY_NAME, name, SCST_PROC_GROUPS_DEVICES_ENTRY_NAME); @@ -441,7 +441,7 @@ int scst_proc_group_add_tree(struct scst_acg *acg, const char *name) SCST_PROC_GROUPS_USERS_ENTRY_NAME, &scst_groups_names_proc_data); if (!generic) { - PRINT_ERROR_PR("cannot init /proc/%s/%s/%s/%s", + PRINT_ERROR("cannot init /proc/%s/%s/%s/%s", SCST_PROC_ENTRY_NAME, SCST_PROC_GROUPS_ENTRY_NAME, name, SCST_PROC_GROUPS_USERS_ENTRY_NAME); @@ -494,7 +494,7 @@ static int scst_proc_group_add(const char *p) acg = scst_alloc_add_acg(name); if (acg == NULL) { - PRINT_ERROR_PR("scst_alloc_add_acg() (name %s) failed", name); + PRINT_ERROR("scst_alloc_add_acg() (name %s) failed", name); goto out_free; } @@ -550,7 +550,7 @@ static int __init scst_proc_init_groups(void) scst_proc_groups_root = proc_mkdir(SCST_PROC_GROUPS_ENTRY_NAME, scst_proc_scsi_tgt); if (scst_proc_groups_root == NULL) { - PRINT_ERROR_PR("Not enough memory to register %s entry in " + PRINT_ERROR("Not enough memory to register %s entry in " "/proc/%s", SCST_PROC_GROUPS_ENTRY_NAME, SCST_PROC_ENTRY_NAME); goto out_nomem; @@ -603,7 +603,7 @@ static int __init scst_proc_init_sgv(void) pr = scst_create_proc_entry(scst_proc_scsi_tgt, "sgv", &scst_sgv_proc_data); if (pr == NULL) { - PRINT_ERROR_PR("%s", "cannot create sgv /proc entry"); + PRINT_ERROR("%s", "cannot create sgv /proc entry"); res = -ENOMEM; } @@ -627,7 +627,7 @@ int __init scst_proc_init_module(void) scst_proc_scsi_tgt = proc_mkdir(SCST_PROC_ENTRY_NAME, 0); if (!scst_proc_scsi_tgt) { - PRINT_ERROR_PR("cannot init /proc/%s", SCST_PROC_ENTRY_NAME); + PRINT_ERROR("cannot init /proc/%s", SCST_PROC_ENTRY_NAME); goto out_nomem; } @@ -635,7 +635,7 @@ int __init scst_proc_init_module(void) SCST_PROC_ENTRY_NAME, &scst_tgt_proc_data); if (!generic) { - PRINT_ERROR_PR("cannot init /proc/%s/%s", + PRINT_ERROR("cannot init /proc/%s/%s", SCST_PROC_ENTRY_NAME, SCST_PROC_ENTRY_NAME); goto out_remove; } @@ -643,7 +643,7 @@ int __init scst_proc_init_module(void) generic = scst_create_proc_entry(scst_proc_scsi_tgt, SCST_PROC_VERSION_NAME, &scst_version_proc_data); if (!generic) { - PRINT_ERROR_PR("cannot init /proc/%s/%s", + PRINT_ERROR("cannot init /proc/%s/%s", SCST_PROC_ENTRY_NAME, SCST_PROC_VERSION_NAME); goto out_remove1; } @@ -651,7 +651,7 @@ int __init scst_proc_init_module(void) generic = scst_create_proc_entry(scst_proc_scsi_tgt, SCST_PROC_SESSIONS_NAME, &scst_sessions_proc_data); if (!generic) { - PRINT_ERROR_PR("cannot init /proc/%s/%s", + PRINT_ERROR("cannot init /proc/%s/%s", SCST_PROC_ENTRY_NAME, SCST_PROC_SESSIONS_NAME); goto out_remove2; } @@ -659,7 +659,7 @@ int __init scst_proc_init_module(void) generic = scst_create_proc_entry(scst_proc_scsi_tgt, SCST_PROC_HELP_NAME, &scst_help_proc_data); if (!generic) { - PRINT_ERROR_PR("cannot init /proc/%s/%s", + PRINT_ERROR("cannot init /proc/%s/%s", SCST_PROC_ENTRY_NAME, SCST_PROC_HELP_NAME); goto out_remove3; } @@ -668,7 +668,7 @@ int __init scst_proc_init_module(void) SCST_PROC_THREADS_NAME, &scst_threads_proc_data); if (!generic) { - PRINT_ERROR_PR("cannot init /proc/%s/%s", + PRINT_ERROR("cannot init /proc/%s/%s", SCST_PROC_ENTRY_NAME, SCST_PROC_THREADS_NAME); goto out_remove4; } @@ -779,7 +779,7 @@ static ssize_t scst_proc_threads_write(struct file *file, const char __user *buf oldtn = scst_threads_info.nr_cmd_threads; newtn = simple_strtoul(buffer, NULL, 0); if (newtn <= 0) { - PRINT_ERROR_PR("Illegal threads num value %d", newtn); + PRINT_ERROR("Illegal threads num value %d", newtn); res = -EINVAL; goto out_up_thr_free; } @@ -789,7 +789,7 @@ static ssize_t scst_proc_threads_write(struct file *file, const char __user *buf else __scst_add_cmd_threads(delta); - PRINT_INFO_PR("Changed cmd threads num: old %d, new %d", oldtn, newtn); + PRINT_INFO("Changed cmd threads num: old %d, new %d", oldtn, newtn); out_up_thr_free: mutex_unlock(&scst_threads_info.cmd_threads_mutex); @@ -812,7 +812,7 @@ int scst_build_proc_target_dir_entries(struct scst_tgt_template *vtt) /* create the proc directory entry for the device */ vtt->proc_tgt_root = proc_mkdir(vtt->name, scst_proc_scsi_tgt); if (vtt->proc_tgt_root == NULL) { - PRINT_ERROR_PR("Not enough memory to register SCSI target %s " + PRINT_ERROR("Not enough memory to register SCSI target %s " "in /proc/%s", vtt->name, SCST_PROC_ENTRY_NAME); goto out_nomem; } @@ -853,7 +853,7 @@ int scst_build_proc_target_entries(struct scst_tgt *vtt) name, &scst_scsi_tgt_proc_data); if (p == NULL) { - PRINT_ERROR_PR("Not enough memory to register SCSI " + PRINT_ERROR("Not enough memory to register SCSI " "target entry %s in /proc/%s/%s", name, SCST_PROC_ENTRY_NAME, vtt->tgtt->name); res = -ENOMEM; @@ -954,7 +954,7 @@ int scst_build_proc_dev_handler_dir_entries(struct scst_dev_type *dev_type) dev_type->proc_dev_type_root = proc_mkdir(dev_type->name, scst_proc_scsi_tgt); if (dev_type->proc_dev_type_root == NULL) { - PRINT_ERROR_PR("Not enough memory to register dev handler dir " + PRINT_ERROR("Not enough memory to register dev handler dir " "%s in /proc/%s", dev_type->name, SCST_PROC_ENTRY_NAME); goto out_nomem; } @@ -965,7 +965,7 @@ int scst_build_proc_dev_handler_dir_entries(struct scst_dev_type *dev_type) SCST_PROC_DEV_HANDLER_TYPE_ENTRY_NAME, &scst_dev_handler_type_proc_data); if (p == NULL) { - PRINT_ERROR_PR("Not enough memory to register dev " + PRINT_ERROR("Not enough memory to register dev " "handler entry %s in /proc/%s/%s", SCST_PROC_DEV_HANDLER_TYPE_ENTRY_NAME, SCST_PROC_ENTRY_NAME, dev_type->name); @@ -980,7 +980,7 @@ int scst_build_proc_dev_handler_dir_entries(struct scst_dev_type *dev_type) dev_type->name, &scst_dev_handler_proc_data); if (p == NULL) { - PRINT_ERROR_PR("Not enough memory to register dev " + PRINT_ERROR("Not enough memory to register dev " "handler entry %s in /proc/%s/%s", dev_type->name, SCST_PROC_ENTRY_NAME, dev_type->name); goto out_remove1; @@ -1135,7 +1135,7 @@ static ssize_t scst_proc_scsi_tgt_gen_write(struct file *file, const char __user p += 10; action = SCST_PROC_ACTION_DEL_GROUP; } else { - PRINT_ERROR_PR("Unknown action \"%s\"", p); + PRINT_ERROR("Unknown action \"%s\"", p); res = -EINVAL; goto out_free; } @@ -1151,7 +1151,7 @@ static ssize_t scst_proc_scsi_tgt_gen_write(struct file *file, const char __user case SCST_PROC_ACTION_ADD_GROUP: case SCST_PROC_ACTION_DEL_GROUP: if (strcmp(p, SCST_DEFAULT_ACG_NAME) == 0) { - PRINT_ERROR_PR("Attempt to add/delete predefined " + PRINT_ERROR("Attempt to add/delete predefined " "group \"%s\"", p); res = -EINVAL; goto out_up_free; @@ -1167,7 +1167,7 @@ static ssize_t scst_proc_scsi_tgt_gen_write(struct file *file, const char __user switch (action) { case SCST_PROC_ACTION_ADD_GROUP: if (acg) { - PRINT_ERROR_PR("acg name %s exist", p); + PRINT_ERROR("acg name %s exist", p); res = -EINVAL; goto out_up_free; } @@ -1175,7 +1175,7 @@ static ssize_t scst_proc_scsi_tgt_gen_write(struct file *file, const char __user break; case SCST_PROC_ACTION_DEL_GROUP: if (acg == NULL) { - PRINT_ERROR_PR("acg name %s not found", p); + PRINT_ERROR("acg name %s not found", p); res = -EINVAL; goto out_up_free; } @@ -1264,7 +1264,7 @@ static int scst_proc_assign_handler(char *buf) } if (dev == NULL) { - PRINT_ERROR_PR("Device %ld:%ld:%ld:%ld not found", + PRINT_ERROR("Device %ld:%ld:%ld:%ld not found", host, channel, id, lun); res = -EINVAL; goto out; @@ -1280,13 +1280,13 @@ static int scst_proc_assign_handler(char *buf) } if (handler == NULL) { - PRINT_ERROR_PR("Handler %s not found", e); + PRINT_ERROR("Handler %s not found", e); res = -EINVAL; goto out; } if (dev->scsi_dev->type != handler->type) { - PRINT_ERROR_PR("Type %d of device %s differs from type " + PRINT_ERROR("Type %d of device %s differs from type " "%d of dev handler %s", dev->handler->type, dev->handler->name, handler->type, handler->name); res = -EINVAL; @@ -1300,7 +1300,7 @@ out: return res; out_synt_err: - PRINT_ERROR_PR("Syntax error on %s", p); + PRINT_ERROR("Syntax error on %s", p); res = -EINVAL; goto out; } @@ -1359,7 +1359,7 @@ static ssize_t scst_proc_groups_devices_write(struct file *file, const char __us p += 4; action = SCST_PROC_ACTION_DEL; } else { - PRINT_ERROR_PR("Unknown action \"%s\"", p); + PRINT_ERROR("Unknown action \"%s\"", p); res = -EINVAL; goto out_free; } @@ -1416,9 +1416,9 @@ static ssize_t scst_proc_groups_devices_write(struct file *file, const char __us } if (dev == NULL) { if (virt) { - PRINT_ERROR_PR("Virt device %s not found", p); + PRINT_ERROR("Virt device %s not found", p); } else { - PRINT_ERROR_PR("Device %d:%d:%d:%d not found", + PRINT_ERROR("Device %d:%d:%d:%d not found", host, channel, id, lun); } res = -EINVAL; @@ -1453,21 +1453,21 @@ static ssize_t scst_proc_groups_devices_write(struct file *file, const char __us } if (acg_dev) { acg_dev = acg_dev_tmp; - PRINT_ERROR_PR("virt lun %d exist in group %s", + PRINT_ERROR("virt lun %d exist in group %s", virt_lun, acg->acg_name); res = -EINVAL; goto out_free_up; } rc = scst_acg_add_dev(acg, dev, virt_lun, read_only); if (rc) { - PRINT_ERROR_PR("scst_acg_add_dev() returned %d", rc); + PRINT_ERROR("scst_acg_add_dev() returned %d", rc); res = rc; } break; case SCST_PROC_ACTION_DEL: rc = scst_acg_remove_dev(acg, dev); if (rc) { - PRINT_ERROR_PR("scst_acg_remove_dev() returned %d", rc); + PRINT_ERROR("scst_acg_remove_dev() returned %d", rc); res = rc; } break; @@ -1477,7 +1477,7 @@ static ssize_t scst_proc_groups_devices_write(struct file *file, const char __us acg_dev_list_entry) { rc = scst_acg_remove_dev(acg, acg_dev->dev); if (rc) { - PRINT_ERROR_PR("scst_acg_remove_dev() " + PRINT_ERROR("scst_acg_remove_dev() " "return %d", rc); res = rc; } @@ -1550,7 +1550,7 @@ static ssize_t scst_proc_groups_names_write(struct file *file, const char __user p += 4; action = SCST_PROC_ACTION_DEL; } else { - PRINT_ERROR_PR("Unknown action \"%s\"", p); + PRINT_ERROR("Unknown action \"%s\"", p); res = -EINVAL; goto out_free; } @@ -1991,7 +1991,7 @@ struct proc_dir_entry *scst_create_proc_entry(struct proc_dir_entry * root, mode = S_IFREG | S_IRUGO | ((pdata->seq_op.write) ? S_IWUSR : 0); p = create_proc_entry(name, mode, root); if (p == NULL) { - PRINT_ERROR_PR("Fail to create entry %s in /proc", name); + PRINT_ERROR("Fail to create entry %s in /proc", name); } else { p->proc_fops = &pdata->seq_op; p->data = pdata->data; diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index afba6209f..5ca26426a 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -62,7 +62,7 @@ struct scst_cmd *scst_rx_cmd(struct scst_session *sess, #ifdef EXTRACHECKS if (unlikely(sess->shut_phase != SCST_SESS_SPH_READY)) { - PRINT_ERROR_PR("%s", "New cmd while shutting down the session"); + PRINT_ERROR("%s", "New cmd while shutting down the session"); sBUG(); } #endif @@ -180,7 +180,7 @@ void scst_cmd_init_done(struct scst_cmd *cmd, int pref_context) if (unlikely(in_irq()) && ((pref_context == SCST_CONTEXT_DIRECT) || (pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) { - PRINT_ERROR_PR("Wrong context %d in IRQ from target %s, use " + PRINT_ERROR("Wrong context %d in IRQ from target %s, use " "SCST_CONTEXT_TASKLET instead\n", pref_context, cmd->tgtt->name); pref_context = SCST_CONTEXT_TASKLET; @@ -216,7 +216,7 @@ void scst_cmd_init_done(struct scst_cmd *cmd, int pref_context) spin_unlock_irqrestore(&sess->sess_list_lock, flags); if (unlikely(cmd->lun == (lun_t)-1)) { - PRINT_ERROR_PR("Wrong LUN %d, finishing cmd", -1); + PRINT_ERROR("Wrong LUN %d, finishing cmd", -1); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_lun_not_supported)); cmd->state = SCST_CMD_STATE_XMIT_RESP; @@ -224,7 +224,7 @@ void scst_cmd_init_done(struct scst_cmd *cmd, int pref_context) } if (unlikely(cmd->cdb_len == 0)) { - PRINT_ERROR_PR("Wrong CDB len %d, finishing cmd", 0); + PRINT_ERROR("Wrong CDB len %d, finishing cmd", 0); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); cmd->state = SCST_CMD_STATE_XMIT_RESP; @@ -251,7 +251,7 @@ active: break; default: - PRINT_ERROR_PR("Context %x is undefined, using the thread one", + PRINT_ERROR("Context %x is undefined, using the thread one", pref_context); /* go through */ case SCST_CONTEXT_THREAD: @@ -306,7 +306,7 @@ static int scst_parse_cmd(struct scst_cmd *cmd) if (unlikely(scst_get_cdb_info(cmd->cdb, dev->handler->type, &cdb_info) != 0)) { - PRINT_ERROR_PR("Unknown opcode 0x%02x for %s. " + PRINT_ERROR("Unknown opcode 0x%02x for %s. " "Should you update scst_scsi_op_table?", cmd->cdb[0], dev->handler->name); #ifdef USE_EXPECTED_VALUES @@ -321,7 +321,7 @@ static int scst_parse_cmd(struct scst_cmd *cmd) /* Restore (likely) lost CDB length */ cmd->cdb_len = scst_get_cdb_len(cmd->cdb); if (cmd->cdb_len == -1) { - PRINT_ERROR_PR("Unable to get CDB length for " + PRINT_ERROR("Unable to get CDB length for " "opcode 0x%02x. Returning INVALID " "OPCODE", cmd->cdb[0]); scst_set_cmd_error(cmd, @@ -329,7 +329,7 @@ static int scst_parse_cmd(struct scst_cmd *cmd) goto out_xmit; } } else { - PRINT_ERROR_PR("Unknown opcode 0x%02x for %s and " + PRINT_ERROR("Unknown opcode 0x%02x for %s and " "target %s not supplied expected values", cmd->cdb[0], dev->handler->name, cmd->tgtt->name); scst_set_cmd_error(cmd, @@ -372,7 +372,7 @@ static int scst_parse_cmd(struct scst_cmd *cmd) } if (unlikely(cmd->cdb[cmd->cdb_len - 1] & CONTROL_BYTE_NACA_BIT)) { - PRINT_ERROR_PR("NACA bit in control byte CDB is not supported " + PRINT_ERROR("NACA bit in control byte CDB is not supported " "(opcode 0x%02x)", cmd->cdb[0]); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); @@ -380,7 +380,7 @@ static int scst_parse_cmd(struct scst_cmd *cmd) } if (unlikely(cmd->cdb[cmd->cdb_len - 1] & CONTROL_BYTE_LINK_BIT)) { - PRINT_ERROR_PR("Linked commands are not supported " + PRINT_ERROR("Linked commands are not supported " "(opcode 0x%02x)", cmd->cdb[0]); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); @@ -422,7 +422,7 @@ call_parse: cmd->data_len = cmd->bufflen; if (cmd->data_buf_alloced && unlikely((orig_bufflen > cmd->bufflen))) { - PRINT_ERROR_PR("Dev handler supplied data buffer (size %d), " + PRINT_ERROR("Dev handler supplied data buffer (size %d), " "is less, than required (size %d)", cmd->bufflen, orig_bufflen); goto out_error; @@ -440,7 +440,7 @@ call_parse: ((cmd->bufflen != 0) && (cmd->sg == NULL) && (state > SCST_CMD_STATE_PREPARE_SPACE)))) { - PRINT_ERROR_PR("Dev handler %s parse() returned " + PRINT_ERROR("Dev handler %s parse() returned " "invalid cmd data_direction %d, " "bufflen %d or state %d (opcode 0x%x)", dev->handler->name, @@ -455,7 +455,7 @@ call_parse: # ifdef EXTRACHECKS if ((cmd->data_direction != cmd->expected_data_direction) || (cmd->bufflen != cmd->expected_transfer_len)) { - PRINT_ERROR_PR("Expected values don't match decoded ones: " + PRINT_ERROR("Expected values don't match decoded ones: " "data_direction %d, expected_data_direction %d, " "bufflen %d, expected_transfer_len %d", cmd->data_direction, cmd->expected_data_direction, @@ -466,7 +466,7 @@ call_parse: cmd->bufflen = cmd->expected_transfer_len; #else if (unlikely(cmd->data_direction != cdb_info.direction)) { - PRINT_ERROR_PR("Expected data direction %d for opcode " + PRINT_ERROR("Expected data direction %d for opcode " "0x%02x (handler %s, target %s) doesn't match " "decoded value %d", cmd->data_direction, cmd->cdb[0], dev->handler->name, @@ -476,7 +476,7 @@ call_parse: goto out_dev_done; } if (unlikely(cmd->bufflen != cmd->expected_transfer_len)) { - PRINT_INFO_PR("Warning: expected transfer length %d for " + PRINT_INFO("Warning: expected transfer length %d for " "opcode 0x%02x (handler %s, target %s) doesn't " "match decoded value %d. Faulty initiator?", cmd->expected_transfer_len, cmd->cdb[0], @@ -501,11 +501,11 @@ call_parse: default: if (state >= 0) { - PRINT_ERROR_PR("Dev handler %s parse() returned " + PRINT_ERROR("Dev handler %s parse() returned " "invalid cmd state %d (opcode %d)", dev->handler->name, state, cmd->cdb[0]); } else { - PRINT_ERROR_PR("Dev handler %s parse() returned " + PRINT_ERROR("Dev handler %s parse() returned " "error %d (opcode %d)", dev->handler->name, state, cmd->cdb[0]); } @@ -560,7 +560,7 @@ static int scst_prepare_space(struct scst_cmd *cmd) else if (r == 0) { cmd->data_buf_alloced = 1; if (unlikely(orig_bufflen < cmd->bufflen)) { - PRINT_ERROR_PR("Target driver allocated data " + PRINT_ERROR("Target driver allocated data " "buffer (size %d), is less, than " "required (size %d)", orig_bufflen, cmd->bufflen); @@ -657,7 +657,7 @@ void scst_restart_cmd(struct scst_cmd *cmd, int status, int pref_context) if (in_irq() && ((pref_context == SCST_CONTEXT_DIRECT) || (pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) { - PRINT_ERROR_PR("Wrong context %d in IRQ from target %s, use " + PRINT_ERROR("Wrong context %d in IRQ from target %s, use " "SCST_CONTEXT_TASKLET instead\n", pref_context, cmd->tgtt->name); pref_context = SCST_CONTEXT_TASKLET; @@ -705,7 +705,7 @@ void scst_restart_cmd(struct scst_cmd *cmd, int status, int pref_context) break; default: - PRINT_ERROR_PR("%s() received unknown status %x", __func__, + PRINT_ERROR("%s() received unknown status %x", __func__, status); cmd->state = SCST_CMD_STATE_DEV_DONE; break; @@ -834,10 +834,10 @@ out: out_error_rc: if (rc == SCST_TGT_RES_FATAL_ERROR) { - PRINT_ERROR_PR("Target driver %s rdy_to_xfer() returned " + PRINT_ERROR("Target driver %s rdy_to_xfer() returned " "fatal error", cmd->tgtt->name); } else { - PRINT_ERROR_PR("Target driver %s rdy_to_xfer() returned invalid " + PRINT_ERROR("Target driver %s rdy_to_xfer() returned invalid " "value %d", cmd->tgtt->name, rc); } scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); @@ -867,7 +867,7 @@ void scst_proccess_redirect_cmd(struct scst_cmd *cmd, int context, break; default: - PRINT_ERROR_PR("Context %x is unknown, using the thread one", + PRINT_ERROR("Context %x is unknown, using the thread one", context); /* go through */ case SCST_CONTEXT_THREAD: @@ -907,7 +907,7 @@ void scst_rx_data(struct scst_cmd *cmd, int status, int pref_context) if (in_irq() && ((pref_context == SCST_CONTEXT_DIRECT) || (pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) { - PRINT_ERROR_PR("Wrong context %d in IRQ from target %s, use " + PRINT_ERROR("Wrong context %d in IRQ from target %s, use " "SCST_CONTEXT_TASKLET instead\n", pref_context, cmd->tgtt->name); pref_context = SCST_CONTEXT_TASKLET; @@ -940,7 +940,7 @@ void scst_rx_data(struct scst_cmd *cmd, int status, int pref_context) break; default: - PRINT_ERROR_PR("scst_rx_data() received unknown status %x", + PRINT_ERROR("scst_rx_data() received unknown status %x", status); cmd->state = SCST_CMD_STATE_DEV_DONE; break; @@ -1027,7 +1027,7 @@ static void scst_do_cmd_done(struct scst_cmd *cmd, int result, if (unlikely(resid != 0)) { #ifdef EXTRACHECKS if ((resid < 0) || (resid > cmd->resp_data_len)) { - PRINT_ERROR_PR("Wrong resid %d (cmd->resp_data_len=%d)", + PRINT_ERROR("Wrong resid %d (cmd->resp_data_len=%d)", resid, cmd->resp_data_len); } else #endif @@ -1064,7 +1064,7 @@ static void scst_do_cmd_done(struct scst_cmd *cmd, int result, length = scst_get_buf_first(cmd, &address); TRACE_DBG("length %d", length); if (unlikely(length <= 0)) { - PRINT_ERROR_PR("%s: scst_get_buf_first() failed", + PRINT_ERROR("%s: scst_get_buf_first() failed", __func__); goto out; } @@ -1105,7 +1105,7 @@ static inline struct scst_cmd *scst_get_cmd(struct scsi_cmnd *scsi_cmd, cmd = (struct scst_cmd *)(*req)->upper_private_data; if (cmd == NULL) { - PRINT_ERROR_PR("%s", "Request with NULL cmd"); + PRINT_ERROR("%s", "Request with NULL cmd"); if (*req) scsi_release_request(*req); } @@ -1206,7 +1206,7 @@ static void scst_cmd_done_local(struct scst_cmd *cmd, int next_state) (next_state != SCST_CMD_STATE_XMIT_RESP) && (next_state != SCST_CMD_STATE_FINISHED)) { - PRINT_ERROR_PR("scst_cmd_done_local() received invalid cmd " + PRINT_ERROR("scst_cmd_done_local() received invalid cmd " "state %d (opcode %d)", next_state, cmd->cdb[0]); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); @@ -1244,7 +1244,7 @@ static int scst_report_luns_local(struct scst_cmd *cmd) cmd->driver_status = 0; if ((cmd->cdb[2] != 0) && (cmd->cdb[2] != 2)) { - PRINT_ERROR_PR("Unsupported SELECT REPORT value %x in REPORT " + PRINT_ERROR("Unsupported SELECT REPORT value %x in REPORT " "LUNS command", cmd->cdb[2]); goto out_err; } @@ -1278,7 +1278,7 @@ static int scst_report_luns_local(struct scst_cmd *cmd) } } if ((buffer_size - offs) < 8) { - PRINT_ERROR_PR("Buffer allocated for REPORT " + PRINT_ERROR("Buffer allocated for REPORT " "LUNS command doesn't allow to fit 8 " "byte entry (buffer_size=%d)", buffer_size); @@ -1381,7 +1381,7 @@ static int scst_reserve_local(struct scst_cmd *cmd) } if ((cmd->cdb[0] == RESERVE_10) && (cmd->cdb[2] & SCST_RES_3RDPTY)) { - PRINT_ERROR_PR("RESERVE_10: 3rdPty RESERVE not implemented " + PRINT_ERROR("RESERVE_10: 3rdPty RESERVE not implemented " "(lun=%Ld)", (uint64_t)cmd->lun); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); @@ -1711,7 +1711,7 @@ static int scst_do_send_to_midlev(struct scst_cmd *cmd) TRACE_DBG("Sending cmd %p to SCSI mid-level", cmd); if (unlikely(cmd->dev->scsi_dev == NULL)) { - PRINT_ERROR_PR("Command for virtual device must be " + PRINT_ERROR("Command for virtual device must be " "processed by device handler (lun %Ld)!", (uint64_t)cmd->lun); goto out_error; @@ -1727,7 +1727,7 @@ static int scst_do_send_to_midlev(struct scst_cmd *cmd) rc = SCST_EXEC_NEED_THREAD; goto out_clear; } else { - PRINT_INFO_PR("%s", "Unable to allocate request, " + PRINT_INFO("%s", "Unable to allocate request, " "sending BUSY status"); goto out_busy; } @@ -1747,7 +1747,7 @@ static int scst_do_send_to_midlev(struct scst_cmd *cmd) rc = SCST_EXEC_NEED_THREAD; goto out_clear; } else { - PRINT_INFO_PR("scst_exec_req() failed: %d", rc); + PRINT_INFO("scst_exec_req() failed: %d", rc); goto out_error; } } @@ -1766,7 +1766,7 @@ out_clear: goto out; out_rc_error: - PRINT_ERROR_PR("Dev handler %s exec() or scst_local_exec() returned " + PRINT_ERROR("Dev handler %s exec() or scst_local_exec() returned " "invalid code %d", cmd->dev->handler->name, rc); /* go through */ @@ -2096,7 +2096,7 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) if (cmd->internal) cmd = scst_complete_request_sense(cmd); } else if (unlikely(scst_check_auto_sense(cmd))) { - PRINT_INFO_PR("Command finished with CHECK CONDITION, but " + PRINT_INFO("Command finished with CHECK CONDITION, but " "without sense data (opcode 0x%x), issuing " "REQUEST SENSE", cmd->cdb[0]); rc = scst_prepare_request_sense(cmd); @@ -2105,7 +2105,7 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) res = 1; goto out; } else { - PRINT_ERROR_PR("%s", "Unable to issue REQUEST SENSE, " + PRINT_ERROR("%s", "Unable to issue REQUEST SENSE, " "returning HARDWARE ERROR"); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); @@ -2152,7 +2152,7 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) if (buflen > SCST_INQ_BYTE3) { #ifdef EXTRACHECKS if (buffer[SCST_INQ_BYTE3] & SCST_INQ_NORMACA_BIT) { - PRINT_INFO_PR("NormACA set for device: " + PRINT_INFO("NormACA set for device: " "lun=%Ld, type 0x%02x", (uint64_t)cmd->lun, buffer[0]); } @@ -2277,11 +2277,11 @@ static int scst_dev_done(struct scst_cmd *cmd) default: if (state >= 0) { - PRINT_ERROR_PR("Dev handler %s dev_done() returned " + PRINT_ERROR("Dev handler %s dev_done() returned " "invalid cmd state %d", cmd->dev->handler->name, state); } else { - PRINT_ERROR_PR("Dev handler %s dev_done() returned " + PRINT_ERROR("Dev handler %s dev_done() returned " "error %d", cmd->dev->handler->name, state); } @@ -2470,10 +2470,10 @@ out: out_error: if (rc == SCST_TGT_RES_FATAL_ERROR) { - PRINT_ERROR_PR("Target driver %s xmit_response() returned " + PRINT_ERROR("Target driver %s xmit_response() returned " "fatal error", cmd->tgtt->name); } else { - PRINT_ERROR_PR("Target driver %s xmit_response() returned " + PRINT_ERROR("Target driver %s xmit_response() returned " "invalid value %d", cmd->tgtt->name, rc); } scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); @@ -2591,7 +2591,7 @@ ordered: goto out; default: - PRINT_ERROR_PR("Unsupported queue type %d, treating it as " + PRINT_ERROR("Unsupported queue type %d, treating it as " "ORDERED", cmd->queue_type); cmd->queue_type = SCST_CMD_QUEUE_ORDERED; goto ordered; @@ -2637,7 +2637,7 @@ static int scst_translate_lun(struct scst_cmd *cmd) TRACE_DBG("tgt_dev %p found", tgt_dev); if (unlikely(tgt_dev->dev->handler == &scst_null_devtype)) { - PRINT_INFO_PR("Dev handler for device " + PRINT_INFO("Dev handler for device " "%Ld is NULL, the device will not be " "visible remotely", (uint64_t)cmd->lun); break; @@ -2900,7 +2900,7 @@ void scst_process_active_cmd(struct scst_cmd *cmd, int context) break; default: - PRINT_ERROR_PR("cmd (%p) in state %d, but shouldn't be", + PRINT_ERROR("cmd (%p) in state %d, but shouldn't be", cmd, cmd->state); sBUG(); res = SCST_CMD_STATE_RES_CONT_NEXT; @@ -2929,7 +2929,7 @@ void scst_process_active_cmd(struct scst_cmd *cmd, int context) /* not very valid commands */ case SCST_CMD_STATE_DEFAULT: case SCST_CMD_STATE_NEED_THREAD_CTX: - PRINT_ERROR_PR("cmd %p is in state %d, not putting on " + PRINT_ERROR("cmd %p is in state %d, not putting on " "useful list (left on scst cmd list)", cmd, cmd->state); spin_unlock_irq(&cmd->cmd_lists->cmd_list_lock); @@ -3439,14 +3439,14 @@ static int scst_mgmt_cmd_init(struct scst_mgmt_cmd *mcmd) cmd->sn, cmd->sn_set, cmd->queue_type); mcmd->cmd_to_abort = cmd; if (mcmd->lun_set && (mcmd->lun != cmd->lun)) { - PRINT_ERROR_PR("ABORT TASK: LUN mismatch: mcmd LUN %Lx, " + PRINT_ERROR("ABORT TASK: LUN mismatch: mcmd LUN %Lx, " "cmd LUN %Lx, cmd tag %Lu", mcmd->lun, cmd->lun, mcmd->tag); mcmd->status = SCST_MGMT_STATUS_REJECTED; } else if (mcmd->cmd_sn_set && (scst_sn_before(mcmd->cmd_sn, cmd->tgt_sn) || (mcmd->cmd_sn == cmd->tgt_sn))) { - PRINT_ERROR_PR("ABORT TASK: SN mismatch: mcmd SN %x, " + PRINT_ERROR("ABORT TASK: SN mismatch: mcmd SN %x, " "cmd SN %x, cmd tag %Lu", mcmd->cmd_sn, cmd->tgt_sn, mcmd->tag); mcmd->status = SCST_MGMT_STATUS_REJECTED; @@ -3468,7 +3468,7 @@ static int scst_mgmt_cmd_init(struct scst_mgmt_cmd *mcmd) default: rc = scst_mgmt_translate_lun(mcmd); if (rc < 0) { - PRINT_ERROR_PR("Corresponding device for lun %Ld not " + PRINT_ERROR("Corresponding device for lun %Ld not " "found", (uint64_t)mcmd->lun); mcmd->status = SCST_MGMT_STATUS_LUN_NOT_EXIST; mcmd->state = SCST_MGMT_CMD_STATE_DONE; @@ -3770,7 +3770,7 @@ static int scst_mgmt_cmd_exec(struct scst_mgmt_cmd *mcmd) goto out_done; default: - PRINT_ERROR_PR("Unknown task management function %d", mcmd->fn); + PRINT_ERROR("Unknown task management function %d", mcmd->fn); mcmd->status = SCST_MGMT_STATUS_REJECTED; goto out_done; } @@ -3890,7 +3890,7 @@ static int scst_process_mgmt_cmd(struct scst_mgmt_cmd *mcmd) break; default: - PRINT_ERROR_PR("Unknown state %d of management command", + PRINT_ERROR("Unknown state %d of management command", mcmd->state); res = -1; /* go through */ @@ -3990,7 +3990,7 @@ static struct scst_mgmt_cmd *scst_pre_rx_mgmt_cmd(struct scst_session TRACE_ENTRY(); if (unlikely(sess->tgt->tgtt->task_mgmt_fn_done == NULL)) { - PRINT_ERROR_PR("New mgmt cmd, but task_mgmt_fn_done() is NULL " + PRINT_ERROR("New mgmt cmd, but task_mgmt_fn_done() is NULL " "(target %s)", sess->tgt->tgtt->name); goto out; } @@ -4026,7 +4026,7 @@ static int scst_post_rx_mgmt_cmd(struct scst_session *sess, #ifdef EXTRACHECKS if (unlikely(sess->shut_phase != SCST_SESS_SPH_READY)) { - PRINT_ERROR_PR("%s", + PRINT_ERROR("%s", "New mgmt cmd while shutting down the session"); sBUG(); } @@ -4200,7 +4200,7 @@ static int scst_init_session(struct scst_session *sess) if (acg == NULL) acg = scst_default_acg; - PRINT_INFO_PR("Using security group \"%s\" for initiator \"%s\"", + PRINT_INFO("Using security group \"%s\" for initiator \"%s\"", acg->acg_name, sess->initiator_name); sess->acg = acg; @@ -4456,7 +4456,7 @@ int scst_mgmt_thread(void *arg) if (sess->init_phase == SCST_SESS_IPH_INITING) scst_init_session(sess); else { - PRINT_ERROR_PR("session %p is in " + PRINT_ERROR("session %p is in " "scst_sess_init_list, but in unknown " "init phase %x", sess, sess->init_phase); @@ -4483,7 +4483,7 @@ int scst_mgmt_thread(void *arg) scst_free_session_callback(sess); break; default: - PRINT_ERROR_PR("session %p is in " + PRINT_ERROR("session %p is in " "scst_sess_shut_list, but in unknown " "shut phase %lx", sess, sess->shut_phase); diff --git a/usr/fileio/common.c b/usr/fileio/common.c index 75d3c161d..d3c5f7f28 100644 --- a/usr/fileio/common.c +++ b/usr/fileio/common.c @@ -106,7 +106,7 @@ static int do_parse(struct vdisk_cmd *vcmd) vcmd->reply->subcode = vcmd->cmd->subcode; if (cmd->expected_values_set == 0) { - PRINT_ERROR_PR("%s", "Oops, expected values are not set"); + PRINT_ERROR("%s", "Oops, expected values are not set"); reply->bufflen = -1; /* invalid value */ goto out; } @@ -289,7 +289,7 @@ static int do_exec(struct vdisk_cmd *vcmd) vcmd->cmd->cmd_h, cmd->pbuf, lba_start, (uint64_t)loff, (uint64_t)data_len); if ((loff < 0) || (data_len < 0) || ((loff + data_len) > dev->file_size)) { - PRINT_INFO_PR("Access beyond the end of the device " + PRINT_INFO("Access beyond the end of the device " "(%lld of %lld, len %Ld)", (uint64_t)loff, (uint64_t)dev->file_size, (uint64_t)data_len); set_cmd_error(vcmd, SCST_LOAD_SENSE( @@ -328,7 +328,7 @@ static int do_exec(struct vdisk_cmd *vcmd) tgt_dev = find_tgt_dev(dev, cmd->sess_h); if (tgt_dev == NULL) { - PRINT_ERROR_PR("Session %Lx not found", + PRINT_ERROR("Session %Lx not found", cmd->sess_h); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); @@ -367,7 +367,7 @@ static int do_exec(struct vdisk_cmd *vcmd) tgt_dev = find_tgt_dev(dev, cmd->sess_h); if (tgt_dev == NULL) { - PRINT_ERROR_PR("Session %Lx not found", + PRINT_ERROR("Session %Lx not found", cmd->sess_h); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); @@ -587,7 +587,7 @@ static int do_sess(struct vdisk_cmd *vcmd) if (cmd->subcode == SCST_USER_ATTACH_SESS) { if (tgt_dev != NULL) { - PRINT_ERROR_PR("Session %Lx already exists)", + PRINT_ERROR("Session %Lx already exists)", cmd->sess.sess_h); res = EEXIST; goto reply; @@ -595,7 +595,7 @@ static int do_sess(struct vdisk_cmd *vcmd) tgt_dev = find_empty_tgt_dev(vcmd->dev); if (tgt_dev == NULL) { - PRINT_ERROR_PR("Too many initiators, session %Lx refused)", + PRINT_ERROR("Too many initiators, session %Lx refused)", cmd->sess.sess_h); res = ENOMEM; goto reply; @@ -604,19 +604,19 @@ static int do_sess(struct vdisk_cmd *vcmd) tgt_dev->sess_h = cmd->sess.sess_h; tgt_dev->last_write_cmd_queue_type = SCST_CMD_QUEUE_SIMPLE; - PRINT_INFO_PR("Session from initiator %s attached (LUN %Lx, " + PRINT_INFO("Session from initiator %s attached (LUN %Lx, " "threads_num %d, rd_only %d, sess_h %Lx)", cmd->sess.initiator_name, cmd->sess.lun, cmd->sess.threads_num, cmd->sess.rd_only, cmd->sess.sess_h); } else { if (tgt_dev == NULL) { - PRINT_ERROR_PR("Session %Lx not found)", cmd->sess.sess_h); + PRINT_ERROR("Session %Lx not found)", cmd->sess.sess_h); res = ESRCH; goto reply; } tgt_dev->sess_h = 0; - PRINT_INFO_PR("Session detached (sess_h %Lx)", cmd->sess.sess_h); + PRINT_INFO("Session detached (sess_h %Lx)", cmd->sess.sess_h); } reply: @@ -664,7 +664,7 @@ void *main_loop(void *arg) vcmd.fd = open_dev_fd(dev); if (vcmd.fd < 0) { res = -errno; - PRINT_ERROR_PR("Unable to open file %s (%s)", dev->file_name, + PRINT_ERROR("Unable to open file %s (%s)", dev->file_name, strerror(-res)); goto out; } @@ -709,7 +709,7 @@ void *main_loop(void *arg) else continue; default: - PRINT_ERROR_PR("SCST_USER_REPLY_AND_GET_CMD failed: " + PRINT_ERROR("SCST_USER_REPLY_AND_GET_CMD failed: " "%s (%d)", strerror(res), res); goto out_close; } @@ -730,7 +730,7 @@ again_poll: "(%s)", res, strerror(res)); goto again_poll; default: - PRINT_ERROR_PR("poll() failed: %s", strerror(res)); + PRINT_ERROR("poll() failed: %s", strerror(res)); goto out_close; } } @@ -795,7 +795,7 @@ again_poll: default: err: - PRINT_ERROR_PR("Unknown or wrong cmd subcode %x", + PRINT_ERROR("Unknown or wrong cmd subcode %x", cmd.subcode); goto out_close; } @@ -811,7 +811,7 @@ out_close: close(vcmd.fd); out: - PRINT_INFO_PR("Thread %d exiting (res=%d)", gettid(), res); + PRINT_INFO("Thread %d exiting (res=%d)", gettid(), res); TRACE_EXIT_RES(res); return (void*)res; @@ -844,7 +844,7 @@ void *prio_loop(void *arg) cmd.preply = 0; continue; default: - PRINT_ERROR_PR("SCST_USER_REPLY_AND_GET_PRIO_CMD failed: " + PRINT_ERROR("SCST_USER_REPLY_AND_GET_PRIO_CMD failed: " "%s (%d)", strerror(res), res); goto out_close; } @@ -868,7 +868,7 @@ void *prio_loop(void *arg) break; default: - PRINT_ERROR_PR("Unknown or wrong prio cmd subcode %x", + PRINT_ERROR("Unknown or wrong prio cmd subcode %x", cmd.subcode); goto out_close; } @@ -883,7 +883,7 @@ void *prio_loop(void *arg) out_close: close(vcmd.fd); - PRINT_INFO_PR("Prio thread %d exited (res=%d)", gettid(), res); + PRINT_INFO("Prio thread %d exited (res=%d)", gettid(), res); TRACE_EXIT_RES(res); return (void*)res; @@ -1276,7 +1276,7 @@ static void exec_mode_select(struct vdisk_cmd *vcmd) mselect_6 = (MODE_SELECT == cmd->cdb[0]); if (!(cmd->cdb[1] & PF) || (cmd->cdb[1] & SP)) { - PRINT_ERROR_PR("MODE SELECT: PF and/or SP are wrongly set " + PRINT_ERROR("MODE SELECT: PF and/or SP are wrongly set " "(cdb[1]=%x)", cmd->cdb[1]); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); @@ -1292,7 +1292,7 @@ static void exec_mode_select(struct vdisk_cmd *vcmd) if (address[offset - 1] == 8) { offset += 8; } else if (address[offset - 1] != 0) { - PRINT_ERROR_PR("%s", "MODE SELECT: Wrong parameters list " + PRINT_ERROR("%s", "MODE SELECT: Wrong parameters list " "lenght"); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_parm_list)); @@ -1301,14 +1301,14 @@ static void exec_mode_select(struct vdisk_cmd *vcmd) while (length > offset + 2) { if (address[offset] & PS) { - PRINT_ERROR_PR("%s", "MODE SELECT: Illegal PS bit"); + PRINT_ERROR("%s", "MODE SELECT: Illegal PS bit"); set_cmd_error(vcmd, SCST_LOAD_SENSE( scst_sense_invalid_field_in_parm_list)); goto out; } if ((address[offset] & 0x3f) == 0x8) { /* Caching page */ if (address[offset + 1] != 18) { - PRINT_ERROR_PR("%s", "MODE SELECT: Invalid " + PRINT_ERROR("%s", "MODE SELECT: Invalid " "caching page request"); set_cmd_error(vcmd, SCST_LOAD_SENSE( scst_sense_invalid_field_in_parm_list)); @@ -1430,14 +1430,14 @@ static void exec_read_toc(struct vdisk_cmd *vcmd) TRACE_ENTRY(); if (dev->type != TYPE_ROM) { - PRINT_ERROR_PR("%s", "READ TOC for non-CDROM device"); + PRINT_ERROR("%s", "READ TOC for non-CDROM device"); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); goto out; } if (cmd->cdb[2] & 0x0e/*Format*/) { - PRINT_ERROR_PR("%s", "READ TOC: invalid requested data format"); + PRINT_ERROR("%s", "READ TOC: invalid requested data format"); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); goto out; @@ -1445,7 +1445,7 @@ static void exec_read_toc(struct vdisk_cmd *vcmd) if ((cmd->cdb[6] != 0 && (cmd->cdb[2] & 0x01)) || (cmd->cdb[6] > 1 && cmd->cdb[6] != 0xAA)) { - PRINT_ERROR_PR("READ TOC: invalid requested track number %x", + PRINT_ERROR("READ TOC: invalid requested track number %x", cmd->cdb[6]); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); @@ -1504,7 +1504,7 @@ static void exec_prevent_allow_medium_removal(struct vdisk_cmd *vcmd) dev->prevent_allow_medium_removal = cmd->cdb[4] & 0x01 ? 1 : 0; else { - PRINT_ERROR_PR("%s", "Prevent allow medium removal for " + PRINT_ERROR("%s", "Prevent allow medium removal for " "non-CDROM device"); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); @@ -1551,7 +1551,7 @@ static void exec_read(struct vdisk_cmd *vcmd, loff_t loff) /* SEEK */ err = lseek64(fd, loff, 0/*SEEK_SET*/); if (err != loff) { - PRINT_ERROR_PR("lseek trouble %Ld != %Ld (errno %d)", + PRINT_ERROR("lseek trouble %Ld != %Ld (errno %d)", (uint64_t)err, (uint64_t)loff, errno); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out; @@ -1561,7 +1561,7 @@ static void exec_read(struct vdisk_cmd *vcmd, loff_t loff) } if ((err < 0) || (err < length)) { - PRINT_ERROR_PR("read() returned %Ld from %d (errno %d)", + PRINT_ERROR("read() returned %Ld from %d (errno %d)", (uint64_t)err, length, errno); if (err == -EAGAIN) set_busy(reply); @@ -1600,7 +1600,7 @@ restart: /* SEEK */ err = lseek64(fd, loff, 0/*SEEK_SET*/); if (err != loff) { - PRINT_ERROR_PR("lseek trouble %Ld != %Ld (errno %d)", + PRINT_ERROR("lseek trouble %Ld != %Ld (errno %d)", (uint64_t)err, (uint64_t)loff, errno); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); @@ -1612,7 +1612,7 @@ restart: } if (err < 0) { - PRINT_ERROR_PR("write() returned %Ld from %zd (errno %d, cmd_h " + PRINT_ERROR("write() returned %Ld from %zd (errno %d, cmd_h " "%x)", (uint64_t)err, length, errno, vcmd->cmd->cmd_h); if (err == -EAGAIN) set_busy(reply); @@ -1628,7 +1628,7 @@ restart: */ TRACE_MGMT_DBG("write() returned %d from %d", (int)err, length); if (err == 0) { - PRINT_INFO_PR("Suspicious: write() returned 0 from " + PRINT_INFO("Suspicious: write() returned 0 from " "%d", length); } length -= err; @@ -1669,7 +1669,7 @@ static void exec_verify(struct vdisk_cmd *vcmd, loff_t loff) if (!dev->nullio) { err = lseek64(fd, loff, 0/*SEEK_SET*/); if (err != loff) { - PRINT_ERROR_PR("lseek trouble %Ld != %Ld (errno %d)", + PRINT_ERROR("lseek trouble %Ld != %Ld (errno %d)", (uint64_t)err, (uint64_t)loff, errno); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out; @@ -1692,7 +1692,7 @@ static void exec_verify(struct vdisk_cmd *vcmd, loff_t loff) else err = len_mem; if ((err < 0) || (err < len_mem)) { - PRINT_ERROR_PR("read() returned %Ld from %d (errno %d)", + PRINT_ERROR("read() returned %Ld from %d (errno %d)", (uint64_t)err, len_mem, errno); if (err == -EAGAIN) set_busy(reply); @@ -1713,7 +1713,7 @@ static void exec_verify(struct vdisk_cmd *vcmd, loff_t loff) } if (length < 0) { - PRINT_ERROR_PR("Failure: %d", length); + PRINT_ERROR("Failure: %d", length); set_cmd_error(vcmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); } diff --git a/usr/fileio/debug.c b/usr/fileio/debug.c index c7cb6ed99..2d4fd2664 100644 --- a/usr/fileio/debug.c +++ b/usr/fileio/debug.c @@ -39,8 +39,8 @@ pid_t gettid (void) static char trace_buf[TRACE_BUF_SIZE]; static pthread_spinlock_t trace_buf_lock; -int debug_print_prefix(unsigned long trace_flag, const char *func, - int line) +int debug_print_prefix(unsigned long trace_flag, const char *prefix, + const char *func, int line) { int i = 0; @@ -57,6 +57,8 @@ int debug_print_prefix(unsigned long trace_flag, const char *func, if (trace_flag & TRACE_PID) i += snprintf(&trace_buf[i], TRACE_BUF_SIZE, "[%d]: ", gettid()); + if (prefix != NULL) + i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s:", prefix); if (trace_flag & TRACE_FUNCTION) i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s:", func); if (trace_flag & TRACE_LINE) @@ -131,7 +133,7 @@ int debug_init(void) res = pthread_spin_init(&trace_buf_lock, PTHREAD_PROCESS_PRIVATE); if (res != 0) { res = errno; - PRINT_ERROR_PR("pthread_spin_init() failed: %s", strerror(res)); + PRINT_ERROR("pthread_spin_init() failed: %s", strerror(res)); } return res; diff --git a/usr/fileio/debug.h b/usr/fileio/debug.h index 5b28ee14a..312101055 100644 --- a/usr/fileio/debug.h +++ b/usr/fileio/debug.h @@ -60,6 +60,12 @@ extern pid_t gettid(void); extern char *app_name; #define LOG_PREFIX app_name +#ifdef LOG_PREFIX +#define __LOG_PREFIX LOG_PREFIX +#else +#define __LOG_PREFIX NULL +#endif + #if defined(DEBUG) || defined(TRACING) extern unsigned long trace_flag; @@ -67,14 +73,16 @@ extern unsigned long trace_flag; extern int debug_init(void); extern void debug_done(void); -extern int debug_print_prefix(unsigned long trace_flag, const char *func, int line); +extern int debug_print_prefix(unsigned long trace_flag, const char *prefix, + const char *func, int line); extern void debug_print_buffer(const void *data, int len); #define TRACE(trace, format, args...) \ do { \ if (trace_flag & (trace)) \ { \ - debug_print_prefix(trace_flag, __FUNCTION__, __LINE__); \ + debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__); \ PRINT(format, args); \ } \ } while(0) @@ -83,7 +91,8 @@ do { \ do { \ if (trace_flag & TRACE_BUFF) \ { \ - debug_print_prefix(trace_flag, __FUNCTION__, __LINE__); \ + debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__); \ PRINT("%s:", message); \ debug_print_buffer(buff, len); \ } \ @@ -93,7 +102,8 @@ do { \ do { \ if (trace_flag & (flag)) \ { \ - debug_print_prefix(trace_flag, __FUNCTION__, __LINE__); \ + debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__); \ PRINT("%s:", message); \ debug_print_buffer(buff, len); \ } \ @@ -118,7 +128,8 @@ static inline void debug_done(void) {} do { \ if (trace_flag & TRACE_MEMORY) \ { \ - debug_print_prefix(trace_flag, __FUNCTION__, __LINE__); \ + debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__); \ PRINT(format, args); \ } \ } while(0) @@ -127,7 +138,8 @@ do { \ do { \ if (trace_flag & TRACE_DEBUG) \ { \ - debug_print_prefix(trace_flag, __FUNCTION__, __LINE__); \ + debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__); \ PRINT(format, args); \ } \ } while(0) @@ -136,23 +148,12 @@ do { \ do { \ if (trace_flag & TRACE_MGMT_DEBUG) \ { \ - debug_print_prefix(trace_flag, __FUNCTION__, __LINE__); \ + debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__); \ PRINT(format, args); \ } \ } while(0) -#define PRINT_ERROR_PR(format, args...) \ -do { \ - TRACE(trace_flag, "%s: ***ERROR*** " format, \ - LOG_PREFIX, args); \ -} while(0) - -#define PRINT_INFO_PR(format, args...) \ -do { \ - TRACE(trace_flag, "%s: " \ - format, LOG_PREFIX, args); \ -} while(0) - #define PRINT_ERROR(format, args...) \ do { \ TRACE(trace_flag, "***ERROR*** " format, args); \ @@ -240,17 +241,21 @@ do { \ #define TRACE_EXIT_RES(res) {} #define TRACE_EXIT_HRES(res) {} -#define PRINT_INFO_PR(format, args...) \ +#ifdef LOG_PREFIX + +#define PRINT_INFO(format, args...) \ do { \ PRINT("%s: " format, LOG_PREFIX, args); \ } while(0) -#define PRINT_ERROR_PR(format, args...) \ +#define PRINT_ERROR(format, args...) \ do { \ PRINT("%s: ***ERROR*** " \ format, LOG_PREFIX, args); \ } while(0) +#else + #define PRINT_INFO(format, args...) \ do { \ PRINT(format, args); \ @@ -261,6 +266,8 @@ do { \ PRINT("***ERROR*** " format, args); \ } while(0) +#endif /* LOG_PREFIX */ + #endif /* DEBUG */ #endif /* __DEBUG_H */ diff --git a/usr/fileio/fileio.c b/usr/fileio/fileio.c index ae61cc399..e3448ceae 100644 --- a/usr/fileio/fileio.c +++ b/usr/fileio/fileio.c @@ -33,7 +33,6 @@ #include char *app_name; -#define LOG_PREFIX app_name #include "common.h" @@ -54,7 +53,7 @@ char *app_name; #else /* DEBUG */ # ifdef TRACING -#define DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MINOR | TRACE_PID | \ +#define DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MINOR | \ TRACE_TIME | TRACE_SPECIAL) # else #define DEFAULT_LOG_FLAGS 0 @@ -137,7 +136,7 @@ static int scst_calc_block_shift(int sector_size) block_shift++; } if (block_shift < 9) { - PRINT_ERROR_PR("Wrong sector size %d", sector_size); + PRINT_ERROR("Wrong sector size %d", sector_size); block_shift = -1; } @@ -278,7 +277,7 @@ int main(int argc, char **argv) fd = open(dev.file_name, O_RDONLY|O_LARGEFILE); if (fd < 0) { res = -errno; - PRINT_ERROR_PR("Unable to open file %s (%s)", dev.file_name, + PRINT_ERROR("Unable to open file %s (%s)", dev.file_name, strerror(-res)); goto out_done; } @@ -288,7 +287,7 @@ int main(int argc, char **argv) close(fd); - PRINT_INFO_PR("Virtual device \"%s\", path \"%s\", size %LdMb, " + PRINT_INFO("Virtual device \"%s\", path \"%s\", size %LdMb, " "block size %d, nblocks %Ld, options:", dev.name, dev.file_name, dev.file_size/1024/1024, dev.block_size, dev.nblocks); if (dev.rd_only_flag) @@ -369,7 +368,7 @@ int main(int argc, char **argv) (dev.non_blocking ? O_NONBLOCK : 0)); if (dev.scst_usr_fd < 0) { res = -errno; - PRINT_ERROR_PR("Unable to open SCST device %s (%s)", + PRINT_ERROR("Unable to open SCST device %s (%s)", DEV_USER_PATH DEV_USER_NAME, strerror(-res)); goto out_done; } @@ -392,7 +391,7 @@ int main(int argc, char **argv) res = ioctl(dev.scst_usr_fd, SCST_USER_REGISTER_DEVICE, &desc); if (res != 0) { res = errno; - PRINT_ERROR_PR("Unable to register device: %s", strerror(res)); + PRINT_ERROR("Unable to register device: %s", strerror(res)); goto out_close; } @@ -404,7 +403,7 @@ int main(int argc, char **argv) res = ioctl(dev.scst_usr_fd, SCST_USER_GET_OPTIONS, &opt); if (res != 0) { res = errno; - PRINT_ERROR_PR("Unable to get options: %s", strerror(res)); + PRINT_ERROR("Unable to get options: %s", strerror(res)); goto out_close; } @@ -419,7 +418,7 @@ int main(int argc, char **argv) res = ioctl(dev.scst_usr_fd, SCST_USER_SET_OPTIONS, &opt); if (res != 0) { res = errno; - PRINT_ERROR_PR("Unable to get options: %s", strerror(res)); + PRINT_ERROR("Unable to get options: %s", strerror(res)); goto out_close; } } @@ -428,7 +427,7 @@ int main(int argc, char **argv) res = pthread_mutex_init(&dev.dev_mutex, NULL); if (res != 0) { res = errno; - PRINT_ERROR_PR("pthread_mutex_init() failed: %s", strerror(res)); + PRINT_ERROR("pthread_mutex_init() failed: %s", strerror(res)); goto out_close; } @@ -441,7 +440,7 @@ int main(int argc, char **argv) rc = pthread_create(&thread[i], NULL, main_loop, &dev); if (rc != 0) { res = errno; - PRINT_ERROR_PR("pthread_create() failed: %s", + PRINT_ERROR("pthread_create() failed: %s", strerror(res)); break; } @@ -451,7 +450,7 @@ int main(int argc, char **argv) rc = pthread_create(&prio, NULL, prio_loop, &dev); if (rc != 0) { res = errno; - PRINT_ERROR_PR("Prio pthread_create() failed: %s", + PRINT_ERROR("Prio pthread_create() failed: %s", strerror(res)); dev.prio_thr = 0; } @@ -462,7 +461,7 @@ int main(int argc, char **argv) rc = pthread_join(thread[i], &rc1); if (rc != 0) { res = errno; - PRINT_ERROR_PR("pthread_join() failed: %s", + PRINT_ERROR("pthread_join() failed: %s", strerror(res)); } else if (rc1 != NULL) { res = (int)rc1; @@ -474,7 +473,7 @@ int main(int argc, char **argv) rc = pthread_join(prio, &rc1); if (rc != 0) { res = errno; - PRINT_ERROR_PR("Prio pthread_join() failed: %s", + PRINT_ERROR("Prio pthread_join() failed: %s", strerror(res)); } else if (rc1 != NULL) { res = (int)rc1;