From dc7820544d064ca5aef491dca9747c153104bfd8 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Mon, 26 May 2008 11:13:04 +0000 Subject: [PATCH] Patch from Bart Van Assche : While all warnings on mismatches between printf-style format strings and argument lists were fixed on i386 and x86_64, gcc prints a large number of warnings about mismatches when compiling SCST on ppc64. The patch below fixes these by casting integer arguments to the type (long long unsigned int) where appropriate. This patch has been tested as follows: - Verified the patch by reading it. - Checked that make -s clean && make -s iscsi scst && make -s -C srpt did not trigger any compiler warnings about format strings on i386, x86_64 and ppc. - Checked that no previously fixed checkpatch warnings were reintroduced in the patch generated by generate-kernel-patch. - Checked that the patch generated by generate-kernel-patch still applies cleanly to the 2.6.25.4 kernel, and that the patched kernel tree still compiles, installs and boots fine. Additionally, this patch splits a kernel version preprocessor test from one into two lines, such that the generate-kernel-patch script can process the version check properly. Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@397 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/conn.c | 12 ++-- iscsi-scst/kernel/iscsi.c | 6 +- iscsi-scst/kernel/nthread.c | 9 ++- iscsi-scst/kernel/session.c | 9 ++- scst/src/dev_handlers/scst_user.c | 2 +- scst/src/dev_handlers/scst_vdisk.c | 59 +++++++++------- scst/src/scst_lib.c | 51 +++++++++----- scst/src/scst_priv.h | 2 +- scst/src/scst_proc.c | 3 +- scst/src/scst_targ.c | 106 ++++++++++++++++++----------- 10 files changed, 162 insertions(+), 97 deletions(-) diff --git a/iscsi-scst/kernel/conn.c b/iscsi-scst/kernel/conn.c index 2b081a861..a4312fa1f 100644 --- a/iscsi-scst/kernel/conn.c +++ b/iscsi-scst/kernel/conn.c @@ -254,7 +254,7 @@ static void conn_rsp_timer_fn(unsigned long arg) PRINT_ERROR("Timeout sending data to initiator " "%s (SID %Lx), closing connection", conn->session->initiator_name, - conn->session->sid); + (long long unsigned int)conn->session->sid); mark_conn_closed(conn); } } else { @@ -281,13 +281,13 @@ static int iscsi_socket_bind(struct iscsi_conn *conn) mm_segment_t oldfs; struct iscsi_session *session = conn->session; - TRACE_DBG("%llu", session->sid); + TRACE_DBG("%llu", (long long unsigned int)session->sid); conn->sock = SOCKET_I(conn->file->f_dentry->d_inode); if (conn->sock->ops->sendpage == NULL) { PRINT_ERROR("Socket for sid %llu doesn't support sendpage()", - session->sid); + (long long unsigned int)session->sid); res = -EINVAL; goto out; } @@ -324,7 +324,9 @@ out: int conn_free(struct iscsi_conn *conn) { TRACE_MGMT_DBG("Freeing conn %p (sess=%p, %#Lx %u)", conn, - conn->session, conn->session->sid, conn->cid); + conn->session, + (long long unsigned int)conn->session->sid, + conn->cid); del_timer_sync(&conn->rsp_timer); @@ -359,7 +361,7 @@ static int iscsi_conn_alloc(struct iscsi_session *session, struct conn_info *inf } TRACE_MGMT_DBG("Creating connection %p for sid %#Lx, cid %u", conn, - session->sid, info->cid); + (long long unsigned int)session->sid, info->cid); /* Changing it, change ISCSI_CONN_IOV_MAX as well !! */ conn->read_iov = (struct iovec *)get_zeroed_page(GFP_KERNEL); diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index f64a409f8..b381bc616 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -1621,8 +1621,10 @@ static int cmnd_abort(struct iscsi_cmnd *req) if (req_hdr->lun != hdr->lun) { PRINT_ERROR("ABORT TASK: LUN mismatch: req LUN " - "%Lx, cmd LUN %Lx, rtt %u", req_hdr->lun, - hdr->lun, req_hdr->rtt); + "%Lx, cmd LUN %Lx, rtt %u", + (long long unsigned int)req_hdr->lun, + (long long unsigned int)hdr->lun, + req_hdr->rtt); err = ISCSI_RESPONSE_FUNCTION_REJECTED; goto out_put; } diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index d5df1ef6e..3a5e8e1e8 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -989,7 +989,8 @@ static int write_data(struct iscsi_conn *conn) res = vfs_writev(file, (struct iovec __user *)iop, count, &off); set_fs(oldfs); - TRACE_WRITE("%#Lx:%u: %d(%ld)", conn->session->sid, + TRACE_WRITE("%#Lx:%u: %d(%ld)", + (long long unsigned int)conn->session->sid, conn->cid, res, (long)iop->iov_len); if (unlikely(res <= 0)) { @@ -1089,7 +1090,8 @@ retry2: TRACE_WRITE("Final %s %#Lx:%u: %d(%lu,%u,%u, cmd %p, page %p)", (sendpage != sock_no_sendpage) ? "sendpage" : "sock_no_sendpage", - conn->session->sid, conn->cid, + (long long unsigned int)conn->session->sid, + conn->cid, res, sg_page(&sg[idx])->index, offset, size, write_cmnd, sg_page(&sg[idx])); if (unlikely(res <= 0)) { @@ -1168,7 +1170,8 @@ out_err: #endif { PRINT_ERROR("error %d at sid:cid %#Lx:%u, cmnd %p", res, - conn->session->sid, conn->cid, conn->write_cmnd); + (long long unsigned int)conn->session->sid, + conn->cid, conn->write_cmnd); } if (ref_cmd->scst_cmd != NULL) scst_set_delivery_status(ref_cmd->scst_cmd, diff --git a/iscsi-scst/kernel/session.c b/iscsi-scst/kernel/session.c index c97298fce..004874524 100644 --- a/iscsi-scst/kernel/session.c +++ b/iscsi-scst/kernel/session.c @@ -129,7 +129,8 @@ int session_free(struct iscsi_session *session) { int i; - TRACE_MGMT_DBG("Freeing session %p:%#Lx", session, session->sid); + TRACE_MGMT_DBG("Freeing session %p:%#Lx", + session, (long long unsigned int)session->sid); sBUG_ON(!list_empty(&session->conn_list)); if (unlikely(atomic_read(&session->active_cmds) != 0)) { @@ -162,7 +163,8 @@ int session_del(struct iscsi_target *target, u64 sid) return -ENOENT; if (!list_empty(&session->conn_list)) { - PRINT_ERROR("%llu still have connections", session->sid); + PRINT_ERROR("%llu still have connections", + (long long unsigned int)session->sid); return -EBUSY; } @@ -176,7 +178,8 @@ static void iscsi_session_info_show(struct seq_file *seq, struct iscsi_target *t list_for_each_entry(session, &target->session_list, session_list_entry) { seq_printf(seq, "\tsid:%llu initiator:%s shutting down %d\n", - session->sid, session->initiator_name, + (long long unsigned int)session->sid, + session->initiator_name, session->shutting_down); conn_info_show(seq, session); } diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 82891c9b3..114b91e75 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -1689,7 +1689,7 @@ static int dev_user_reply_get_cmd(struct file *file, unsigned long arg, if (res < 0) goto out_up; - TRACE_DBG("ureply %Ld", ureply); + TRACE_DBG("ureply %Ld", (long long unsigned int)ureply); cmd = kzalloc(max(sizeof(*cmd), sizeof(*reply)), GFP_KERNEL); if (cmd == NULL) { diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 6fc0bdf90..2712a636b 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -469,7 +469,7 @@ static int vdisk_attach(struct scst_device *dev) filp_close(fd, NULL); } virt_dev->file_size = err; - TRACE_DBG("size of file: %Ld", (uint64_t)err); + TRACE_DBG("size of file: %Ld", (long long unsigned int)err); } else virt_dev->file_size = 0; @@ -487,7 +487,8 @@ static int vdisk_attach(struct scst_device *dev) (dev->handler->type == TYPE_DISK) ? "disk" : "cdrom", virt_dev->name, virt_dev->file_name, virt_dev->file_size >> 20, virt_dev->block_size, - virt_dev->nblocks, virt_dev->nblocks/64/32, + (long long unsigned int)virt_dev->nblocks, + (long long unsigned int)virt_dev->nblocks/64/32, virt_dev->nblocks < 64*32 ? " !WARNING! cyln less than 1" : ""); } else { PRINT_INFO("Attached empty SCSI target virtual cdrom %s", @@ -771,12 +772,16 @@ static int vdisk_do_job(struct scst_cmd *cmd) loff = (loff_t)lba_start << virt_dev->block_shift; TRACE_DBG("cmd %p, lba_start %Ld, loff %Ld, data_len %Ld", cmd, - lba_start, (uint64_t)loff, (uint64_t)data_len); + (long long unsigned int)lba_start, + (long long unsigned int)loff, + (long long unsigned int)data_len); if (unlikely(loff < 0) || unlikely(data_len < 0) || unlikely((loff + data_len) > virt_dev->file_size)) { 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); + "(%lld of %lld, len %Ld)", + (long long unsigned int)loff, + (long long unsigned int)virt_dev->file_size, + (long long unsigned int)data_len); scst_set_cmd_error(cmd, SCST_LOAD_SENSE( scst_sense_block_out_range_error)); goto out_compl; @@ -789,8 +794,8 @@ static int vdisk_do_job(struct scst_cmd *cmd) fua = (cdb[1] & 0x8); if (fua) { TRACE(TRACE_ORDER, "FUA: loff=%Ld, " - "data_len=%Ld", (uint64_t)loff, - (uint64_t)data_len); + "data_len=%Ld", (long long unsigned int)loff, + (long long unsigned int)data_len); } break; } @@ -821,8 +826,8 @@ static int vdisk_do_job(struct scst_cmd *cmd) if (vdisk_need_pre_sync(cmd->queue_type, last_queue_type)) { TRACE(TRACE_ORDER, "ORDERED " "WRITE(%d): loff=%Ld, data_len=%Ld", - cmd->queue_type, (uint64_t)loff, - (uint64_t)data_len); + cmd->queue_type, (long long unsigned int)loff, + (long long unsigned int)data_len); do_fsync = 1; if (vdisk_fsync(thr, 0, 0, cmd) != 0) goto out_compl; @@ -856,8 +861,8 @@ static int vdisk_do_job(struct scst_cmd *cmd) if (vdisk_need_pre_sync(cmd->queue_type, last_queue_type)) { TRACE(TRACE_ORDER, "ORDERED " "WRITE_VERIFY(%d): loff=%Ld, data_len=%Ld", - cmd->queue_type, (uint64_t)loff, - (uint64_t)data_len); + cmd->queue_type, (long long unsigned int)loff, + (long long unsigned int)data_len); do_fsync = 1; if (vdisk_fsync(thr, 0, 0, cmd) != 0) goto out_compl; @@ -880,8 +885,8 @@ static int vdisk_do_job(struct scst_cmd *cmd) { int immed = cdb[1] & 0x2; TRACE(TRACE_ORDER, "SYNCHRONIZE_CACHE: " - "loff=%Ld, data_len=%Ld, immed=%d", (uint64_t)loff, - (uint64_t)data_len, immed); + "loff=%Ld, data_len=%Ld, immed=%d", (long long unsigned int)loff, + (long long unsigned int)data_len, immed); if (immed) { scst_cmd_get(cmd); cmd->completed = 1; @@ -2029,8 +2034,9 @@ static void vdisk_exec_read(struct scst_cmd *cmd, else err = default_llseek(fd, loff, 0/*SEEK_SET*/); if (err != loff) { - PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err, - (uint64_t)loff); + PRINT_ERROR("lseek trouble %Ld != %Ld", + (long long unsigned int)err, + (long long unsigned int)loff); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out_set_fs; } @@ -2043,8 +2049,9 @@ static void vdisk_exec_read(struct scst_cmd *cmd, } if ((err < 0) || (err < full_len)) { - PRINT_ERROR("readv() returned %Ld from %zd", (uint64_t)err, - full_len); + PRINT_ERROR("readv() returned %Ld from %zd", + (long long unsigned int)err, + full_len); if (err == -EAGAIN) scst_set_busy(cmd); else { @@ -2119,8 +2126,9 @@ restart: else err = default_llseek(fd, loff, 0 /*SEEK_SET */); if (err != loff) { - PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err, - (uint64_t)loff); + PRINT_ERROR("lseek trouble %Ld != %Ld", + (long long unsigned int)err, + (long long unsigned int)loff); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out_set_fs; @@ -2137,7 +2145,8 @@ restart: if (err < 0) { PRINT_ERROR("write() returned %Ld from %zd", - (uint64_t)err, full_len); + (long long unsigned int)err, + full_len); if (err == -EAGAIN) scst_set_busy(cmd); else { @@ -2410,8 +2419,9 @@ static void vdisk_exec_verify(struct scst_cmd *cmd, else err = default_llseek(fd, loff, 0/*SEEK_SET*/); if (err != loff) { - PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err, - (uint64_t)loff); + PRINT_ERROR("lseek trouble %Ld != %Ld", + (long long unsigned int)err, + (long long unsigned int)loff); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); goto out_set_fs; } @@ -2444,7 +2454,7 @@ static void vdisk_exec_verify(struct scst_cmd *cmd, err = len_mem; if ((err < 0) || (err < len_mem)) { PRINT_ERROR("verify() returned %Ld from %zd", - (uint64_t)err, len_mem); + (long long unsigned int)err, len_mem); if (err == -EAGAIN) scst_set_busy(cmd); else { @@ -3129,7 +3139,8 @@ static int vcdrom_change(char *p, char *name) "(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, - virt_dev->nblocks, virt_dev->nblocks/64/32, + (long long unsigned int)virt_dev->nblocks, + (long long unsigned int)virt_dev->nblocks/64/32, virt_dev->nblocks < 64*32 ? " !WARNING! cyln less " "than 1" : ""); } else { diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 147956cb2..07890c927 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -195,7 +195,9 @@ void scst_set_resp_data_len(struct scst_cmd *cmd, int resp_data_len) #ifdef DEBUG TRACE(TRACE_SG_OP|TRACE_MEMORY, "cmd %p (tag %llu), " "resp_data_len %d, i %d, cmd->sg[i].length %d, " - "left %d", cmd, cmd->tag, resp_data_len, i, + "left %d", + cmd, (long long unsigned int)cmd->tag, + resp_data_len, i, cmd->sg[i].length, left); #endif cmd->orig_sg_cnt = cmd->sg_cnt; @@ -453,10 +455,12 @@ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess, TRACE_MGMT_DBG("host=%d, channel=%d, id=%d, lun=%d, " "SCST lun=%Ld", dev->scsi_dev->host->host_no, dev->scsi_dev->channel, dev->scsi_dev->id, - dev->scsi_dev->lun, (uint64_t)tgt_dev->lun); + dev->scsi_dev->lun, + (long long unsigned int)tgt_dev->lun); } else { TRACE_MGMT_DBG("Virtual device %s on SCST lun=%Ld", - dev->virt_name, (uint64_t)tgt_dev->lun); + dev->virt_name, + (long long unsigned int)tgt_dev->lun); } spin_lock_init(&tgt_dev->tgt_dev_lock); @@ -723,12 +727,14 @@ out: if (dev->virt_name != NULL) { PRINT_INFO("Added device %s to group %s (LUN %Ld, " "rd_only %d)", dev->virt_name, acg->acg_name, - lun, read_only); + (long long unsigned int)lun, + read_only); } else { PRINT_INFO("Added device %d:%d:%d:%d to group %s (LUN " "%Ld, rd_only %d)", dev->scsi_dev->host->host_no, dev->scsi_dev->channel, dev->scsi_dev->id, - dev->scsi_dev->lun, acg->acg_name, lun, + dev->scsi_dev->lun, acg->acg_name, + (long long unsigned int)lun, read_only); } } @@ -1329,7 +1335,8 @@ void scst_free_cmd(struct scst_cmd *cmd) TRACE_ENTRY(); - TRACE_DBG("Freeing cmd %p (tag %Lu)", cmd, cmd->tag); + TRACE_DBG("Freeing cmd %p (tag %Lu)", + cmd, (long long unsigned int)cmd->tag); if (unlikely(test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags))) { TRACE_MGMT_DBG("Freeing aborted cmd %p (scst_cmd_count %d)", @@ -1339,12 +1346,14 @@ void scst_free_cmd(struct scst_cmd *cmd) sBUG_ON(cmd->inc_blocking || cmd->needs_unblocking || cmd->dec_on_dev_needed); -#if defined(EXTRACHECKS) && (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) +#if defined(EXTRACHECKS) if (cmd->scsi_req) { PRINT_ERROR("%s: %s", __func__, "Cmd with unfreed " "scsi_req!"); scst_release_request(cmd); } +#endif #endif scst_check_restore_sg_buff(cmd); @@ -1386,7 +1395,8 @@ void scst_free_cmd(struct scst_cmd *cmd) if (unlikely(!cmd->sent_to_midlev)) { 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, cmd->cdb[0], cmd->tgtt->name, + (long long unsigned int)cmd->lun, cmd->sn, cmd->tgt_dev->expected_sn); scst_unblock_deferred(cmd->tgt_dev, cmd); } @@ -1394,7 +1404,9 @@ void scst_free_cmd(struct scst_cmd *cmd) if (unlikely(cmd->out_of_sn)) { TRACE_SN("Out of SN cmd %p (tag %llu, sn %ld), " - "destroy=%d", cmd, cmd->tag, cmd->sn, destroy); + "destroy=%d", cmd, + (long long unsigned int)cmd->tag, + cmd->sn, destroy); destroy = test_and_set_bit(SCST_CMD_CAN_BE_DESTROYED, &cmd->cmd_flags); } @@ -2431,7 +2443,8 @@ void scst_process_reset(struct scst_device *dev, list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { TRACE(TRACE_MGMT, "Clearing RESERVE'ation for tgt_dev " - "lun %Ld", tgt_dev->lun); + "lun %Ld", + (long long unsigned int)tgt_dev->lun); clear_bit(SCST_TGT_DEV_RESERVED, &tgt_dev->tgt_dev_flags); } @@ -2660,7 +2673,7 @@ void scst_free_all_UA(struct scst_tgt_dev *tgt_dev) list_for_each_entry_safe(UA_entry, t, &tgt_dev->UA_list, UA_list_entry) { TRACE_MGMT_DBG("Clearing UA for tgt_dev lun %Ld", - tgt_dev->lun); + (long long unsigned int)tgt_dev->lun); list_del(&UA_entry->UA_list_entry); kfree(UA_entry); } @@ -2720,7 +2733,9 @@ restart: * !! already destroyed !! */ TRACE_SN("cmd %p (tag %llu) with skipped sn %ld found", - cmd, cmd->tag, cmd->sn); + cmd, + (long long unsigned int)cmd->tag, + cmd->sn); tgt_dev->def_cmd_count--; list_del(&cmd->sn_cmd_list_entry); spin_unlock_irq(&tgt_dev->sn_lock); @@ -2833,7 +2848,8 @@ void scst_block_dev_cmd(struct scst_cmd *cmd, int outstanding) sBUG_ON(cmd->needs_unblocking); cmd->needs_unblocking = 1; - TRACE_MGMT_DBG("Needs unblocking cmd %p (tag %llu)", cmd, cmd->tag); + TRACE_MGMT_DBG("Needs unblocking cmd %p (tag %llu)", + cmd, (long long unsigned int)cmd->tag); scst_block_dev(cmd->dev, outstanding); } @@ -2899,7 +2915,7 @@ repeat: scst_dec_on_dev_cmd(cmd); TRACE_MGMT_DBG("Delaying cmd %p due to blocking or " "serializing (tag %llu, dev %p)", cmd, - cmd->tag, dev); + (long long unsigned int)cmd->tag, dev); list_add_tail(&cmd->blocked_cmd_list_entry, &dev->blocked_cmd_list); res = 1; @@ -2917,7 +2933,7 @@ repeat: if (dev->block_count == 0) { TRACE_MGMT_DBG("cmd %p (tag %llu), blocking further " "cmds due to serializing (dev %p)", cmd, - cmd->tag, dev); + (long long unsigned int)cmd->tag, dev); __scst_block_dev(dev); cmd->inc_blocking = 1; } else { @@ -3095,12 +3111,13 @@ void scst_xmit_process_aborted_cmd(struct scst_cmd *cmd) if (cmd->dev->tas) { TRACE_MGMT_DBG("Flag ABORTED OTHER set for cmd %p " "(tag %llu), returning TASK ABORTED ", cmd, - cmd->tag); + (long long unsigned int)cmd->tag); scst_set_cmd_error_status(cmd, SAM_STAT_TASK_ABORTED); } else { TRACE_MGMT_DBG("Flag ABORTED OTHER set for cmd %p " "(tag %llu), aborting without delivery or " - "notification", cmd, cmd->tag); + "notification", + cmd, (long long unsigned int)cmd->tag); /* * There is no need to check/requeue possible UA, * because, if it exists, it will be delivered diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 253e82586..3ea00517b 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -456,7 +456,7 @@ static inline int scst_pre_dec_on_dev_cmd(struct scst_cmd *cmd) int cmd_blocking = cmd->inc_blocking; if (cmd_blocking) { TRACE_MGMT_DBG("cmd %p (tag %llu): unblocking dev %p", cmd, - cmd->tag, cmd->dev); + (long long unsigned int)cmd->tag, cmd->dev); cmd->inc_blocking = 0; } cmd->dec_on_dev_needed = 0; diff --git a/scst/src/scst_proc.c b/scst/src/scst_proc.c index e66c40807..4d07ac172 100644 --- a/scst/src/scst_proc.c +++ b/scst/src/scst_proc.c @@ -1912,7 +1912,8 @@ static int scst_groups_devices_show(struct seq_file *seq, void *v) acg_dev->rd_only_flag ? "RO" : ""); } else { seq_printf(seq, "%-60s%4Ld%12s\n", - acg_dev->dev->virt_name, acg_dev->lun, + acg_dev->dev->virt_name, + (long long unsigned int)acg_dev->lun, acg_dev->rd_only_flag ? "RO" : ""); } } diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 186dbf017..785a18fef 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -194,8 +194,10 @@ void scst_cmd_init_done(struct scst_cmd *cmd, int pref_context) #endif TRACE_DBG("Preferred context: %d (cmd %p)", pref_context, cmd); - TRACE(TRACE_SCSI, "tag=%llu, lun=%Ld, CDB len=%d", cmd->tag, - (uint64_t)cmd->lun, cmd->cdb_len); + TRACE(TRACE_SCSI, "tag=%llu, lun=%Ld, CDB len=%d", + (long long unsigned int)cmd->tag, + (long long unsigned int)cmd->lun, + cmd->cdb_len); PRINT_BUFF_FLAG(TRACE_SCSI|TRACE_RCV_BOT, "Recieving CDB", cmd->cdb, cmd->cdb_len); @@ -718,7 +720,9 @@ void scst_restart_cmd(struct scst_cmd *cmd, int status, int pref_context) TRACE_ENTRY(); TRACE_DBG("Preferred context: %d", pref_context); - TRACE_DBG("tag=%llu, status=%#x", scst_cmd_get_tag(cmd), status); + TRACE_DBG("tag=%llu, status=%#x", + (long long unsigned int)scst_cmd_get_tag(cmd), + status); #ifdef EXTRACHECKS if (in_irq() && ((pref_context == SCST_CONTEXT_DIRECT) || @@ -957,7 +961,9 @@ void scst_rx_data(struct scst_cmd *cmd, int status, int pref_context) TRACE_ENTRY(); TRACE_DBG("Preferred context: %d", pref_context); - TRACE(TRACE_SCSI, "tag=%llu status=%#x", scst_cmd_get_tag(cmd), status); + TRACE(TRACE_SCSI, "tag=%llu status=%#x", + (long long unsigned int)scst_cmd_get_tag(cmd), + status); #ifdef EXTRACHECKS if (in_irq() && ((pref_context == SCST_CONTEXT_DIRECT) || @@ -1402,7 +1408,7 @@ static int scst_reserve_local(struct scst_cmd *cmd) if ((cmd->cdb[0] == RESERVE_10) && (cmd->cdb[2] & SCST_RES_3RDPTY)) { PRINT_ERROR("RESERVE_10: 3rdPty RESERVE not implemented " - "(lun=%Ld)", (uint64_t)cmd->lun); + "(lun=%Ld)", (long long unsigned int)cmd->lun); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); goto out_done; @@ -1726,7 +1732,7 @@ static int scst_do_send_to_midlev(struct scst_cmd *cmd) if (unlikely(dev->scsi_dev == NULL)) { PRINT_ERROR("Command for virtual device must be " "processed by device handler (lun %Ld)!", - (uint64_t)cmd->lun); + (long long unsigned int)cmd->lun); goto out_error; } @@ -1935,7 +1941,8 @@ static int scst_send_to_midlev(struct scst_cmd **active_cmd) if (unlikely(test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags))) { /* Necessary to allow aborting out of sn cmds */ TRACE_MGMT_DBG("Aborting out of sn cmd %p (tag %llu)", - cmd, cmd->tag); + cmd, + (long long unsigned)cmd->tag); tgt_dev->def_cmd_count--; cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; res = SCST_CMD_STATE_RES_CONT_SAME; @@ -2059,7 +2066,8 @@ static int scst_check_sense(struct scst_cmd *cmd) "Double UA detected"); /* Do retry */ TRACE(TRACE_MGMT_MINOR, "Retrying cmd %p " - "(tag %llu)", cmd, cmd->tag); + "(tag %llu)", cmd, + (long long unsigned)cmd->tag); cmd->status = 0; cmd->msg_status = 0; cmd->host_status = DID_OK; @@ -2214,7 +2222,8 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) if (buffer[SCST_INQ_BYTE3] & SCST_INQ_NORMACA_BIT) { PRINT_INFO("NormACA set for device: " "lun=%Ld, type 0x%02x", - (uint64_t)cmd->lun, buffer[0]); + (long long unsigned int)cmd->lun, + buffer[0]); } #endif buffer[SCST_INQ_BYTE3] &= ~SCST_INQ_NORMACA_BIT; @@ -2232,7 +2241,7 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) (cmd->cdb[0] == MODE_SELECT_10) || (cmd->cdb[0] == LOG_SELECT))) { TRACE(TRACE_SCSI, "MODE/LOG SELECT succeeded (LUN %Ld)", - (uint64_t)cmd->lun); + (long long unsigned int)cmd->lun); cmd->state = SCST_CMD_STATE_MODE_SELECT_CHECKS; *pres = SCST_CMD_STATE_RES_CONT_SAME; res = 1; @@ -2246,7 +2255,9 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) struct scst_device *dev = cmd->dev; TRACE(TRACE_SCSI, "Real RESERVE failed lun=%Ld, " - "status=%x", (uint64_t)cmd->lun, cmd->status); + "status=%x", + (long long unsigned int)cmd->lun, + cmd->status); PRINT_BUFF_FLAG(TRACE_SCSI, "Sense", cmd->sense, SCST_SENSE_BUFFERSIZE); @@ -2268,8 +2279,9 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) SCST_SENSE_VALID(cmd->sense) && scst_is_ua_sense(cmd->sense) && (cmd->sense[12] == 0x2a) && (cmd->sense[13] == 0x01)) { - TRACE(TRACE_SCSI, "MODE PARAMETERS CHANGED UA (lun %Ld)", - (uint64_t)cmd->lun); + TRACE(TRACE_SCSI, + "MODE PARAMETERS CHANGED UA (lun %Ld)", + (long long unsigned int)cmd->lun); cmd->state = SCST_CMD_STATE_MODE_SELECT_CHECKS; *pres = SCST_CMD_STATE_RES_CONT_SAME; res = 1; @@ -2320,7 +2332,7 @@ static int scst_mode_select_checks(struct scst_cmd *cmd) TRACE(TRACE_SCSI, "MODE/LOG SELECT succeeded, " "setting the SELECT UA (lun=%Ld)", - (uint64_t)cmd->lun); + (long long unsigned int)cmd->lun); spin_lock_bh(&dev->dev_lock); spin_lock(&scst_temp_UA_lock); @@ -2357,7 +2369,7 @@ static int scst_mode_select_checks(struct scst_cmd *cmd) TRACE(TRACE_SCSI, "Possible parameters changed UA %x " "(lun %Ld): getting new parameters", cmd->sense[12], - (uint64_t)cmd->lun); + (long long unsigned int)cmd->lun); scst_obtain_device_parameters(cmd->dev); } else @@ -2508,7 +2520,7 @@ static int scst_pre_xmit_response(struct scst_cmd *cmd) if (unlikely(test_bit(SCST_CMD_NO_RESP, &cmd->cmd_flags))) { TRACE_MGMT_DBG("Flag NO_RESP set for cmd %p (tag %llu), skipping", - cmd, cmd->tag); + cmd, (long long unsigned int)cmd->tag); cmd->state = SCST_CMD_STATE_FINISHED; res = SCST_CMD_STATE_RES_CONT_SAME; goto out; @@ -2827,7 +2839,7 @@ static int scst_translate_lun(struct scst_cmd *cmd) struct list_head *sess_tgt_dev_list_head = &cmd->sess->sess_tgt_dev_list_hash[HASH_VAL(cmd->lun)]; TRACE_DBG("Finding tgt_dev for cmd %p (lun %Ld)", cmd, - (uint64_t)cmd->lun); + (long long unsigned int)cmd->lun); res = -1; list_for_each_entry(tgt_dev, sess_tgt_dev_list_head, sess_tgt_dev_list_entry) { @@ -2837,7 +2849,8 @@ static int scst_translate_lun(struct scst_cmd *cmd) if (unlikely(tgt_dev->dev->handler == &scst_null_devtype)) { PRINT_INFO("Dev handler for device " "%Ld is NULL, the device will not be " - "visible remotely", (uint64_t)cmd->lun); + "visible remotely", + (long long unsigned int)cmd->lun); break; } @@ -2851,7 +2864,7 @@ static int scst_translate_lun(struct scst_cmd *cmd) } if (res != 0) { TRACE(TRACE_MINOR, "tgt_dev for lun %Ld not found, command to " - "unexisting LU?", (uint64_t)cmd->lun); + "unexisting LU?", (long long unsigned int)cmd->lun); __scst_put(); } } else { @@ -2962,7 +2975,7 @@ restart: } } else { TRACE_MGMT_DBG("Aborting not inited cmd %p (tag %llu)", - cmd, cmd->tag); + cmd, (long long unsigned int)cmd->tag); cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP; } @@ -3106,7 +3119,7 @@ void scst_process_active_cmd(struct scst_cmd *cmd, int context) res = SCST_CMD_STATE_RES_CONT_NEXT; TRACE_MGMT_DBG("Skipping cmd %p (tag %llu), " "because of TM DBG delay", cmd, - cmd->tag); + (long long unsigned int)cmd->tag); break; } res = scst_send_to_midlev(&cmd); @@ -3325,7 +3338,7 @@ static int scst_mgmt_translate_lun(struct scst_mgmt_cmd *mcmd) TRACE_ENTRY(); TRACE_DBG("Finding tgt_dev for mgmt cmd %p (lun %Ld)", mcmd, - (uint64_t)mcmd->lun); + (long long unsigned int)mcmd->lun); __scst_get(1); @@ -3365,7 +3378,8 @@ void scst_done_cmd_mgmt(struct scst_cmd *cmd) TRACE_ENTRY(); - TRACE_MGMT_DBG("cmd %p done (tag %llu)", cmd, cmd->tag); + TRACE_MGMT_DBG("cmd %p done (tag %llu)", + cmd, (long long unsigned int)cmd->tag); spin_lock_irqsave(&scst_mcmd_lock, flags); @@ -3413,7 +3427,8 @@ static void scst_finish_cmd_mgmt(struct scst_cmd *cmd) TRACE_ENTRY(); - TRACE_MGMT_DBG("cmd %p finished (tag %llu)", cmd, cmd->tag); + TRACE_MGMT_DBG("cmd %p finished (tag %llu)", + cmd, (long long unsigned int)cmd->tag); spin_lock_irqsave(&scst_mcmd_lock, flags); @@ -3504,7 +3519,8 @@ void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd, TRACE_ENTRY(); TRACE(((mcmd != NULL) && (mcmd->fn == SCST_ABORT_TASK)) ? TRACE_MGMT_MINOR : TRACE_MGMT, - "Aborting cmd %p (tag %llu, op %x)", cmd, cmd->tag, cmd->cdb[0]); + "Aborting cmd %p (tag %llu, op %x)", + cmd, (long long unsigned int)cmd->tag, cmd->cdb[0]); /* To protect from concurrent aborts */ spin_lock_irqsave(&other_ini_lock, flags); @@ -3573,14 +3589,14 @@ void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd, */ TRACE_MGMT_DBG("cmd %p (tag %llu) being executed/xmitted " "(state %d, proc time %ld sec.), deferring ABORT...", - cmd, cmd->tag, cmd->state, + cmd, (long long unsigned int)cmd->tag, cmd->state, (long)(jiffies - cmd->start_time)/HZ); mcmd->cmd_finish_wait_count++; if (!cmd->done) { TRACE_MGMT_DBG("cmd %p (tag %llu) not done yet", - cmd, cmd->tag); + cmd, (long long unsigned int)cmd->tag); mcmd->cmd_done_wait_count++; } } @@ -3732,7 +3748,7 @@ static int scst_abort_task_set(struct scst_mgmt_cmd *mcmd) struct scst_device *dev = tgt_dev->dev; TRACE(TRACE_MGMT, "Aborting task set (lun=%Ld, mcmd=%p)", - tgt_dev->lun, mcmd); + (long long unsigned int)tgt_dev->lun, mcmd); mcmd->needs_unblocking = 1; @@ -3762,7 +3778,7 @@ static int scst_is_cmd_belongs_to_dev(struct scst_cmd *cmd, TRACE_ENTRY(); TRACE_DBG("Finding match for dev %p and cmd %p (lun %Ld)", dev, cmd, - (uint64_t)cmd->lun); + (long long unsigned int)cmd->lun); sess_tgt_dev_list_head = &cmd->sess->sess_tgt_dev_list_hash[HASH_VAL(cmd->lun)]; @@ -3791,7 +3807,7 @@ static int scst_clear_task_set(struct scst_mgmt_cmd *mcmd) TRACE_ENTRY(); TRACE(TRACE_MGMT, "Clearing task set (lun=%Ld, mcmd=%p)", - (uint64_t)mcmd->lun, mcmd); + (long long unsigned int)mcmd->lun, mcmd); mcmd->needs_unblocking = 1; @@ -3873,7 +3889,8 @@ static int scst_mgmt_cmd_init(struct scst_mgmt_cmd *mcmd) cmd = __scst_find_cmd_by_tag(sess, mcmd->tag); if (cmd == NULL) { TRACE(TRACE_MGMT_MINOR, "ABORT TASK failed: command " - "for tag %llu not found", mcmd->tag); + "for tag %llu not found", + (long long unsigned int)mcmd->tag); mcmd->status = SCST_MGMT_STATUS_TASK_NOT_EXIST; mcmd->state = SCST_MGMT_CMD_STATE_DONE; spin_unlock_irq(&sess->sess_list_lock); @@ -3882,20 +3899,23 @@ static int scst_mgmt_cmd_init(struct scst_mgmt_cmd *mcmd) __scst_cmd_get(cmd); spin_unlock_irq(&sess->sess_list_lock); TRACE_MGMT_DBG("Cmd %p for tag %llu (sn %ld, set %d, " - "queue_type %x) found, aborting it", cmd, mcmd->tag, + "queue_type %x) found, aborting it", + cmd, (long long unsigned int)mcmd->tag, cmd->sn, cmd->sn_set, cmd->queue_type); mcmd->cmd_to_abort = cmd; if (mcmd->lun_set && (mcmd->lun != cmd->lun)) { PRINT_ERROR("ABORT TASK: LUN mismatch: mcmd LUN %Lx, " - "cmd LUN %Lx, cmd tag %Lu", mcmd->lun, cmd->lun, - mcmd->tag); + "cmd LUN %Lx, cmd tag %Lu", + (long long unsigned int)mcmd->lun, + (long long unsigned int)cmd->lun, + (long long unsigned int)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("ABORT TASK: SN mismatch: mcmd SN %x, " "cmd SN %x, cmd tag %Lu", mcmd->cmd_sn, - cmd->tgt_sn, mcmd->tag); + cmd->tgt_sn, (long long unsigned int)mcmd->tag); mcmd->status = SCST_MGMT_STATUS_REJECTED; } else { scst_abort_cmd(cmd, mcmd, 0, 1); @@ -3922,7 +3942,8 @@ static int scst_mgmt_cmd_init(struct scst_mgmt_cmd *mcmd) rc = scst_mgmt_translate_lun(mcmd); if (rc < 0) { PRINT_ERROR("Corresponding device for lun %Ld not " - "found", (uint64_t)mcmd->lun); + "found", + (long long unsigned int)mcmd->lun); mcmd->status = SCST_MGMT_STATUS_LUN_NOT_EXIST; mcmd->state = SCST_MGMT_CMD_STATE_DONE; } else if (rc != 0) @@ -4047,7 +4068,8 @@ static int scst_lun_reset(struct scst_mgmt_cmd *mcmd) TRACE_ENTRY(); - TRACE(TRACE_MGMT, "Resetting lun %Ld (mcmd %p)", tgt_dev->lun, mcmd); + TRACE(TRACE_MGMT, "Resetting lun %Ld (mcmd %p)", + (long long unsigned int)tgt_dev->lun, mcmd); mcmd->needs_unblocking = 1; @@ -4712,8 +4734,12 @@ int scst_rx_mgmt_fn(struct scst_session *sess, TRACE_MGMT_DBG("sess=%p, tag_set %d, tag %Ld, lun_set %d, " "lun=%Ld, cmd_sn_set %d, cmd_sn %d, priv %p", sess, - params->tag_set, params->tag, params->lun_set, - (uint64_t)mcmd->lun, params->cmd_sn_set, params->cmd_sn, + params->tag_set, + (long long unsigned int)params->tag, + params->lun_set, + (long long unsigned int)mcmd->lun, + params->cmd_sn_set, + params->cmd_sn, params->tgt_priv); if (scst_post_rx_mgmt_cmd(sess, mcmd) != 0) @@ -5128,7 +5154,7 @@ struct scst_cmd *__scst_find_cmd_by_tag(struct scst_session *sess, uint64_t tag) /* ToDo: hash list */ TRACE_DBG("%s (sess=%p, tag=%llu)", "Searching in search cmd list", - sess, tag); + sess, (long long unsigned int)tag); list_for_each_entry(cmd, &sess->search_cmd_list, search_cmd_list_entry) { if (cmd->tag == tag)