From 1213800b2fc5402ecb9402ae3638ad9b7ec5186a Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Mon, 19 May 2008 10:21:41 +0000 Subject: [PATCH] Patch from Bart Van Assche , except few chuncks from qla2x00t/ obviously not related to the target mode addon: One of the Linux kernel patch submission requirements is that source files do not contain trailing whitespace. The patch below removes trailing whitespace from .c and .h source files. Note: it might be more convenient to run the script I used to generate this patch than to review and apply the patch below. This is how I generated and verified the patch below: cat <./strip-trailing-whitespace #!/bin/bash trap "rm -f $t" EXIT t=/tmp/temporary-file.$$ for f in "$@" do sed 's/[ ]*$//' <"$f" >"$t" && mv "$t" "$f" done EOF chmod a+x ./strip-trailing-whitespace find -name '*.[ch]' | xargs ./strip-trailing-whitespace svn diff -x -w Signed-off-by: git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@377 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/include/iscsi_scst.h | 4 +- iscsi-scst/include/iscsi_scst_ver.h | 4 +- iscsi-scst/kernel/config.c | 6 +- iscsi-scst/kernel/conn.c | 4 +- iscsi-scst/kernel/digest.c | 8 +- iscsi-scst/kernel/digest.h | 4 +- iscsi-scst/kernel/event.c | 4 +- iscsi-scst/kernel/iscsi.c | 30 +- iscsi-scst/kernel/iscsi.h | 14 +- iscsi-scst/kernel/iscsi_dbg.h | 4 +- iscsi-scst/kernel/iscsi_hdr.h | 4 +- iscsi-scst/kernel/nthread.c | 16 +- iscsi-scst/kernel/param.c | 4 +- iscsi-scst/kernel/session.c | 4 +- iscsi-scst/kernel/target.c | 4 +- iscsi-scst/usr/chap.c | 2 +- iscsi-scst/usr/config.h | 4 +- iscsi-scst/usr/conn.c | 4 +- iscsi-scst/usr/ctldev.c | 8 +- iscsi-scst/usr/event.c | 4 +- iscsi-scst/usr/iscsi_adm.c | 6 +- iscsi-scst/usr/iscsi_adm.h | 4 +- iscsi-scst/usr/iscsi_hdr.h | 4 +- iscsi-scst/usr/iscsi_scstd.c | 18 +- iscsi-scst/usr/iscsid.c | 6 +- iscsi-scst/usr/iscsid.h | 4 +- iscsi-scst/usr/log.c | 4 +- iscsi-scst/usr/message.c | 4 +- iscsi-scst/usr/misc.h | 4 +- iscsi-scst/usr/param.c | 4 +- iscsi-scst/usr/param.h | 4 +- iscsi-scst/usr/plain.c | 4 +- iscsi-scst/usr/session.c | 4 +- iscsi-scst/usr/target.c | 4 +- iscsi-scst/usr/types.h | 4 +- mpt/mpt_scst.c | 378 +++++++++++----------- mpt/mpt_scst.h | 8 +- qla2x00t/qla2x00-target/qla2x00t.c | 212 ++++++------- qla2x00t/qla2x00-target/qla2x00t.h | 14 +- qla2x00t/qla2x_tgt.h | 10 +- qla2x00t/qla2x_tgt_def.h | 18 +- qla2x00t/qla_attr.c | 66 ++-- qla2x00t/qla_dbg.c | 4 +- qla2x00t/qla_init.c | 36 +-- qla2x00t/qla_isr.c | 24 +- qla2x00t/qla_os.c | 4 +- qla_isp/common/isp.c | 64 ++-- qla_isp/common/isp_library.c | 24 +- qla_isp/common/isp_library.h | 22 +- qla_isp/common/isp_stds.h | 22 +- qla_isp/common/isp_target.c | 26 +- qla_isp/common/isp_target.h | 22 +- qla_isp/common/isp_tpublic.h | 24 +- qla_isp/common/ispmbox.h | 40 +-- qla_isp/common/ispreg.h | 26 +- qla_isp/common/ispvar.h | 28 +- qla_isp/firmware/asm_1000.h | 2 +- qla_isp/firmware/asm_1040.h | 2 +- qla_isp/firmware/asm_1080.h | 2 +- qla_isp/firmware/asm_12160.h | 2 +- qla_isp/firmware/asm_2100.h | 2 +- qla_isp/firmware/asm_2200.h | 2 +- qla_isp/firmware/asm_2300.h | 2 +- qla_isp/firmware/asm_2322.h | 2 +- qla_isp/firmware/asm_2400.h | 2 +- qla_isp/linux/exioct.h | 76 ++--- qla_isp/linux/exioctln.h | 26 +- qla_isp/linux/isp_cb_ops.c | 30 +- qla_isp/linux/isp_ioctl.h | 22 +- qla_isp/linux/isp_linux.c | 38 +-- qla_isp/linux/isp_linux.h | 28 +- qla_isp/linux/isp_pci.c | 42 +-- qla_isp/linux/scsi_target.c | 32 +- qla_isp/linux/scsi_target.h | 22 +- qla_isp/linux/scsi_target_ctl.c | 24 +- scst/include/scst.h | 382 +++++++++++------------ scst/include/scst_const.h | 26 +- scst/include/scst_debug.h | 8 +- scst/include/scst_user.h | 14 +- scst/src/dev_handlers/scst_cdrom.c | 30 +- scst/src/dev_handlers/scst_changer.c | 26 +- scst/src/dev_handlers/scst_dev_handler.h | 2 +- scst/src/dev_handlers/scst_disk.c | 34 +- scst/src/dev_handlers/scst_modisk.c | 38 +-- scst/src/dev_handlers/scst_processor.c | 24 +- scst/src/dev_handlers/scst_raid.c | 24 +- scst/src/dev_handlers/scst_tape.c | 44 +-- scst/src/dev_handlers/scst_user.c | 46 +-- scst/src/dev_handlers/scst_vdisk.c | 160 +++++----- scst/src/scst_cdbprobe.h | 10 +- scst/src/scst_debug.c | 10 +- scst/src/scst_lib.c | 162 +++++----- scst/src/scst_main.c | 78 ++--- scst/src/scst_mem.c | 84 ++--- scst/src/scst_mem.h | 26 +- scst/src/scst_module.c | 10 +- scst/src/scst_priv.h | 32 +- scst/src/scst_proc.c | 28 +- scst/src/scst_targ.c | 198 ++++++------ srpt/src/ib_srpt.c | 6 +- usr/fileio/common.c | 32 +- usr/fileio/common.h | 6 +- usr/fileio/debug.c | 10 +- usr/fileio/debug.h | 8 +- usr/fileio/fileio.c | 10 +- 105 files changed, 1606 insertions(+), 1606 deletions(-) diff --git a/iscsi-scst/include/iscsi_scst.h b/iscsi-scst/include/iscsi_scst.h index 4a1c9a7a9..cbf374d93 100644 --- a/iscsi-scst/include/iscsi_scst.h +++ b/iscsi-scst/include/iscsi_scst.h @@ -1,12 +1,12 @@ /* * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/include/iscsi_scst_ver.h b/iscsi-scst/include/iscsi_scst_ver.h index dc90abb9f..cba6dcaf4 100644 --- a/iscsi-scst/include/iscsi_scst_ver.h +++ b/iscsi-scst/include/iscsi_scst_ver.h @@ -1,12 +1,12 @@ /* * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/kernel/config.c b/iscsi-scst/kernel/config.c index 29001383a..0c933d2e8 100644 --- a/iscsi-scst/kernel/config.c +++ b/iscsi-scst/kernel/config.c @@ -2,11 +2,11 @@ * Copyright (C) 2004 - 2005 FUJITA Tomonori * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -505,7 +505,7 @@ void iscsi_dump_iov(struct msghdr *msg) if (trace_flag & TRACE_D_IOV) { int i; printk("%p, %zd\n", msg->msg_iov, msg->msg_iovlen); - for (i = 0; i < min_t(size_t, msg->msg_iovlen, + for (i = 0; i < min_t(size_t, msg->msg_iovlen, ISCSI_CONN_IOV_MAX); i++) { printk("%d: %p,%zd\n", i, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len); diff --git a/iscsi-scst/kernel/conn.c b/iscsi-scst/kernel/conn.c index 6e3f1e774..c9f719712 100644 --- a/iscsi-scst/kernel/conn.c +++ b/iscsi-scst/kernel/conn.c @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/kernel/digest.c b/iscsi-scst/kernel/digest.c index fea0dd523..84b981d46 100644 --- a/iscsi-scst/kernel/digest.c +++ b/iscsi-scst/kernel/digest.c @@ -4,11 +4,11 @@ * Copyright (C) 2004 - 2006 Xiranet Communications GmbH * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -117,7 +117,7 @@ static u32 digest_data(struct iscsi_cmnd *cmd, u32 osize, u32 offset) offset += sg[0].offset; idx = offset >> PAGE_SHIFT; offset &= ~PAGE_MASK; - + count = get_pgcnt(size, offset); TRACE_DBG("req %p, idx %d, count %d, sg_cnt %d, size %d, " @@ -209,7 +209,7 @@ void digest_tx_data(struct iscsi_cmnd *cmnd) offset = 0; } - /* + /* * cmnd is used here regardless of its sg comes from parent or was * allocated for this cmnd only, see cmnd_send_pdu() */ diff --git a/iscsi-scst/kernel/digest.h b/iscsi-scst/kernel/digest.h index 82da3a32f..935a88890 100644 --- a/iscsi-scst/kernel/digest.h +++ b/iscsi-scst/kernel/digest.h @@ -4,11 +4,11 @@ * Copyright (C) 2004 Xiranet Communications GmbH * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/kernel/event.c b/iscsi-scst/kernel/event.c index 480bc9c4d..b77b96fb9 100644 --- a/iscsi-scst/kernel/event.c +++ b/iscsi-scst/kernel/event.c @@ -4,11 +4,11 @@ * Copyright (C) 2005 FUJITA Tomonori * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 72bf9a3f5..4a59dc885 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -148,7 +148,7 @@ struct iscsi_cmnd *cmnd_alloc(struct iscsi_conn *conn, struct iscsi_cmnd *parent #ifdef NET_PAGE_CALLBACKS_DEFINED atomic_set(&cmnd->net_ref_cnt, 0); -#endif +#endif spin_lock_init(&cmnd->rsp_cmd_lock); INIT_LIST_HEAD(&cmnd->rsp_cmd_list); INIT_LIST_HEAD(&cmnd->rx_ddigest_cmd_list); @@ -382,7 +382,7 @@ again_rsp: /* * Corresponding conn may also gets destroyed atfer this function, except only - * if it's called from the read thread! + * if it's called from the read thread! */ void req_cmnd_release(struct iscsi_cmnd *req) { @@ -437,7 +437,7 @@ void req_cmnd_release(struct iscsi_cmnd *req) /* * Corresponding conn may also gets destroyed atfer this function, except only - * if it's called from the read thread! + * if it's called from the read thread! */ void rsp_cmnd_release(struct iscsi_cmnd *cmnd) { @@ -458,7 +458,7 @@ void rsp_cmnd_release(struct iscsi_cmnd *cmnd) /** * create a new command used as response. * - * iscsi_cmnd_create_rsp_cmnd - + * iscsi_cmnd_create_rsp_cmnd - * @cmnd: ptr to request command * * @return ptr to response command or NULL @@ -494,7 +494,7 @@ static inline struct iscsi_cmnd *get_rsp_cmnd(struct iscsi_cmnd *req) static void iscsi_cmnds_init_write(struct list_head *send, int flags) { - struct iscsi_cmnd *rsp = list_entry(send->next, struct iscsi_cmnd, + struct iscsi_cmnd *rsp = list_entry(send->next, struct iscsi_cmnd, write_list_entry); struct iscsi_conn *conn = rsp->conn; struct list_head *pos, *next; @@ -572,7 +572,7 @@ static void iscsi_set_datasize(struct iscsi_cmnd *cmnd, u32 offset, u32 size) u8 *p = (u8*)page_address(sg_page(&cmnd->sg[idx])) + (last_off & ~PAGE_MASK); int i = 4 - (size & 3); - while(i--) + while(i--) *p++ = 0; } } @@ -679,7 +679,7 @@ static struct iscsi_cmnd *create_status_rsp(struct iscsi_cmnd *req, int status, if (rsp->bufflen - rsp->pdu.datasize) { int i = rsp->pdu.datasize; u8 *p = (u8 *)sense + i; - + while (i < rsp->bufflen) { *p ++ = 0; i++; @@ -747,7 +747,7 @@ static void iscsi_cmnd_reject(struct iscsi_cmnd *req, int reason) static inline int iscsi_get_allowed_cmds(struct iscsi_session *sess) { - int res = max(-1, (int)sess->max_queued_cmnds - + int res = max(-1, (int)sess->max_queued_cmnds - atomic_read(&sess->active_cmds)-1); TRACE_DBG("allowed cmds %d (sess %p, active_cmds %d)", res, sess, atomic_read(&sess->active_cmds)); @@ -1165,7 +1165,7 @@ static int iscsi_pre_exec(struct scst_cmd *scst_cmd) SCST_LOAD_SENSE(iscsi_sense_crc_error)); res = SCST_PREPROCESS_STATUS_ERROR_SENSE_SET; /* - * The rest of rx_ddigest_cmd_list will be freed + * The rest of rx_ddigest_cmd_list will be freed * in req_cmnd_release() */ goto out; @@ -1562,7 +1562,7 @@ static void __cmnd_abort(struct iscsi_cmnd *cmnd) /* * Here, if cmnd is data_waiting, we should iscsi_fail_waiting_cmnd() * it. But, since this function can be called from any thread, not only - * from the read one, we at the moment can't do that, because of + * from the read one, we at the moment can't do that, because of * absence of appropriate locking protection. But this isn't a stuff * for 0.9.6. So, currently a misbehaving initiator, not sending * data in R2T state for a sharing between targets device, for which @@ -2479,7 +2479,7 @@ static void iscsi_preprocessing_done(struct scst_cmd *scst_cmd) return; } -/* +/* * No locks. * * IMPORTANT! Connection conn must be protected by additional conn_get() @@ -2611,7 +2611,7 @@ static int iscsi_xmit_response(struct scst_cmd *scst_cmd) } if (req->bufflen != 0) { - /* + /* * Check above makes sure that is_send_status is set, * so status is valid here, but in future that could change. * ToDo @@ -2967,7 +2967,7 @@ out_reg: out_callb: #ifdef NET_PAGE_CALLBACKS_DEFINED net_set_get_put_page_callbacks(NULL, NULL); -#endif +#endif goto out; } diff --git a/iscsi-scst/kernel/iscsi.h b/iscsi-scst/kernel/iscsi.h index cb3c039d1..cd374fd31 100644 --- a/iscsi-scst/kernel/iscsi.h +++ b/iscsi-scst/kernel/iscsi.h @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -124,7 +124,7 @@ struct iscsi_session { #define ISCSI_CONN_IOV_MAX (PAGE_SIZE/sizeof(struct iovec)) #define ISCSI_CONN_RD_STATE_IDLE 0 -#define ISCSI_CONN_RD_STATE_IN_LIST 1 +#define ISCSI_CONN_RD_STATE_IN_LIST 1 #define ISCSI_CONN_RD_STATE_PROCESSING 2 #define ISCSI_CONN_WR_STATE_IDLE 0 @@ -137,7 +137,7 @@ struct iscsi_conn { /* Both protected by session->sn_lock */ u32 stat_sn; - u32 exp_stat_sn; + u32 exp_stat_sn; spinlock_t cmd_list_lock; /* BH lock */ @@ -235,7 +235,7 @@ typedef void (iscsi_show_info_t)(struct seq_file *seq, struct iscsi_target *targ #define ISCSI_REJECT_CMD 2 #define ISCSI_REJECT_DATA 3 -/* +/* * Most of the fields don't need any protection, since accessed from only a * single thread, except where noted. */ @@ -287,7 +287,7 @@ struct iscsi_cmnd { unsigned long write_timeout; /* - * Unprotected, since could be accessed from only a single + * Unprotected, since could be accessed from only a single * thread at time */ struct list_head rx_ddigest_cmd_list; @@ -538,7 +538,7 @@ static inline void conn_put(struct iscsi_conn *conn) atomic_read(&conn->conn_ref_cnt)-1); sBUG_ON(atomic_read(&conn->conn_ref_cnt) == 0); - /* + /* * It always ordered to protect from undesired side effects like * accessing just destroyed object because of this *_dec() reordering. */ diff --git a/iscsi-scst/kernel/iscsi_dbg.h b/iscsi-scst/kernel/iscsi_dbg.h index 8f76aac75..066e44838 100644 --- a/iscsi-scst/kernel/iscsi_dbg.h +++ b/iscsi-scst/kernel/iscsi_dbg.h @@ -1,12 +1,12 @@ /* * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/kernel/iscsi_hdr.h b/iscsi-scst/kernel/iscsi_hdr.h index 335ca881e..c33d3c8a6 100644 --- a/iscsi-scst/kernel/iscsi_hdr.h +++ b/iscsi-scst/kernel/iscsi_hdr.h @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index 3a6e05135..4f40353c1 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -4,11 +4,11 @@ * Copyright (C) 2004 - 2005 FUJITA Tomonori * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -398,7 +398,7 @@ static void close_conn(struct iscsi_conn *conn) } sBUG_ON(cmnd->parent_req != NULL); - + spin_lock_bh(&cmnd->rsp_cmd_lock); list_for_each_entry(rsp, &cmnd->rsp_cmd_list, rsp_cmd_list_entry) { TRACE_CONN_CLOSE_DBG(" rsp %p, ref_cnt %d, net_ref_cnt %d, " @@ -1012,7 +1012,7 @@ retry: break; goto out_iov; } - sBUG_ON(iop > conn->write_iov + + sBUG_ON(iop > conn->write_iov + sizeof(conn->write_iov)/sizeof(conn->write_iov[0])); iop->iov_base += rest; iop->iov_len -= rest; @@ -1082,7 +1082,7 @@ retry: retry2: res = sendpage(sock, sg_page(&sg[idx]), offset, size, flags); TRACE_WRITE("Final %s %#Lx:%u: %d(%lu,%u,%u, cmd %p, page %p)", - (sendpage != sock_no_sendpage) ? "sendpage" : + (sendpage != sock_no_sendpage) ? "sendpage" : "sock_no_sendpage", conn->session->sid, conn->cid, res, sg_page(&sg[idx])->index, offset, size, @@ -1110,7 +1110,7 @@ retry1: res = sendpage(sock, sg_page(&sg[idx]), offset, sendsize, flags | MSG_MORE); TRACE_WRITE("%s %#Lx:%u: %d(%lu,%u,%u, cmd %p, page %p)", - (sendpage != sock_no_sendpage) ? "sendpage" : + (sendpage != sock_no_sendpage) ? "sendpage" : "sock_no_sendpage", (unsigned long long)conn->session->sid, conn->cid, res, sg_page(&sg[idx])->index, offset, sendsize, @@ -1257,7 +1257,7 @@ static int iscsi_do_send(struct iscsi_conn *conn, int state) return res; } -/* +/* * No locks, conn is wr processing. * * IMPORTANT! Connection conn must be protected by additional conn_get() @@ -1288,7 +1288,7 @@ int iscsi_send(struct iscsi_conn *conn) init_tx_hdigest(cmnd); conn->write_state = TX_BHS_DATA; case TX_BHS_DATA: - res = iscsi_do_send(conn, ddigest && cmnd->pdu.datasize ? + res = iscsi_do_send(conn, ddigest && cmnd->pdu.datasize ? TX_INIT_DDIGEST : TX_END); if (res <= 0 || conn->write_state != TX_INIT_DDIGEST) break; diff --git a/iscsi-scst/kernel/param.c b/iscsi-scst/kernel/param.c index b0d18225a..0a64fedbe 100644 --- a/iscsi-scst/kernel/param.c +++ b/iscsi-scst/kernel/param.c @@ -2,11 +2,11 @@ * Copyright (C) 2005 FUJITA Tomonori * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/kernel/session.c b/iscsi-scst/kernel/session.c index cab228e77..3577407f6 100644 --- a/iscsi-scst/kernel/session.c +++ b/iscsi-scst/kernel/session.c @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/kernel/target.c b/iscsi-scst/kernel/target.c index cd47941b7..37b3e0b84 100644 --- a/iscsi-scst/kernel/target.c +++ b/iscsi-scst/kernel/target.c @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/chap.c b/iscsi-scst/usr/chap.c index 1fdee6f21..b8266f522 100644 --- a/iscsi-scst/usr/chap.c +++ b/iscsi-scst/usr/chap.c @@ -15,7 +15,7 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/config.h b/iscsi-scst/usr/config.h index 00d6bf02a..f02f25896 100644 --- a/iscsi-scst/usr/config.h +++ b/iscsi-scst/usr/config.h @@ -1,12 +1,12 @@ /* * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/conn.c b/iscsi-scst/usr/conn.c index 99a9c2ec3..f212206b7 100644 --- a/iscsi-scst/usr/conn.c +++ b/iscsi-scst/usr/conn.c @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/ctldev.c b/iscsi-scst/usr/ctldev.c index 34417ac43..05fdeeca1 100644 --- a/iscsi-scst/usr/ctldev.c +++ b/iscsi-scst/usr/ctldev.c @@ -2,11 +2,11 @@ * Copyright (C) 2004 - 2005 FUJITA Tomonori * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -208,7 +208,7 @@ static int proc_session_parse(int fd, struct session_file_operations *ops, goto out; } else log_error("Unknown %s string: %s\n", PROC_SESSION, p); - + done = 1; } @@ -414,7 +414,7 @@ static int iscsi_session_destroy(u32 tid, u64 sid) do { res = ioctl(ctrl_fd, DEL_SESSION, &info); } while (res < 0 && errno == EINTR); - + return res; } diff --git a/iscsi-scst/usr/event.c b/iscsi-scst/usr/event.c index 460412707..a1d0af664 100644 --- a/iscsi-scst/usr/event.c +++ b/iscsi-scst/usr/event.c @@ -4,11 +4,11 @@ * Copyright (C) 2005 FUJITA Tomonori * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/iscsi_adm.c b/iscsi-scst/usr/iscsi_adm.c index 7270eb1aa..a1e4aff3a 100644 --- a/iscsi-scst/usr/iscsi_adm.c +++ b/iscsi-scst/usr/iscsi_adm.c @@ -4,11 +4,11 @@ * Copyright (C) 2004 - 2005 FUJITA Tomonori * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -159,7 +159,7 @@ static int iscsid_response_recv(int fd, struct iscsi_adm_req *req) do { ret = readv(fd, iov, 2); } while (ret < 0 && errno == EINTR); - + if (ret != sizeof(rsp) + sizeof(*req)) { err = (ret < 0) ? -errno : -EIO; fprintf(stderr, "%s %d %d %d\n", __FUNCTION__, __LINE__, ret, diff --git a/iscsi-scst/usr/iscsi_adm.h b/iscsi-scst/usr/iscsi_adm.h index 771be05b8..5bdcf1faa 100644 --- a/iscsi-scst/usr/iscsi_adm.h +++ b/iscsi-scst/usr/iscsi_adm.h @@ -1,12 +1,12 @@ /* * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/iscsi_hdr.h b/iscsi-scst/usr/iscsi_hdr.h index 21460b040..e8b5551c4 100644 --- a/iscsi-scst/usr/iscsi_hdr.h +++ b/iscsi-scst/usr/iscsi_hdr.h @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/iscsi_scstd.c b/iscsi-scst/usr/iscsi_scstd.c index 66c07a29a..4edf0c4d6 100644 --- a/iscsi-scst/usr/iscsi_scstd.c +++ b/iscsi-scst/usr/iscsi_scstd.c @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -123,14 +123,14 @@ static void sock_set_keepalive(int sock, int timeout) if (setsockopt(sock, SOL_TCP, TCP_KEEPCNT, &opt, sizeof(opt))) log_warning("unable to set TCP_KEEPCNT on server socket (%s)!", strerror(errno)); - + if (setsockopt(sock, SOL_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout))) log_warning("unable to set TCP_KEEPIDLE on server socket (%s)!", strerror(errno)); - + opt = 3; if (setsockopt(sock, SOL_TCP, TCP_KEEPINTVL, &opt, sizeof(opt))) log_warning("unable to set KEEPINTVL on server socket (%s)!", strerror(errno)); - + opt = 1; if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof(opt))) log_warning("unable to set SO_KEEPALIVE on server socket (%s)!", strerror(errno)); @@ -166,7 +166,7 @@ static void create_listen_socket(struct pollfd *array) } sock_set_keepalive(sock, 50); - + opt = 1; if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt))) log_warning("Unable to set SO_REUSEADDR on server socket (%s)!", @@ -422,7 +422,7 @@ out: void wait_4_iscsi_event(int timeout) { int res; - + do { res = poll(&poll_array[POLL_NL], 1, timeout); } while (res < 0 && errno == EINTR); @@ -497,12 +497,12 @@ static void event_loop(int timeout) for (i = 0; i < INCOMING_MAX; i++) { struct connection *conn = incoming[i]; struct pollfd *pollfd = &poll_array[POLL_INCOMING + i]; - + if (!conn || !pollfd->revents) continue; pollfd->revents = 0; - + event_conn(conn, pollfd); if (conn->state == STATE_CLOSE) { diff --git a/iscsi-scst/usr/iscsid.c b/iscsi-scst/usr/iscsid.c index 35ae1a645..53a520c4f 100644 --- a/iscsi-scst/usr/iscsid.c +++ b/iscsi-scst/usr/iscsid.c @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -394,7 +394,7 @@ static void login_start(struct connection *conn) rsp->status_detail = ISCSI_STATUS_SVC_UNAVAILABLE; conn->state = STATE_EXIT; } - conn->session_param[key_max_recv_data_length].exec_val = + conn->session_param[key_max_recv_data_length].exec_val = conn->session_param[key_max_recv_data_length].local_val; } conn->exp_cmd_sn = be32_to_cpu(req->cmd_sn); diff --git a/iscsi-scst/usr/iscsid.h b/iscsi-scst/usr/iscsid.h index 0aaffc582..3774f0a25 100644 --- a/iscsi-scst/usr/iscsid.h +++ b/iscsi-scst/usr/iscsid.h @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/log.c b/iscsi-scst/usr/log.c index dd6cefd3b..8de4b20a7 100644 --- a/iscsi-scst/usr/log.c +++ b/iscsi-scst/usr/log.c @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/message.c b/iscsi-scst/usr/message.c index 3ee7b0849..3d3c91be1 100644 --- a/iscsi-scst/usr/message.c +++ b/iscsi-scst/usr/message.c @@ -2,11 +2,11 @@ * Copyright (C) 2004 - 2005 FUJITA Tomonori * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/misc.h b/iscsi-scst/usr/misc.h index bad5ca0f1..e4f7cfdbc 100644 --- a/iscsi-scst/usr/misc.h +++ b/iscsi-scst/usr/misc.h @@ -1,12 +1,12 @@ /* * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/param.c b/iscsi-scst/usr/param.c index 9be67224e..3fe20e5f0 100644 --- a/iscsi-scst/usr/param.c +++ b/iscsi-scst/usr/param.c @@ -2,11 +2,11 @@ * Copyright (C) 2005 FUJITA Tomonori * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/param.h b/iscsi-scst/usr/param.h index 3fbdd0040..5a5763fae 100644 --- a/iscsi-scst/usr/param.h +++ b/iscsi-scst/usr/param.h @@ -2,11 +2,11 @@ * Copyright (C) 2005 FUJITA Tomonori * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/plain.c b/iscsi-scst/usr/plain.c index ed83ce1e8..555d4dc90 100644 --- a/iscsi-scst/usr/plain.c +++ b/iscsi-scst/usr/plain.c @@ -4,11 +4,11 @@ * Copyright (C) 2005 FUJITA Tomonori * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/session.c b/iscsi-scst/usr/session.c index bafc80292..2e6a9e7a6 100644 --- a/iscsi-scst/usr/session.c +++ b/iscsi-scst/usr/session.c @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/target.c b/iscsi-scst/usr/target.c index 0941c870a..e69eeef2d 100644 --- a/iscsi-scst/usr/target.c +++ b/iscsi-scst/usr/target.c @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/iscsi-scst/usr/types.h b/iscsi-scst/usr/types.h index b4a27a0d1..98fa0fb3c 100644 --- a/iscsi-scst/usr/types.h +++ b/iscsi-scst/usr/types.h @@ -2,12 +2,12 @@ * Copyright (C) 2002-2003 Ardis Technolgies * Copyright (C) 2007 Vladislav Bolkhovitin * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/mpt/mpt_scst.c b/mpt/mpt_scst.c index e63299f47..3ba1a10c2 100644 --- a/mpt/mpt_scst.c +++ b/mpt/mpt_scst.c @@ -7,7 +7,7 @@ * and Leonid Stoljar * * MPT SCSI target mode driver for SCST. - * + * * Originally By: Stephen Shirron * Port to SCST By: Hu Gang * @@ -15,7 +15,7 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -90,7 +90,7 @@ static void stmapp_set_status(MPT_STM_PRIV *priv, CMD *cmd, int status); static void stmapp_tgt_command(MPT_STM_PRIV *priv, u32 reply_word); static void stm_cmd_buf_post(MPT_STM_PRIV *priv, int index); -static void stm_tgt_reply_high_pri(MPT_ADAPTER *ioc, +static void stm_tgt_reply_high_pri(MPT_ADAPTER *ioc, TargetCmdBufferPostErrorReply_t *rep); static void stm_target_reply_error(MPT_ADAPTER *ioc, TargetErrorReply_t *rep); static void stmapp_target_error(MPT_STM_PRIV *priv, u32 reply_word, int index, @@ -122,7 +122,7 @@ static void stm_link_serv_buf_post(MPT_STM_PRIV *priv, int index); static void stm_wait(MPT_STM_PRIV *priv, int milliseconds, int sleep); static int stm_wait_for(MPT_STM_PRIV *priv, volatile int *flag, int seconds, int sleep); -static void stmapp_srr_process(MPT_STM_PRIV *priv, int rx_id, int r_ctl, +static void stmapp_srr_process(MPT_STM_PRIV *priv, int rx_id, int r_ctl, u32 offset, LinkServiceBufferPostReply_t *rep, int index); static void stm_set_scsi_port_page1(MPT_STM_PRIV *priv, int sleep); @@ -144,7 +144,7 @@ mpt_target_show(struct seq_file *seq, void *v) MPT_STM_PRIV *priv = tgt->priv; TRACE_ENTRY(); - TRACE_DBG("priv %p, tgt %p", priv, tgt); + TRACE_DBG("priv %p, tgt %p", priv, tgt); sBUG_ON(tgt == NULL); sBUG_ON(ioc == NULL); @@ -210,7 +210,7 @@ mpt_target_show(struct seq_file *seq, void *v) } static int -mpt_proc_target_write(struct file *file, const char __user *buf, +mpt_proc_target_write(struct file *file, const char __user *buf, size_t length, loff_t *off) { @@ -249,10 +249,10 @@ mpt_proc_target_write(struct file *file, const char __user *buf, int id = simple_strtoul(s, NULL, 0); if (id < MPT_MAX_SCSI_DEVICES) { if (IsScsi(tgt->priv)) { - TRACE_DBG("Changing target id to %d\n", + TRACE_DBG("Changing target id to %d\n", id); tgt->priv->port_id = id; - stm_set_scsi_port_page1(tgt->priv, + stm_set_scsi_port_page1(tgt->priv, NO_SLEEP); } } @@ -273,7 +273,7 @@ static int mpt_target_detect(struct scst_tgt_template *temp1); static int mpt_target_release(struct scst_tgt *scst_tgt); static int stmapp_pending_sense(struct mpt_cmd *mpt_cmd); static int mpt_xmit_response(struct scst_cmd *scst_cmd); -static void mpt_inquiry_no_tagged_commands(MPT_STM_PRIV *priv, +static void mpt_inquiry_no_tagged_commands(MPT_STM_PRIV *priv, struct scst_cmd *scst_cmd); static int mpt_rdy_to_xfer(struct scst_cmd *scst_cmd); static void mpt_on_free_cmd(struct scst_cmd *scst_cmd); @@ -301,13 +301,13 @@ static struct scst_tgt_template tgt_template = { .task_mgmt_fn_done = mpt_task_mgmt_fn_done, }; -static inline void +static inline void mpt_msg_frame_free(MPT_STM_PRIV *priv, int index) { MPT_ADAPTER *ioc = priv->ioc; if (priv->current_mf[index] != NULL) { TRACE_DBG("%s: free mf index %d, %p", ioc->name, - MF_TO_INDEX(priv->current_mf[index]), + MF_TO_INDEX(priv->current_mf[index]), priv->current_mf[index]); mpt_free_msg_frame(_HANDLE_IOC_ID, priv->current_mf[index]); priv->current_mf[index] = NULL; @@ -321,7 +321,7 @@ mpt_msg_frame_alloc(MPT_ADAPTER *ioc, int index) MPT_FRAME_HDR *mf; if (index != -1) { - TRACE_DBG("%s: current_mf %p, index %d", + TRACE_DBG("%s: current_mf %p, index %d", ioc->name, priv->current_mf[index], index); WARN_ON(priv->current_mf[index] != NULL); } @@ -331,12 +331,12 @@ mpt_msg_frame_alloc(MPT_ADAPTER *ioc, int index) if (mf == NULL) { sBUG_ON(1); } - + if (index != -1) { priv->current_mf[index] = mf; } - TRACE_DBG("%s: alloc mf index %d, %p, %d", ioc->name, + TRACE_DBG("%s: alloc mf index %d, %p, %d", ioc->name, MF_TO_INDEX(mf), mf, index); return mf; @@ -353,7 +353,7 @@ mptstm_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct proc_dir_entry *p; struct proc_dir_entry *root; char name[4]; - + TRACE_ENTRY(); ret = mpt_stm_adapter_install(ioc); if (ret != 0) { @@ -379,12 +379,12 @@ mptstm_probe(struct pci_dev *pdev, const struct pci_device_id *id) tgt->priv->scsi_id_config = 0; atomic_set(&tgt->sess_count, 0); init_waitqueue_head(&tgt->waitQ); - + tgt->scst_tgt = scst_register(&tgt_template, NULL); if (tgt->scst_tgt == NULL) { PRINT_ERROR(MYNAM ": scst_register() " "failed for host %p", pdev); - + ret = -ENODEV; goto out; } @@ -406,11 +406,11 @@ mptstm_probe(struct pci_dev *pdev, const struct pci_device_id *id) scst_tgt_set_tgt_priv(tgt->scst_tgt, tgt); mpt_stm_priv[ioc->id]->tgt = tgt; _mpt_ada_nums ++; - + out: - + TRACE_EXIT_RES(ret); - + return ret; } @@ -438,7 +438,7 @@ static struct mpt_pci_driver mptstm_driver = { * the system. Each found adapter should be registered by calling * scst_register(). The function should return a value >= 0 to signify * the number of detected target adapters. A negative value should be - * returned whenever there is an error. + * returned whenever there is an error. */ static int mpt_target_detect(struct scst_tgt_template *templ) { @@ -456,17 +456,17 @@ static int mpt_target_detect(struct scst_tgt_template *templ) ret = -ENODEV; goto out; } - + ret = _mpt_ada_nums; - + out: TRACE_EXIT_RES(ret); - + return ret; } static struct scst_cmd * -_stm_target_command(MPT_STM_PRIV *priv, int reply_word, +_stm_target_command(MPT_STM_PRIV *priv, int reply_word, struct mpt_cmd *mpt_cmd) { u8 *cdb; @@ -478,9 +478,9 @@ _stm_target_command(MPT_STM_PRIV *priv, int reply_word, #ifdef DEBUG MPT_ADAPTER *ioc = priv->ioc; #endif - /* - * Get the CBD, LUN, tag, Task Mgmt flags, and data length from the - * receive packet + /* + * Get the CBD, LUN, tag, Task Mgmt flags, and data length from the + * receive packet */ TRACE_ENTRY(); @@ -546,7 +546,7 @@ _stm_target_command(MPT_STM_PRIV *priv, int reply_word, TRACE_DBG("%s: cmd %p, re_word %x, alias %x, lun %x, tag %x," "%s, init_idx %d, %p, %d", - ioc->name, cmd, reply_word, alias, lun, tag, alias_lun, + ioc->name, cmd, reply_word, alias, lun, tag, alias_lun, init_index, priv->scst_cmd[index], dl); mpt_cmd->CMD = cmd; @@ -581,7 +581,7 @@ mpt_send_busy(struct mpt_cmd *cmd) stmapp_set_status(cmd->priv, cmd->CMD, STS_BUSY); } -static void +static void mpt_alloc_session_done(struct scst_session *scst_sess, void *data, int result) { struct mpt_sess *sess = (struct mpt_sess *) data; @@ -592,7 +592,7 @@ mpt_alloc_session_done(struct scst_session *scst_sess, void *data, int result) TRACE_ENTRY(); if (result == 0) { scst_sess_set_tgt_priv(scst_sess, sess); - + while (!list_empty(&sess->delayed_cmds)) { cmd = list_entry(sess->delayed_cmds.next, typeof(*cmd), delayed_cmds_entry); @@ -600,7 +600,7 @@ mpt_alloc_session_done(struct scst_session *scst_sess, void *data, int result) if (rc == 0) rc = mpt_send_cmd_to_scst(cmd, SCST_CONTEXT_THREAD); if (rc != 0) { - PRINT_INFO(MYNAM ": Unable to get the command, sending BUSY state %p", + PRINT_INFO(MYNAM ": Unable to get the command, sending BUSY state %p", cmd); mpt_send_busy(cmd); kfree(cmd); @@ -619,27 +619,27 @@ mpt_alloc_session_done(struct scst_session *scst_sess, void *data, int result) kfree(cmd); } tgt->sess[sess->init_index] = NULL; - + TRACE_MEM("kfree for sess %p", sess); kfree(sess); - + if (atomic_dec_and_test(&tgt->sess_count)) wake_up_all(&tgt->waitQ); } - + __clear_bit(MPT_SESS_INITING, &sess->sess_flags); TRACE_EXIT(); return; } -static int +static int mpt_send_cmd_to_scst(struct mpt_cmd *cmd, int context) { int res = 0; - + TRACE_ENTRY(); - + cmd->scst_cmd = _stm_target_command(cmd->priv, cmd->reply_word, cmd); if (cmd->scst_cmd == NULL) { res = -EFAULT; @@ -650,9 +650,9 @@ mpt_send_cmd_to_scst(struct mpt_cmd *cmd, int context) #endif scst_cmd_init_done(cmd->scst_cmd, context); - out: + out: TRACE_EXIT_RES(res); - + return res; } @@ -685,7 +685,7 @@ stm_send_target_status_deferred(MPT_STM_PRIV *priv, } static void -stm_data_done(MPT_ADAPTER *ioc, u32 reply_word, +stm_data_done(MPT_ADAPTER *ioc, u32 reply_word, struct scst_cmd *scst_cmd, struct mpt_cmd *cmd, int index) { MPT_STM_PRIV *priv = mpt_stm_priv[ioc->id]; @@ -704,7 +704,7 @@ stm_data_done(MPT_ADAPTER *ioc, u32 reply_word, TRACE_EXIT(); } -void +void stm_tgt_reply(MPT_ADAPTER *ioc, u32 reply_word) { MPT_STM_PRIV *priv = mpt_stm_priv[ioc->id]; @@ -713,7 +713,7 @@ stm_tgt_reply(MPT_ADAPTER *ioc, u32 reply_word) struct scst_cmd *scst_cmd; struct mpt_cmd *cmd; volatile int *io_state; - + TRACE_ENTRY(); index = GET_IO_INDEX(reply_word); @@ -724,23 +724,23 @@ stm_tgt_reply(MPT_ADAPTER *ioc, u32 reply_word) TRACE_DBG("index %d, state %x, scst cmd %p, current_mf %p", index, *io_state, scst_cmd, priv->current_mf[index]); /* - * if scst_cmd is NULL it show the command buffer not using by + * if scst_cmd is NULL it show the command buffer not using by * SCST, let parse the CDB */ if (scst_cmd == NULL) { WARN_ON((*io_state & ~IO_STATE_HIGH_PRIORITY) != IO_STATE_POSTED); *io_state &= ~IO_STATE_POSTED; - + mpt_msg_frame_free(priv, index); stmapp_tgt_command(priv, reply_word); goto out; } - + cmd = (struct mpt_cmd *)scst_cmd_get_tgt_priv(scst_cmd); - TRACE_DBG("scst cmd %p, index %d, cmd %p, cmd state %s", + TRACE_DBG("scst cmd %p, index %d, cmd %p, cmd state %s", scst_cmd, index, cmd, mpt_state_string[cmd->state]); - + if (cmd->state == MPT_STATE_NEED_DATA) { int context = SCST_CONTEXT_TASKLET; int rx_status = SCST_RX_STATUS_SUCCESS; @@ -801,18 +801,18 @@ stm_tgt_reply(MPT_ADAPTER *ioc, u32 reply_word) switch (atomic_read(&priv->pending_sense[init_index])) { /* attempt to send status and sense succeeded */ case MPT_STATUS_SENSE_ATTEMPT: - atomic_set(&priv->pending_sense[init_index], + atomic_set(&priv->pending_sense[init_index], MPT_STATUS_SENSE_IDLE); /* ToDo: check and set scst_set_delivery_status(), if necessary */ scst_tgt_cmd_done(scst_cmd); break; - /* we tried to send status and sense - * simltaneously and failed. Prepare to handle - * the next command without SCST if it is + /* we tried to send status and sense + * simltaneously and failed. Prepare to handle + * the next command without SCST if it is * REQUEST_SENSE */ case MPT_STATUS_SENSE_NOT_SENT: - atomic_set(&priv->pending_sense[init_index], + atomic_set(&priv->pending_sense[init_index], MPT_STATUS_SENSE_HANDLE_RQ); /* ToDo: check and set scst_set_delivery_status(), if necessary */ scst_tgt_cmd_done(scst_cmd); @@ -821,17 +821,17 @@ stm_tgt_reply(MPT_ADAPTER *ioc, u32 reply_word) /* we've handled REQUEST_SENSE ourselves and * we're done with the command. Clean up */ case MPT_STATUS_SENSE_HANDLE_RQ: - TRACE_DBG("%s: clearing pending sense", + TRACE_DBG("%s: clearing pending sense", ioc->name); - atomic_set(&priv->pending_sense[init_index], + atomic_set(&priv->pending_sense[init_index], MPT_STATUS_SENSE_IDLE); mpt_on_free_cmd(scst_cmd); /* scst_cmd alloced in stmapp_pending_sense */ - kfree(scst_cmd); + kfree(scst_cmd); break; default: - /* nothing much to do here, we aren't + /* nothing much to do here, we aren't * handling cached sense/status */ /* ToDo: check and set scst_set_delivery_status(), if necessary */ scst_tgt_cmd_done(scst_cmd); @@ -863,7 +863,7 @@ stm_tgt_reply(MPT_ADAPTER *ioc, u32 reply_word) /* * just insert into list - * bug how can i handle it + * bug how can i handle it */ if (*io_state == 0 && cmd->state == MPT_STATE_NEW) { WARN_ON(1); @@ -881,11 +881,11 @@ stm_tgt_reply(MPT_ADAPTER *ioc, u32 reply_word) #endif WARN_ON(1); out: - + TRACE_EXIT(); } -static int +static int mpt_is_task_mgm(MPT_STM_PRIV *priv, u32 reply_word, int *lun) { int task_mgmt = 0, index; @@ -927,22 +927,22 @@ stmapp_tgt_command(MPT_STM_PRIV *priv, u32 reply_word) int init_index, res = 0, task_mgmt, lun; TRACE_ENTRY(); - + tgt = priv->tgt; task_mgmt = mpt_is_task_mgm(priv, reply_word, &lun); if (task_mgmt) { mpt_handle_task_mgmt(priv, reply_word, task_mgmt, lun); } - + init_index = GET_INITIATOR_INDEX(reply_word); - + if (test_bit(MPT_TGT_SHUTDOWN, &tgt->tgt_flags)) { TRACE_DBG("New command while the device %p is shutting down", tgt); res = -EFAULT; goto out; } - + cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC); TRACE_MEM("kmalloc(GFP_ATOMIC) for cmd (%d): %p", sizeof(*cmd), cmd); if (cmd == NULL) { @@ -950,7 +950,7 @@ stmapp_tgt_command(MPT_STM_PRIV *priv, u32 reply_word) res = -ENOMEM; goto out; } - + memset(cmd, 0, sizeof(*cmd)); cmd->priv = priv; cmd->reply_word = reply_word; @@ -966,29 +966,29 @@ stmapp_tgt_command(MPT_STM_PRIV *priv, u32 reply_word) goto out_free_cmd; } /* WWPN */ - + atomic_inc(&tgt->sess_count); smp_mb__after_atomic_inc(); - + memset(sess, 0, sizeof(*sess)); sess->tgt = tgt; sess->init_index = init_index; INIT_LIST_HEAD(&sess->delayed_cmds); - + sess->scst_sess = scst_register_session(tgt->scst_tgt, 1, "", sess, mpt_alloc_session_done); if (sess->scst_sess == NULL) { - PRINT_ERROR(MYNAM ": scst_register_session failed %p", + PRINT_ERROR(MYNAM ": scst_register_session failed %p", tgt); res = -EFAULT; goto out_free_sess; } - + __set_bit(MPT_SESS_INITING, &sess->sess_flags); - + tgt->sess[init_index] = sess; scst_sess_set_tgt_priv(sess->scst_sess, sess); - + cmd->sess = sess; list_add_tail(&cmd->delayed_cmds_entry, &sess->delayed_cmds); goto out; @@ -1009,7 +1009,7 @@ stmapp_tgt_command(MPT_STM_PRIV *priv, u32 reply_word) goto out_free_cmd; } } - + out: TRACE_EXIT(); return; @@ -1029,7 +1029,7 @@ stmapp_tgt_command(MPT_STM_PRIV *priv, u32 reply_word) /* * mpt_target_release - * + * * this function is * intended to free up the resources allocated to the device. The function * should return 0 to indicate successful release or a negative value if @@ -1058,7 +1058,7 @@ struct mpt_prm struct mpt_cmd *cmd; }; -static inline void +static inline void mpt_dump_sge(MPT_SGE *sge, struct scatterlist *sg) { if (sge) { @@ -1066,13 +1066,13 @@ mpt_dump_sge(MPT_SGE *sge, struct scatterlist *sg) struct page *page = NULL; address = bus_to_virt(sge->address); page = virt_to_page(address); - TRACE_DBG("address %p, length %x, count %d, page %p", + TRACE_DBG("address %p, length %x, count %d, page %p", address, sge->length, page_count(page), page); TRACE_BUFFER("sge data", address, min(sge->length, (u32)0x10)); } if (sg) { TRACE_DBG("sg %p, page %p, %p, offset %d, dma address %x, len %d", - sg, sg->page, page_address(sg->page), + sg, sg->page, page_address(sg->page), sg->offset, sg->dma_address, sg->length); TRACE_BUFFER("sg data", page_address(sg->page), (u32)0x10); } @@ -1096,8 +1096,8 @@ mpt_sge_to_sgl(struct mpt_prm *prm, MPT_STM_PRIV *priv, MPT_SGL *sgl) prm->sg = (struct scatterlist *)prm->buffer; prm->seg_cnt = pci_map_sg(priv->ioc->pcidev, prm->sg, prm->use_sg, scst_to_tgt_dma_dir(prm->data_direction)); - - pci_dma_sync_sg_for_cpu(priv->ioc->pcidev, prm->sg, prm->use_sg, + + pci_dma_sync_sg_for_cpu(priv->ioc->pcidev, prm->sg, prm->use_sg, scst_to_tgt_dma_dir(prm->data_direction)); for (i = 0; i < prm->use_sg; i++) { sgl->sge[i].length = sg_dma_len(&prm->sg[i]); @@ -1110,11 +1110,11 @@ mpt_sge_to_sgl(struct mpt_prm *prm, MPT_STM_PRIV *priv, MPT_SGL *sgl) mpt_dump_sge(&sgl->sge[i], &prm->sg[i]); bufflen -= sgl->sge[i].length; } - pci_dma_sync_sg_for_device(priv->ioc->pcidev, prm->sg, prm->use_sg, + pci_dma_sync_sg_for_device(priv->ioc->pcidev, prm->sg, prm->use_sg, scst_to_tgt_dma_dir(prm->data_direction)); - + sgl->num_sges = prm->seg_cnt; - + TRACE_EXIT(); } @@ -1122,7 +1122,7 @@ static inline void mpt_set_sense_info(MPT_STM_PRIV *priv, CMD *cmd, int len, u8 *sense_buf) { u8 *info = NULL; - + TRACE_ENTRY(); if (IsScsi(priv)) { @@ -1180,11 +1180,11 @@ mpt_send_tgt_data(MPT_STM_PRIV *priv, u32 reply_word, TRACE_ENTRY(); req = (TargetAssistRequest_t *)mpt_msg_frame_alloc(ioc,index); memset(req, 0, sizeof(*req)); - + if (priv->exiting) { flags &= ~TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER; } - + if (priv->io_state[index] & IO_STATE_HIGH_PRIORITY) { flags |= TARGET_ASSIST_FLAGS_HIGH_PRIORITY; if (flags & TARGET_ASSIST_FLAGS_AUTO_STATUS) { @@ -1192,7 +1192,7 @@ mpt_send_tgt_data(MPT_STM_PRIV *priv, u32 reply_word, priv->io_state[index] |= IO_STATE_AUTO_REPOST; } } - + if (priv->fcp2_capable/* && priv->initiators != NULL*/) { init_index = GET_INITIATOR_INDEX(reply_word); /*init = priv->initiators[init_index]; @@ -1202,7 +1202,7 @@ mpt_send_tgt_data(MPT_STM_PRIV *priv, u32 reply_word, } TRACE_DBG("flags %x, tag %x, lun %x, offset %x, length %x", flags, tag, lun, offset, length); - + req->StatusCode = 0; req->TargetAssistFlags = (u8)flags; req->Function = MPI_FUNCTION_TARGET_ASSIST; @@ -1229,7 +1229,7 @@ mpt_send_tgt_data(MPT_STM_PRIV *priv, u32 reply_word, (u8)(MPI_SGE_FLAGS_CHAIN_ELEMENT | MPI_SGE_FLAGS_MPT_STM_ADDRESSING); dma_addr = priv->hw_dma + - ((u8 *)priv->hw->cmd_buf[index].chain_sge - + ((u8 *)priv->hw->cmd_buf[index].chain_sge - (u8 *)priv->hw); stm_set_dma_addr(sge_chain->Address, dma_addr); /* set the "last element" flag in the mf */ @@ -1347,7 +1347,7 @@ if(trace_mpi) } #endif res = 0; - + priv->io_state[index] |= IO_STATE_DATA_SENT; if (flags & TARGET_ASSIST_FLAGS_AUTO_STATUS) priv->io_state[index] |= IO_STATE_STATUS_SENT; @@ -1361,28 +1361,28 @@ if(trace_mpi) } TRACE_EXIT_RES(res); - - return res; + + return res; } -/* +/* * calling mpt_send_target_data * */ -static void +static void mpt_send_target_data(struct mpt_prm *prm, int flags) { MPT_STM_PRIV *priv; u32 reply_word; int index, lun, tag, length, offset; MPT_SGL *sgl; - + TRACE_ENTRY(); priv = prm->tgt->priv; sgl = &priv->sgl; - + mpt_sge_to_sgl(prm, priv, sgl); - + reply_word = prm->cmd->CMD->reply_word; index = GET_IO_INDEX(reply_word); @@ -1392,15 +1392,15 @@ mpt_send_target_data(struct mpt_prm *prm, int flags) if (prm->data_direction == SCST_DATA_READ) { flags |= TARGET_ASSIST_FLAGS_DATA_DIRECTION; } - + length = prm->bufflen; offset = 0; -#if 0 +#if 0 TRACE_DBG("priv %p, reply_word %x, index %x, flags %x, lun %x, " "tag %x, sgl %p, length %x, offset %x", - priv, reply_word, index, flags, lun, tag, + priv, reply_word, index, flags, lun, tag, sgl, length, offset); -#endif +#endif mpt_send_tgt_data(priv, reply_word, index, flags, lun, tag, sgl, length, offset); @@ -1409,14 +1409,14 @@ mpt_send_target_data(struct mpt_prm *prm, int flags) } /* - * this function checks if we need to handle REQUEST_SENSE on behalf of the - * target device. If the sense wasn't able to be sent simultaneously - * with the status for the last command with a check condition, it needs - * to either get sent for a REQUEST_SENSE command or forgotten. + * this function checks if we need to handle REQUEST_SENSE on behalf of the + * target device. If the sense wasn't able to be sent simultaneously + * with the status for the last command with a check condition, it needs + * to either get sent for a REQUEST_SENSE command or forgotten. * * The pending_sense state and a buffer for holding sense is created for * each possible initiator. The pending_sense state is used to tell if - * sending sense failed and to track the progress of the following + * sending sense failed and to track the progress of the following * REQUEST_SENSE command. * * There are four values for the pending_sense state: @@ -1430,25 +1430,25 @@ mpt_send_target_data(struct mpt_prm *prm, int flags) * sense data, otherwise the cached sense data is ignored and the * command is sent to SCST. * - * In stmapp_pending_sense, if pending_sense state for an initiator == - * SENSE_HANDLE_RQ, the incoming command is inspected. If it is - * REQUEST_SENSE, the command is handled by the LSI driver without - * involving SCST. The cached sense data from the immediately previous - * command is used. This sense data was not sent along with the status - * for that command (see below). If the command is not REQUEST_SENSE, - * the cached sense data is discarded and the command is sent to SCST + * In stmapp_pending_sense, if pending_sense state for an initiator == + * SENSE_HANDLE_RQ, the incoming command is inspected. If it is + * REQUEST_SENSE, the command is handled by the LSI driver without + * involving SCST. The cached sense data from the immediately previous + * command is used. This sense data was not sent along with the status + * for that command (see below). If the command is not REQUEST_SENSE, + * the cached sense data is discarded and the command is sent to SCST * for processing. * * In stm_send_target_status, sense data about to be sent is saved in a * buffer and the pending_sense state for that initiator is set to * MPT_STATUS_SENSE_ATTEMPT. The sense and status are sent to the LSI - * hardware. + * hardware. * - * If the LSI hardware determines that the sense and status could not be - * sent in one operation, stm_reply is called with state == STATUS_SENT - * and with IOCStatus of MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT (0x6B). - * This condition only happens in the non-packetized SCSI operating mode. - * When this happens, the pending_sense state is advanced to + * If the LSI hardware determines that the sense and status could not be + * sent in one operation, stm_reply is called with state == STATUS_SENT + * and with IOCStatus of MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT (0x6B). + * This condition only happens in the non-packetized SCSI operating mode. + * When this happens, the pending_sense state is advanced to * MPT_STATUS_SENSE_NOT_SENT. * * In stm_tgt_reply, if io_state == STATUS_SENT: @@ -1469,7 +1469,7 @@ mpt_send_target_data(struct mpt_prm *prm, int flags) * tagged command queueing. The mpt_inquiry_no_tagged_commands function * does this by modifying INQUIRY data before sending it over the wire. */ -static int +static int stmapp_pending_sense(struct mpt_cmd *mpt_cmd) { int res = 0; @@ -1490,7 +1490,7 @@ stmapp_pending_sense(struct mpt_cmd *mpt_cmd) if (IsScsi(priv)) { index = GET_IO_INDEX(mpt_cmd->reply_word); init_index = GET_INITIATOR_INDEX(mpt_cmd->reply_word); - if (atomic_read(&priv->pending_sense[init_index]) == + if (atomic_read(&priv->pending_sense[init_index]) == MPT_STATUS_SENSE_HANDLE_RQ) { cmd = &priv->hw->cmd_buf[index]; scsi_cmd = (SCSI_CMD *)cmd->cmd; @@ -1499,27 +1499,27 @@ stmapp_pending_sense(struct mpt_cmd *mpt_cmd) if (cdb[0] == REQUEST_SENSE) { /* scst_cmd used as a container in stm_tgt_reply, * command doesn't actually go to SCST */ - scst_cmd = kmalloc(sizeof(struct scst_cmd), + scst_cmd = kmalloc(sizeof(struct scst_cmd), GFP_ATOMIC); TRACE_DBG("scst_cmd 0x%p", scst_cmd); if (scst_cmd != NULL) { cmd->reply_word = mpt_cmd->reply_word; - if (cmd->reply_word & + if (cmd->reply_word & TARGET_MODE_REPLY_ALIAS_MASK) { - cmd->alias = (scsi_cmd->AliasID - + cmd->alias = (scsi_cmd->AliasID - priv->port_id) & 15; } else { cmd->alias = 0; } - cmd->lun = get2bytes(scsi_cmd->LogicalUnitNumber, + cmd->lun = get2bytes(scsi_cmd->LogicalUnitNumber, 0); cmd->tag = scsi_cmd->Tag; mpt_cmd->CMD = cmd; - memset(scst_cmd, 0x00, + memset(scst_cmd, 0x00, sizeof(struct scst_cmd)); scst_cmd->resp_data_len = -1; - memcpy(scst_cmd->cdb, cdb, + memcpy(scst_cmd->cdb, cdb, MPT_MAX_CDB_LEN); priv->scst_cmd[index] = scst_cmd; scst_cmd_set_tag(scst_cmd, cmd->tag); @@ -1532,10 +1532,10 @@ stmapp_pending_sense(struct mpt_cmd *mpt_cmd) /* smallest amount of data between * requested length, buffer size, * and cached length */ - prm.bufflen = min((size_t)cdb[4], + prm.bufflen = min((size_t)cdb[4], (size_t)SCSI_SENSE_BUFFERSIZE); - prm.bufflen = min(prm.bufflen, - (size_t)(priv->pending_sense_buffer[init_index][7] + prm.bufflen = min(prm.bufflen, + (size_t)(priv->pending_sense_buffer[init_index][7] + 8)); sg.page = virt_to_page(priv->pending_sense_buffer[init_index]); sg.offset = offset_in_page(priv->pending_sense_buffer[init_index]); @@ -1546,29 +1546,29 @@ stmapp_pending_sense(struct mpt_cmd *mpt_cmd) prm.tgt = priv->tgt->sess[init_index]->tgt; prm.cmd->state = MPT_STATE_DATA_OUT; - TRACE_DBG("%s: sending pending sense", + TRACE_DBG("%s: sending pending sense", priv->ioc->name); mpt_send_target_data(&prm, flags); res = 1; } else { - /* we couldn't create a scst_cmd, so + /* we couldn't create a scst_cmd, so * we can't do anything. Send the * command to SCST. */ - atomic_set(&priv->pending_sense[init_index], + atomic_set(&priv->pending_sense[init_index], MPT_STATUS_SENSE_IDLE); } } else { - /* next command immediately after check - * condition is not REQUEST_SENSE, so we can - * discard the cached sense and send the + /* next command immediately after check + * condition is not REQUEST_SENSE, so we can + * discard the cached sense and send the * command to SCST. */ - atomic_set(&priv->pending_sense[init_index], + atomic_set(&priv->pending_sense[init_index], MPT_STATUS_SENSE_IDLE); } } else { /* we don't need to perform REQUEST_SENSE and can * send the command to SCST */ - atomic_set(&priv->pending_sense[init_index], + atomic_set(&priv->pending_sense[init_index], MPT_STATUS_SENSE_IDLE); } } @@ -1582,7 +1582,7 @@ stmapp_pending_sense(struct mpt_cmd *mpt_cmd) * transmit the response data and the status in the struct scst_cmd. See * below for details. Must be defined. */ -static int +static int mpt_xmit_response(struct scst_cmd *scst_cmd) { int res = SCST_TGT_RES_SUCCESS; @@ -1602,7 +1602,7 @@ mpt_xmit_response(struct scst_cmd *scst_cmd) prm.cmd = (struct mpt_cmd *)scst_cmd_get_tgt_priv(scst_cmd); sess = (struct mpt_sess *) scst_sess_get_tgt_priv(scst_cmd_get_session(scst_cmd)); - + prm.sg = NULL; prm.bufflen = scst_cmd_get_resp_data_len(scst_cmd); prm.buffer = scst_cmd->sg; @@ -1615,7 +1615,7 @@ mpt_xmit_response(struct scst_cmd *scst_cmd) prm.seg_cnt = 0; is_send_status = scst_cmd_get_is_send_status(scst_cmd); - TRACE_DBG("rq_result=%x, is_send_status=%x, %x, %d", prm.rq_result, + TRACE_DBG("rq_result=%x, is_send_status=%x, %x, %d", prm.rq_result, is_send_status, prm.bufflen, prm.sense_buffer_len); if ((prm.rq_result != 0) && (prm.sense_buffer != NULL)) TRACE_BUFFER("Sense", prm.sense_buffer, prm.sense_buffer_len); @@ -1627,16 +1627,16 @@ mpt_xmit_response(struct scst_cmd *scst_cmd) res = SCST_TGT_RES_FATAL_ERROR; goto out_tgt_free; } - + if (test_bit(MPT_SESS_SHUTDOWN, &sess->sess_flags)) { TRACE_DBG("cmd %p while session %p is shutting down", prm.cmd, sess); res = SCST_TGT_RES_SUCCESS; goto out_tgt_free; } - + if (SCST_SENSE_VALID(prm.sense_buffer)) { - mpt_set_sense_info(prm.tgt->priv, prm.cmd->CMD, + mpt_set_sense_info(prm.tgt->priv, prm.cmd->CMD, prm.sense_buffer_len, prm.sense_buffer); } @@ -1651,7 +1651,7 @@ mpt_xmit_response(struct scst_cmd *scst_cmd) scst_to_tgt_dma_dir(scst_cmd_get_data_direction(scst_cmd))); } mpt_send_target_data(&prm, flags); - + if (prm.rq_result == 0) { goto out; } @@ -1674,13 +1674,13 @@ mpt_xmit_response(struct scst_cmd *scst_cmd) TRACE_DBG("scst cmd %p, index %d, flags %d", scst_cmd, index, flags); - stm_send_target_status(priv, reply_word, index, + stm_send_target_status(priv, reply_word, index, flags, lun, tag); } out: TRACE_EXIT_RES(res); - + return res; out_tgt_free: @@ -1703,12 +1703,12 @@ mpt_inquiry_no_tagged_commands(MPT_STM_PRIV *priv, struct scst_cmd *scst_cmd) TRACE_ENTRY(); - /* + /* * only modify INQUIRY if we're on a SCSI bus, * and we are handling a standard INQUIRY command * (EVPD = 0) */ - if (IsScsi(priv) && (scst_cmd->cdb[0] == INQUIRY) && + if (IsScsi(priv) && (scst_cmd->cdb[0] == INQUIRY) && !(scst_cmd->cdb[1] & 0x1)) { sBUG_ON(scst_cmd->sg_cnt == 0); length = scst_get_buf_first(scst_cmd, &address); @@ -1724,7 +1724,7 @@ mpt_inquiry_no_tagged_commands(MPT_STM_PRIV *priv, struct scst_cmd *scst_cmd) } /* - * this function + * this function * informs the driver that data buffer corresponding to the said command * have now been allocated and it is OK to receive data for this command. * This function is necessary because a SCSI target does not have any @@ -1763,7 +1763,7 @@ static int mpt_rdy_to_xfer(struct scst_cmd *scst_cmd) prm.use_sg = scst_cmd->sg_cnt; prm.data_direction = scst_cmd_get_data_direction(scst_cmd); prm.tgt = sess->tgt; - + if (test_bit(MPT_SESS_SHUTDOWN, &sess->sess_flags)) { TRACE_DBG("cmd %p while session %p is shutting down", prm.cmd, sess); @@ -1772,14 +1772,14 @@ static int mpt_rdy_to_xfer(struct scst_cmd *scst_cmd) res = SCST_TGT_RES_SUCCESS; goto out; } - + prm.cmd->state = MPT_STATE_NEED_DATA; - + mpt_send_target_data(&prm, 0); - + out: TRACE_EXIT_RES(res); - + return res; } @@ -1795,7 +1795,7 @@ static void mpt_on_free_cmd(struct scst_cmd *scst_cmd) (struct mpt_cmd *)scst_cmd_get_tgt_priv(scst_cmd); TRACE_ENTRY(); - + TRACE_DBG("cmd %p, scst_cmd %p", cmd, scst_cmd); scst_cmd_set_tgt_priv(scst_cmd, NULL); @@ -1814,7 +1814,7 @@ static void mpt_on_free_cmd(struct scst_cmd *scst_cmd) * scst_mgmt_cmd_get_status(). No return value expected. Must be * defined, if the target supports task management functionality. */ -static void +static void mpt_task_mgmt_fn_done(struct scst_mgmt_cmd *mgmt_cmd) { TRACE_ENTRY(); @@ -1826,7 +1826,7 @@ static void mpt_local_task_mgmt(struct mpt_sess *sess, int task_mgmt, int lun) { struct mpt_cmd *cmd, *t; - + TRACE_ENTRY(); switch (task_mgmt) { case IMM_NTFY_TARGET_RESET: @@ -1851,7 +1851,7 @@ mpt_local_task_mgmt(struct mpt_sess *sess, int task_mgmt, int lun) } } break; - + case IMM_NTFY_CLEAR_ACA: default: break; @@ -1859,7 +1859,7 @@ mpt_local_task_mgmt(struct mpt_sess *sess, int task_mgmt, int lun) TRACE_EXIT(); } -static int +static int mpt_handle_task_mgmt(MPT_STM_PRIV *priv, u32 reply_word, int task_mgmt, int _lun) { @@ -1871,11 +1871,11 @@ mpt_handle_task_mgmt(MPT_STM_PRIV *priv, u32 reply_word, uint16_t lun = _lun; TRACE_ENTRY(); - + TRACE_DBG("task_mgmt %d", task_mgmt); tgt = priv->tgt; init_index = GET_INITIATOR_INDEX(reply_word); - + sess = tgt->sess[init_index]; if (sess == NULL) { TRACE(TRACE_MGMT, "mpt_scst(%s): task mgmt fn %p for " @@ -1883,7 +1883,7 @@ mpt_handle_task_mgmt(MPT_STM_PRIV *priv, u32 reply_word, res = -EFAULT; goto out; } - + if (test_bit(MPT_SESS_INITING, &sess->sess_flags)) { TRACE(TRACE_MGMT, "mpt_scst(%s): task mgmt fn %p for " "inited session", priv->ioc->name, tgt); @@ -1891,7 +1891,7 @@ mpt_handle_task_mgmt(MPT_STM_PRIV *priv, u32 reply_word, res = -EFAULT; goto out; } - + mcmd = kmalloc(sizeof(*mcmd), GFP_ATOMIC); TRACE_MEM("kmalloc(GFP_ATOMIC) for mcmd (%d): %p", sizeof(*mcmd), mcmd); @@ -1904,7 +1904,7 @@ mpt_handle_task_mgmt(MPT_STM_PRIV *priv, u32 reply_word, memset(mcmd, 0, sizeof(*mcmd)); mcmd->sess = sess; mcmd->task_mgmt = task_mgmt; - + switch(task_mgmt) { case IMM_NTFY_CLEAR_ACA: TRACE(TRACE_MGMT, "%s", "IMM_NTFY_CLEAR_ACA received"); @@ -1931,7 +1931,7 @@ mpt_handle_task_mgmt(MPT_STM_PRIV *priv, u32 reply_word, (uint8_t *)&lun, sizeof(lun), SCST_ATOMIC, mcmd); break; - + case IMM_NTFY_ABORT_TS: TRACE(TRACE_MGMT, "%s", "IMM_NTFY_ABORT_TS received"); rc = scst_rx_mgmt_fn_lun(sess->scst_sess, SCST_ABORT_TASK_SET, @@ -2068,13 +2068,13 @@ stm_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf_req, MPT_FRAME_HDR *mf_rep) return (0); } if (ioc_status == MPI_IOCSTATUS_TARGET_NO_CONNECTION) { - printk(KERN_ERR MYNAM + printk(KERN_ERR MYNAM ": %s: Got MPI_IOCSTATUS_TARGET_NO_CONNECTION\n", ioc->name); return (0); } if (rep->MsgLength > sizeof(*rep)/sizeof(u32)) { - TRACE_DBG("MsgLength is %d, %d", + TRACE_DBG("MsgLength is %d, %d", rep->MsgLength, sizeof(*rep)/sizeof(u32)); WARN_ON(1); /* @@ -2127,10 +2127,10 @@ stm_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf_req, MPT_FRAME_HDR *mf_rep) /* if this is a MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT * and we're SCSI, only print if we're debugging and * tracing. This is a normal consequence of attempting - * to send sense data and status in the same + * to send sense data and status in the same * transaction. */ - if (IsScsi(priv) && + if (IsScsi(priv) && (ioc_status == MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT)) { TRACE_DBG(MYNAM ":%s TargetStatusSendReq IOCStatus = %04x\n", ioc->name, ioc_status); @@ -2324,8 +2324,8 @@ stm_tgt_reply_high_pri(MPT_ADAPTER *ioc, TargetCmdBufferPostErrorReply_t *rep) if (reason == PRIORITY_REASON_NO_DISCONNECT || reason == PRIORITY_REASON_SCSI_TASK_MANAGEMENT) { stm_tgt_reply(ioc, reply_word); - goto out; - } + goto out; + } WARN_ON(1); if (reason == PRIORITY_REASON_TARGET_BUSY) { @@ -2529,7 +2529,7 @@ stm_event_process(MPT_ADAPTER *ioc, */ if (IsScsi(priv)) { for (i = 0; i < NUM_SCSI_DEVICES; i++) { - atomic_set(&priv->pending_sense[i], + atomic_set(&priv->pending_sense[i], MPT_STATUS_SENSE_IDLE); } } @@ -3131,18 +3131,18 @@ stm_send_target_status(MPT_STM_PRIV *priv, /* * cache sense buffer so we can send it on the next * REQUEST SENSE command if the IOC can't send the - * status and sense simultaneously (generating + * status and sense simultaneously (generating * MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT IOCStatus) */ - sense_size = min(sizeof(rsp->SenseData), + sense_size = min(sizeof(rsp->SenseData), (size_t)SCSI_SENSE_BUFFERSIZE); TRACE_DBG("caching %d bytes pending sense", sense_size); - memcpy(priv->pending_sense_buffer[init_index], + memcpy(priv->pending_sense_buffer[init_index], rsp->SenseData, sense_size); - TRACE_BUFFER("priv->pending_sense_buffer", - priv->pending_sense_buffer[init_index], + TRACE_BUFFER("priv->pending_sense_buffer", + priv->pending_sense_buffer[init_index], sense_size); - atomic_set(&priv->pending_sense[init_index], + atomic_set(&priv->pending_sense[init_index], MPT_STATUS_SENSE_ATTEMPT); } if (rsp->Valid & SCSI_RSP_LEN_VALID) { @@ -3281,7 +3281,7 @@ stm_send_els(MPT_STM_PRIV *priv, TRACE(TRACE_MPI, "%s: stm_send_els %d", ioc->name, index); for (i = 0; i < sizeof(*req) / 4; i++) { - TRACE(TRACE_MPI, "%s: req[%02x] = %08x", + TRACE(TRACE_MPI, "%s: req[%02x] = %08x", ioc->name, i * 4, le32_to_cpu(p[i])); } } @@ -3728,7 +3728,7 @@ stm_process_logout_port(MPT_STM_PRIV *priv, /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ static int -stm_get_hard_address(MPT_STM_PRIV *priv, int port_id, int *hard_address, +stm_get_hard_address(MPT_STM_PRIV *priv, int port_id, int *hard_address, int sleep) { MPT_ADAPTER *ioc = priv->ioc; @@ -3857,7 +3857,7 @@ stm_scsi_configuration(MPT_STM_PRIV *priv, ScsiDevice1->RequestedParameters = cpu_to_le32(cap | (sync << 8)); TRACE_DBG("%s initiator %d parameters = %08x, %s %s", ioc->name, i, le32_to_cpu(ScsiDevice1->RequestedParameters), - sync ? "SYNC" : " ", + sync ? "SYNC" : " ", wide ? "WIDE" : " "); memcpy(priv->hw->config_buf, ScsiDevice1, sizeof(*ScsiDevice1)); stm_set_config_page(priv, MPI_CONFIG_PAGETYPE_SCSI_DEVICE, 1, i, sleep); @@ -3869,7 +3869,7 @@ stm_scsi_configuration(MPT_STM_PRIV *priv, } /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -static void +static void stm_set_scsi_port_page1(MPT_STM_PRIV *priv, int sleep) { #ifdef DEBUG @@ -5158,7 +5158,7 @@ stmapp_srr_adjust_offset(MPT_STM_PRIV *priv, int index) TRACE_EXIT(); } -static void +static void stmapp_target_error_prioprity_io(MPT_STM_PRIV *priv, u32 reply_word, int index, int status, int reason, int lun, int tag) @@ -5369,10 +5369,10 @@ stmapp_target_error(MPT_STM_PRIV *priv, */ /* * Allow STATUS_SENT status to go through also, this is the - * result of an attempt to send a check condition with - * attached sense bytes. - * The IOC knows it can't send status and sense over a - * traditional SCSI cable (if non-packetized), so we should + * result of an attempt to send a check condition with + * attached sense bytes. + * The IOC knows it can't send status and sense over a + * traditional SCSI cable (if non-packetized), so we should * treat this as a successful completion, manually repost the * command to the IOC, and free the SCST command. */ @@ -5383,7 +5383,7 @@ stmapp_target_error(MPT_STM_PRIV *priv, * simultaneously, indicate that we failed */ if (atomic_read(&priv->pending_sense[init_index]) == MPT_STATUS_SENSE_ATTEMPT) { - atomic_set(&priv->pending_sense[init_index], + atomic_set(&priv->pending_sense[init_index], MPT_STATUS_SENSE_NOT_SENT); } stm_tgt_reply(ioc, reply_word); @@ -5562,7 +5562,7 @@ static void __exit mpt_target_exit(void) mpt_proc_log_entry_clean(&tgt_template); scst_unregister_target_template(&tgt_template); _mpt_stm_exit(); - + TRACE_EXIT(); return; } diff --git a/mpt/mpt_scst.h b/mpt/mpt_scst.h index f087e917c..04bcf3c7e 100644 --- a/mpt/mpt_scst.h +++ b/mpt/mpt_scst.h @@ -241,7 +241,7 @@ typedef struct _MPT_STM_PRIV #define FWVersion_0101 Reserved_0101_FWVersion #define EventDataSasPhyLinkStatus_t MpiEventDataSasPhyLinkStatus_t -#ifndef MPI_FCPORTPAGE1_FLAGS_FORCE_USE_NOSEEPROM_WWNS +#ifndef MPI_FCPORTPAGE1_FLAGS_FORCE_USE_NOSEEPROM_WWNS #define MPI_FCPORTPAGE1_FLAGS_FORCE_USE_NOSEEPROM_WWNS (0x02000000) #endif @@ -337,7 +337,7 @@ typedef struct _MPT_STM_PRIV #define MPT_STATUS_SENSE_NOT_SENT 2 /* sense couldn't be sent with status */ #define MPT_STATUS_SENSE_HANDLE_RQ 3 /* REQUEST SENSE handled with cached sense */ -struct mpt_cmd +struct mpt_cmd { struct mpt_sess *sess; struct scst_cmd *scst_cmd; @@ -349,7 +349,7 @@ struct mpt_cmd dma_addr_t dma_handle; }; -struct mpt_sess +struct mpt_sess { struct scst_session *scst_sess; struct mpt_tgt *tgt; @@ -375,5 +375,5 @@ struct mpt_mgmt_cmd struct mpt_sess *sess; int task_mgmt; }; - + #endif diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 8ef47d441..5a75438a0 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -1,17 +1,17 @@ /* * qla2x00t.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * Leonid Stoljar * Nathaniel Clark * * Qlogic 2x00 SCSI target driver. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -142,7 +142,7 @@ static void q2t_modify_command_count(scsi_qla_host_t *ha, int cmd_count, TRACE_ENTRY(); - TRACE_DBG("Sending MODIFY_LUN ha %p, cmd %d, imm %d", + TRACE_DBG("Sending MODIFY_LUN ha %p, cmd %d, imm %d", ha, cmd_count, imm_count); pkt = (modify_lun_entry_t *)tgt_data.req_pkt(ha); @@ -180,7 +180,7 @@ static void __q2t_send_notify_ack(scsi_qla_host_t *ha, int resp_code_valid, uint16_t ox_id) { nack_entry_t *ntfy; - + TRACE_ENTRY(); /* Send marker if required */ @@ -233,7 +233,7 @@ static inline void q2t_send_notify_ack(scsi_qla_host_t *ha, resp_code_valid, iocb->ox_id); } -/* +/* * register with initiator driver (but target mode isn't enabled till * it's turned on via sysfs) */ @@ -257,7 +257,7 @@ static int q2t_target_detect(struct scst_tgt_template *templ) } if (tgt_data.magic != QLA2X_INITIATOR_MAGIC) { - PRINT_ERROR("Wrong version of the initiator driver: %d", + PRINT_ERROR("Wrong version of the initiator driver: %d", tgt_data.magic); res = -EINVAL; } @@ -320,7 +320,7 @@ static void q2t_unreg_sess(struct q2t_sess *sess) PRINT_INFO("qla2x00tgt(%ld): session for loop_id %d deleted", sess->tgt->ha->instance, sess->loop_id); - /* + /* * Any commands for this session will be finished regularly, * because we must not drop SCSI commands on transport level, * at least without any response to the initiator. @@ -384,12 +384,12 @@ static int q2t_target_release(struct scst_tgt *scst_tgt) wait_event(tgt->waitQ, test_tgt_sess_count(tgt, ha)); /* big hammer */ - if(!ha->flags.host_shutting_down) + if(!ha->flags.host_shutting_down) tgt_data.disable_lun(ha); /* wait for sessions to clear out (just in case) */ - wait_event(tgt->waitQ, test_tgt_sess_count(tgt, ha)); - + wait_event(tgt->waitQ, test_tgt_sess_count(tgt, ha)); + TRACE_MGMT_DBG("Finished waiting for tgt %p: empty(sess_list)=%d " "sess_count=%d", tgt, list_empty(&tgt->sess_list), tgt->sess_count); @@ -426,19 +426,19 @@ static int q2t_pci_map_calc_cnt(struct q2t_prm *prm) prm->tgt->datasegs_per_cmd) / prm->tgt->datasegs_per_cont; if (((uint16_t)(prm->seg_cnt - prm->tgt->datasegs_per_cmd)) % - prm->tgt->datasegs_per_cont) + prm->tgt->datasegs_per_cont) { prm->req_cnt++; } } out: - TRACE_DBG("seg_cnt=%d, req_cnt=%d, res=%d", prm->seg_cnt, + TRACE_DBG("seg_cnt=%d, req_cnt=%d, res=%d", prm->seg_cnt, prm->req_cnt, res); return res; out_err: - PRINT_ERROR("qla2x00tgt(%ld): PCI mapping failed: sg_cnt=%d", + PRINT_ERROR("qla2x00tgt(%ld): PCI mapping failed: sg_cnt=%d", prm->tgt->ha->instance, prm->sg_cnt); res = -1; goto out; @@ -464,7 +464,7 @@ static inline uint32_t q2t_make_handle(scsi_qla_host_t *ha) } } while ((h == Q2T_NULL_HANDLE) || (h == Q2T_BUSY_HANDLE) || - (h == Q2T_SKIP_HANDLE) || + (h == Q2T_SKIP_HANDLE) || (ha->cmds[h] != NULL)); if (h != Q2T_NULL_HANDLE) @@ -493,7 +493,7 @@ static void q2t_build_ctio_pkt(struct q2t_prm *prm) prm->pkt->entry_type = CONTINUE_TGT_IO_TYPE; prm->pkt->entry_count = (uint8_t) prm->req_cnt; - + h = q2t_make_handle(prm->tgt->ha); if (h != Q2T_NULL_HANDLE) { prm->tgt->ha->cmds[h] = prm->cmd; @@ -506,10 +506,10 @@ static void q2t_build_ctio_pkt(struct q2t_prm *prm) /* Set initiator ID */ h = GET_TARGET_ID(prm->tgt->ha, &prm->cmd->atio); SET_TARGET_ID(prm->tgt->ha, prm->pkt->target, h); - + prm->pkt->exchange_id = prm->cmd->atio.exchange_id; - TRACE(TRACE_DEBUG|TRACE_SCSI, + TRACE(TRACE_DEBUG|TRACE_SCSI, "handle(scst_cmd) -> %08x, timeout %d L %#x -> I %#x E %#x", prm->pkt->handle, timeout, le16_to_cpu(prm->cmd->atio.lun), GET_TARGET_ID(prm->tgt->ha, prm->pkt), @@ -549,7 +549,7 @@ static void q2t_load_data_segments(struct q2t_prm *prm) /* Load command entry data segments */ for (cnt = 0; (cnt < prm->tgt->datasegs_per_cmd) && prm->seg_cnt; - cnt++, prm->seg_cnt--) + cnt++, prm->seg_cnt--) { *dword_ptr++ = cpu_to_le32(pci_dma_lo32(sg_dma_address(prm->sg))); @@ -573,10 +573,10 @@ static void q2t_load_data_segments(struct q2t_prm *prm) /* Build continuation packets */ while (prm->seg_cnt > 0) { - cont_a64_entry_t *cont_pkt64 = + cont_a64_entry_t *cont_pkt64 = (cont_a64_entry_t *)tgt_data.req_cont_pkt(prm->tgt->ha); - /* + /* * Make sure that from cont_pkt64 none of * 64-bit specific fields used for 32-bit * addressing. Cast to (cont_entry_t*) for @@ -602,7 +602,7 @@ static void q2t_load_data_segments(struct q2t_prm *prm) /* Load continuation entry data segments */ for (cnt = 0; cnt < prm->tgt->datasegs_per_cont && prm->seg_cnt; - cnt++, prm->seg_cnt--) + cnt++, prm->seg_cnt--) { *dword_ptr++ = cpu_to_le32(pci_dma_lo32 @@ -636,7 +636,7 @@ static void q2t_init_ctio_ret_entry(ctio_ret_entry_t *ctio_m1, { TRACE_ENTRY(); - prm->sense_buffer_len = min((uint32_t)prm->sense_buffer_len, + prm->sense_buffer_len = min((uint32_t)prm->sense_buffer_len, (uint32_t)sizeof(ctio_m1->sense_data)); ctio_m1->flags = __constant_cpu_to_le16(OF_SSTS | OF_FAST_POST | @@ -782,10 +782,10 @@ static int q2t_xmit_response(struct scst_cmd *scst_cmd) prm.pkt->scsi_status = cpu_to_le16( prm.rq_result); prm.pkt->residual = cpu_to_le32(prm.residual); - prm.pkt->flags |= + prm.pkt->flags |= __constant_cpu_to_le16(OF_SSTS); } else { - ctio_ret_entry_t *ctio_m1 = + ctio_ret_entry_t *ctio_m1 = (ctio_ret_entry_t *) tgt_data.req_cont_pkt(prm.tgt->ha); @@ -810,7 +810,7 @@ static int q2t_xmit_response(struct scst_cmd *scst_cmd) } else { q2t_init_ctio_ret_entry((ctio_ret_entry_t *)prm.pkt, &prm); } - + prm.cmd->state = Q2T_STATE_PROCESSED; /* Mid-level is done processing */ TRACE_BUFFER("Xmitting", prm.pkt, REQUEST_ENTRY_SIZE); @@ -884,7 +884,7 @@ static int q2t_rdy_to_xfer(struct scst_cmd *scst_cmd) TRACE_BUFFER("Xfering", prm.pkt, REQUEST_ENTRY_SIZE); q2t_exec_queue(prm.tgt->ha); - + out_unlock: /* Release ring specific lock */ spin_unlock_irqrestore(&prm.tgt->ha->hardware_lock, flags); @@ -1001,7 +1001,7 @@ static inline struct scst_cmd *q2t_get_cmd(scsi_qla_host_t *ha, uint32_t handle) /* ha->hardware_lock supposed to be held on entry */ static void q2t_do_ctio_completion(scsi_qla_host_t *ha, - uint32_t handle, + uint32_t handle, uint16_t status, ctio_common_entry_t *ctio) { @@ -1012,10 +1012,10 @@ static void q2t_do_ctio_completion(scsi_qla_host_t *ha, TRACE_ENTRY(); - if (ctio != NULL) + if (ctio != NULL) loop_id = GET_TARGET_ID(ha, ctio); - TRACE(TRACE_DEBUG|TRACE_SCSI, "handle(ctio %p status %#x) <- %08x I %x", + TRACE(TRACE_DEBUG|TRACE_SCSI, "handle(ctio %p status %#x) <- %08x I %x", ctio, status, handle, loop_id); /* Clear out CTIO_COMPLETION_HANDLE_MARK */ @@ -1061,7 +1061,7 @@ static void q2t_do_ctio_completion(scsi_qla_host_t *ha, scst_cmd = q2t_get_cmd(ha, handle); if (unlikely(scst_cmd == NULL)) { PRINT_INFO("qla2x00tgt(%ld): Suspicious: unable to " - "find the command with handle %x", + "find the command with handle %x", ha->instance, handle); goto out; } @@ -1076,7 +1076,7 @@ static void q2t_do_ctio_completion(scsi_qla_host_t *ha, if (sess == NULL) { PRINT_INFO("qla2x00tgt(%ld): Suspicious: " "ctio_completion for non-existing session " - "(loop_id %d, tag %d)", + "(loop_id %d, tag %d)", ha->instance, loop_id, tag); goto out; } @@ -1084,7 +1084,7 @@ static void q2t_do_ctio_completion(scsi_qla_host_t *ha, scst_cmd = scst_find_cmd_by_tag(sess->scst_sess, tag); if (scst_cmd == NULL) { PRINT_INFO("qla2x00tgt(%ld): Suspicious: unable to " - "find the command with tag %d (loop_id %d)", + "find the command with tag %d (loop_id %d)", ha->instance, tag, loop_id); goto out; } @@ -1318,9 +1318,9 @@ static char *q2t_find_name(scsi_qla_host_t *ha, int loop_id) list_for_each_entry(fcl, &ha->fcports, list) { if (loop_id == (fcl->loop_id & 0xFF)) { sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - fcl->port_name[0], fcl->port_name[1], - fcl->port_name[2], fcl->port_name[3], - fcl->port_name[4], fcl->port_name[5], + fcl->port_name[0], fcl->port_name[1], + fcl->port_name[2], fcl->port_name[3], + fcl->port_name[4], fcl->port_name[5], fcl->port_name[6], fcl->port_name[7]); TRACE_DBG("found wwn: %s for loop_id: %d", wwn_str, loop_id); wwn_found = 1; @@ -1349,7 +1349,7 @@ static char *q2t_make_name(scsi_qla_host_t *ha, const uint8_t *name) goto out; } sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - name[1], name[0], name[3], name[2], name[5], name[4], + name[1], name[0], name[3], name[2], name[5], name[4], name[7], name[6]); out: @@ -1514,35 +1514,35 @@ static int q2t_handle_task_mgmt(scsi_qla_host_t *ha, notify_entry_t *iocb) case IMM_NTFY_CLEAR_ACA: TRACE(TRACE_MGMT, "%s", "IMM_NTFY_CLEAR_ACA received"); rc = scst_rx_mgmt_fn_lun(sess->scst_sess, SCST_CLEAR_ACA, - (uint8_t *)&lun, sizeof(lun), + (uint8_t *)&lun, sizeof(lun), SCST_ATOMIC, mcmd); break; case IMM_NTFY_TARGET_RESET: TRACE(TRACE_MGMT, "%s", "IMM_NTFY_TARGET_RESET received"); rc = scst_rx_mgmt_fn_lun(sess->scst_sess, SCST_TARGET_RESET, - (uint8_t *)&lun, sizeof(lun), + (uint8_t *)&lun, sizeof(lun), SCST_ATOMIC, mcmd); break; case IMM_NTFY_LUN_RESET: TRACE(TRACE_MGMT, "%s", "IMM_NTFY_LUN_RESET received"); rc = scst_rx_mgmt_fn_lun(sess->scst_sess, SCST_LUN_RESET, - (uint8_t *)&lun, sizeof(lun), + (uint8_t *)&lun, sizeof(lun), SCST_ATOMIC, mcmd); break; case IMM_NTFY_CLEAR_TS: TRACE(TRACE_MGMT, "%s", "IMM_NTFY_CLEAR_TS received"); rc = scst_rx_mgmt_fn_lun(sess->scst_sess, SCST_CLEAR_TASK_SET, - (uint8_t *)&lun, sizeof(lun), + (uint8_t *)&lun, sizeof(lun), SCST_ATOMIC, mcmd); break; case IMM_NTFY_ABORT_TS: TRACE(TRACE_MGMT, "%s", "IMM_NTFY_ABORT_TS received"); rc = scst_rx_mgmt_fn_lun(sess->scst_sess, SCST_ABORT_TASK_SET, - (uint8_t *)&lun, sizeof(lun), + (uint8_t *)&lun, sizeof(lun), SCST_ATOMIC, mcmd); break; @@ -1589,7 +1589,7 @@ static int q2t_abort_task(scsi_qla_host_t *ha, notify_entry_t *iocb) res = -EFAULT; goto out; } - + mcmd = kzalloc(sizeof(*mcmd), GFP_ATOMIC); if (mcmd == NULL) { TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of mgmt cmd failed"); @@ -1600,7 +1600,7 @@ static int q2t_abort_task(scsi_qla_host_t *ha, notify_entry_t *iocb) mcmd->sess = sess; mcmd->notify_entry = *iocb; - rc = scst_rx_mgmt_fn_tag(sess->scst_sess, SCST_ABORT_TASK, tag, + rc = scst_rx_mgmt_fn_tag(sess->scst_sess, SCST_ABORT_TASK, tag, SCST_ATOMIC, mcmd); if (rc != 0) { PRINT_ERROR("qla2x00tgt(%ld): scst_rx_mgmt_fn_tag() failed: %d", @@ -1665,20 +1665,20 @@ static void q2t_handle_imm_notify(scsi_qla_host_t *ha, notify_entry_t *iocb) if (!ha->flags.enable_target_mode || ha->tgt == NULL) { TRACE(TRACE_MGMT_DEBUG|TRACE_SCSI|TRACE_DEBUG, - "Acking %04x S %04x I %#x -> L %#x", status, + "Acking %04x S %04x I %#x -> L %#x", status, le16_to_cpu(iocb->seq_id), loop_id, le16_to_cpu(iocb->lun)); goto out; } TRACE_BUFFER("IMMED Notify Coming Up", iocb, sizeof(*iocb)); - + switch (status) { case IMM_NTFY_LIP_RESET: TRACE(TRACE_MGMT, "LIP reset (I %#x)", loop_id); - /* - * ToDo: doing so we reset all holding RESERVE'ations, - * which could be unexpected, so be more carefull here + /* + * ToDo: doing so we reset all holding RESERVE'ations, + * which could be unexpected, so be more carefull here */ q2t_clear_tgt_db(ha->tgt); /* set the Clear LIP reset event flag */ @@ -1691,7 +1691,7 @@ static void q2t_handle_imm_notify(scsi_qla_host_t *ha, notify_entry_t *iocb) break; case IMM_NTFY_ABORT_TASK: - TRACE(TRACE_MGMT_MINOR, "Abort Task (S %04x I %#x -> L %#x)", + TRACE(TRACE_MGMT_MINOR, "Abort Task (S %04x I %#x -> L %#x)", le16_to_cpu(iocb->seq_id), loop_id, le16_to_cpu(iocb->lun)); if (q2t_abort_task(ha, iocb) == 0) @@ -1699,12 +1699,12 @@ static void q2t_handle_imm_notify(scsi_qla_host_t *ha, notify_entry_t *iocb) break; case IMM_NTFY_PORT_LOGOUT: - TRACE(TRACE_MGMT, "Port logout (S %04x I %#x -> L %#x)", + TRACE(TRACE_MGMT, "Port logout (S %04x I %#x -> L %#x)", le16_to_cpu(iocb->seq_id), loop_id, le16_to_cpu(iocb->lun)); - /* - * ToDo: doing so we reset all holding RESERVE'ations, - * which could be unexpected, so be more carefull here + /* + * ToDo: doing so we reset all holding RESERVE'ations, + * which could be unexpected, so be more carefull here */ q2t_port_logout(ha, loop_id); break; @@ -1715,9 +1715,9 @@ static void q2t_handle_imm_notify(scsi_qla_host_t *ha, notify_entry_t *iocb) /* ToDo: ports DB changes handling ?? */ TRACE(TRACE_MGMT, "Port config changed, Global TPRLO or " "Global LOGO (%d)", status); - /* - * ToDo: doing so we reset all holding RESERVE'ations, - * which could be unexpected, so be more carefull here + /* + * ToDo: doing so we reset all holding RESERVE'ations, + * which could be unexpected, so be more carefull here */ q2t_clear_tgt_db(ha->tgt); break; @@ -1765,7 +1765,7 @@ static void q2t_response_pkt(scsi_qla_host_t *ha, sts_entry_t *pkt) ha, ha->flags.enable_target_mode); goto out; } - + if (pkt->entry_status != 0) { PRINT_ERROR("qla2x00tgt(%ld): Received response packet %x " "with error status %x", ha->instance, pkt->entry_type, @@ -1780,9 +1780,9 @@ static void q2t_response_pkt(scsi_qla_host_t *ha, sts_entry_t *pkt) atio = (atio_entry_t *)pkt; TRACE_DBG("ACCEPT_TGT_IO instance %ld status %04x " "lun %04x read/write %d data_length %08x " - "target_id %02x exchange_id %04x ", + "target_id %02x exchange_id %04x ", ha->instance, le16_to_cpu(atio->status), - le16_to_cpu(atio->lun), + le16_to_cpu(atio->lun), atio->execution_codes, le32_to_cpu(atio->data_length), GET_TARGET_ID(ha, atio), @@ -1790,7 +1790,7 @@ static void q2t_response_pkt(scsi_qla_host_t *ha, sts_entry_t *pkt) if (atio->status != __constant_cpu_to_le16(ATIO_CDB_VALID)) { PRINT_ERROR("qla2x00tgt(%ld): ATIO with error " - "status %x received", ha->instance, + "status %x received", ha->instance, le16_to_cpu(atio->status)); break; } @@ -1808,7 +1808,7 @@ static void q2t_response_pkt(scsi_qla_host_t *ha, sts_entry_t *pkt) if (!ha->tgt->tgt_shutdown) { PRINT_INFO("qla2x00tgt(%ld): Unable to " "send the command to SCSI target " - "mid-level, sending BUSY status", + "mid-level, sending BUSY status", ha->instance); } q2t_send_busy(ha, atio); @@ -1819,34 +1819,34 @@ static void q2t_response_pkt(scsi_qla_host_t *ha, sts_entry_t *pkt) "disabled", ha->instance); } break; - + case CONTINUE_TGT_IO_TYPE: if (ha->flags.enable_target_mode && ha->tgt != NULL) { ctio_common_entry_t *entry = (ctio_common_entry_t *)pkt; TRACE_DBG("CONTINUE_TGT_IO: instance %ld", ha->instance); q2t_do_ctio_completion(ha, entry->handle, - le16_to_cpu(entry->status), + le16_to_cpu(entry->status), entry); } else if (!ha->tgt->tgt_shutdown) { PRINT_ERROR("qla2x00tgt(%ld): CTIO, but target mode " "disabled", ha->instance); } break; - + case CTIO_A64_TYPE: if (ha->flags.enable_target_mode && ha->tgt != NULL) { ctio_common_entry_t *entry = (ctio_common_entry_t *)pkt; TRACE_DBG("CTIO_A64: instance %ld", ha->instance); - q2t_do_ctio_completion(ha, entry->handle, - le16_to_cpu(entry->status), + q2t_do_ctio_completion(ha, entry->handle, + le16_to_cpu(entry->status), entry); } else if (!ha->tgt->tgt_shutdown) { PRINT_ERROR("qla2x00tgt(%ld): CTIO_A64, but target " "mode disabled", ha->instance); } break; - + case IMMED_NOTIFY_TYPE: TRACE_DBG("%s", "IMMED_NOTIFY"); q2t_handle_imm_notify(ha, (notify_entry_t *)pkt); @@ -1858,14 +1858,14 @@ static void q2t_response_pkt(scsi_qla_host_t *ha, sts_entry_t *pkt) "with NULL tgt", ha->instance); } else if (ha->tgt->notify_ack_expected > 0) { nack_entry_t *entry = (nack_entry_t *)pkt; - TRACE_DBG("NOTIFY_ACK seq %04x status %x", + TRACE_DBG("NOTIFY_ACK seq %04x status %x", le16_to_cpu(entry->seq_id), le16_to_cpu(entry->status)); ha->tgt->notify_ack_expected--; if (entry->status != __constant_cpu_to_le16(NOTIFY_ACK_SUCCESS)) { PRINT_ERROR("qla2x00tgt(%ld): NOTIFY_ACK " - "failed %x", ha->instance, + "failed %x", ha->instance, le16_to_cpu(entry->status)); } } else { @@ -1874,24 +1874,24 @@ static void q2t_response_pkt(scsi_qla_host_t *ha, sts_entry_t *pkt) } break; - case MODIFY_LUN_TYPE: + case MODIFY_LUN_TYPE: if ((ha->tgt != NULL) && (ha->tgt->modify_lun_expected > 0)) { struct q2t_tgt *tgt = ha->tgt; modify_lun_entry_t *entry = (modify_lun_entry_t *)pkt; - TRACE_DBG("MODIFY_LUN %x, imm %c%d, cmd %c%d", + TRACE_DBG("MODIFY_LUN %x, imm %c%d, cmd %c%d", entry->status, - (entry->operators & MODIFY_LUN_IMM_ADD) ?'+' - :(entry->operators & MODIFY_LUN_IMM_SUB) ?'-' - :' ', - entry->immed_notify_count, - (entry->operators & MODIFY_LUN_CMD_ADD) ?'+' + (entry->operators & MODIFY_LUN_IMM_ADD) ?'+' + :(entry->operators & MODIFY_LUN_IMM_SUB) ?'-' + :' ', + entry->immed_notify_count, + (entry->operators & MODIFY_LUN_CMD_ADD) ?'+' :(entry->operators & MODIFY_LUN_CMD_SUB) ?'-' - :' ', + :' ', entry->command_count); tgt->modify_lun_expected--; if (entry->status != MODIFY_LUN_SUCCESS) { PRINT_ERROR("qla2x00tgt(%ld): MODIFY_LUN " - "failed %x", ha->instance, + "failed %x", ha->instance, entry->status); } tgt->disable_lun_status = entry->status; @@ -1905,7 +1905,7 @@ static void q2t_response_pkt(scsi_qla_host_t *ha, sts_entry_t *pkt) if (ha->tgt != NULL) { struct q2t_tgt *tgt = ha->tgt; elun_entry_t *entry = (elun_entry_t *)pkt; - TRACE_DBG("ENABLE_LUN %x imm %u cmd %u ", + TRACE_DBG("ENABLE_LUN %x imm %u cmd %u ", entry->status, entry->immed_notify_count, entry->command_count); if ((ha->flags.enable_target_mode) && @@ -1918,8 +1918,8 @@ static void q2t_response_pkt(scsi_qla_host_t *ha, sts_entry_t *pkt) "error: %#x", entry->status); entry->status = ENABLE_LUN_SUCCESS; } else if (entry->status != ENABLE_LUN_SUCCESS) { - PRINT_ERROR("qla2x00tgt(%ld): ENABLE_LUN " - "failed %x", + PRINT_ERROR("qla2x00tgt(%ld): ENABLE_LUN " + "failed %x", ha->instance, entry->status); ha->flags.enable_target_mode = ~ha->flags.enable_target_mode; @@ -1948,7 +1948,7 @@ static void q2t_async_event(uint16_t code, scsi_qla_host_t *ha, uint16_t *mailbo sBUG_ON(ha == NULL); if (unlikely(ha->tgt == NULL)) { - TRACE(TRACE_DEBUG|TRACE_MGMT, + TRACE(TRACE_DEBUG|TRACE_MGMT, "ASYNC EVENT %#x, but no tgt. ha %p tgt_flag %d", code, ha, ha->flags.enable_target_mode); goto out; @@ -1966,16 +1966,16 @@ static void q2t_async_event(uint16_t code, scsi_qla_host_t *ha, uint16_t *mailbo case MBA_CHG_IN_CONNECTION: /* Change in connection mode. */ TRACE_MGMT_DBG("Async event %#x occured: clear tgt_db", code); #if 0 - /* - * ToDo: doing so we reset all holding RESERVE'ations, - * which could be unexpected, so be more carefull here + /* + * ToDo: doing so we reset all holding RESERVE'ations, + * which could be unexpected, so be more carefull here */ q2t_clear_tgt_db(ha->tgt); #endif break; case MBA_RSCN_UPDATE: TRACE_MGMT_DBG("RSCN Update (%x) N_Port %#06x (fmt %x)", - code, ((mailbox[1]&0xF)<<2)|le16_to_cpu(mailbox[2]), + code, ((mailbox[1]&0xF)<<2)|le16_to_cpu(mailbox[2]), (mailbox[1]&0xF0)>>1); break; @@ -2010,9 +2010,9 @@ static int q2t_get_target_name(scsi_qla_host_t *ha, char **wwn) } sprintf(name, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - ha->port_name[0], ha->port_name[1], - ha->port_name[2], ha->port_name[3], - ha->port_name[4], ha->port_name[5], + ha->port_name[0], ha->port_name[1], + ha->port_name[2], ha->port_name[3], + ha->port_name[4], ha->port_name[5], ha->port_name[6], ha->port_name[7]); *wwn = name; @@ -2023,12 +2023,12 @@ out: /* no lock held on entry */ /* called via callback from qla2xxx */ -static void q2t_host_action(scsi_qla_host_t *ha, +static void q2t_host_action(scsi_qla_host_t *ha, qla2x_tgt_host_action_t action) { struct q2t_tgt *tgt = NULL; unsigned long flags = 0; - + TRACE_ENTRY(); @@ -2046,18 +2046,18 @@ static void q2t_host_action(scsi_qla_host_t *ha, "Allocation of tgt failed"); goto out; } - + tgt->ha = ha; tgt->disable_lun_status = Q2T_DISABLE_LUN_STATUS_NOT_SET; INIT_LIST_HEAD(&tgt->sess_list); init_waitqueue_head(&tgt->waitQ); - + if (ha->flags.enable_64bit_addressing) { PRINT_INFO("qla2x00tgt(%ld): 64 Bit PCI " "Addressing Enabled", ha->instance); tgt->tgt_enable_64bit_addr = 1; /* 3 is reserved */ - sg_tablesize = + sg_tablesize = QLA_MAX_SG64(ha->request_q_length - 3); tgt->datasegs_per_cmd = DATASEGS_PER_COMMAND64; tgt->datasegs_per_cont = DATASEGS_PER_CONT64; @@ -2069,7 +2069,7 @@ static void q2t_host_action(scsi_qla_host_t *ha, tgt->datasegs_per_cmd = DATASEGS_PER_COMMAND32; tgt->datasegs_per_cont = DATASEGS_PER_CONT32; } - + if (q2t_get_target_name(ha, &wwn) != 0) { kfree(tgt); goto out; @@ -2079,7 +2079,7 @@ static void q2t_host_action(scsi_qla_host_t *ha, kfree(wwn); if (!tgt->scst_tgt) { PRINT_ERROR("qla2x00tgt(%ld): scst_register() " - "failed for host %ld(%p)", ha->instance, + "failed for host %ld(%p)", ha->instance, ha->host_no, ha); kfree(tgt); goto out; @@ -2087,7 +2087,7 @@ static void q2t_host_action(scsi_qla_host_t *ha, scst_tgt_set_sg_tablesize(tgt->scst_tgt, sg_tablesize); scst_tgt_set_tgt_priv(tgt->scst_tgt, tgt); - + spin_lock_irqsave(&ha->hardware_lock, flags); ha->tgt = tgt; spin_unlock_irqrestore(&ha->hardware_lock, flags); @@ -2095,7 +2095,7 @@ static void q2t_host_action(scsi_qla_host_t *ha, TRACE_DBG("Enable lun for host %ld(%ld,%p)", ha->host_no, ha->instance, ha); tgt_data.enable_lun(ha); - + break; } case DISABLE_TARGET_MODE: @@ -2105,9 +2105,9 @@ static void q2t_host_action(scsi_qla_host_t *ha, ha->flags.enable_target_mode = 0; spin_unlock_irqrestore(&ha->hardware_lock, flags); - if(!ha->flags.host_shutting_down) + if(!ha->flags.host_shutting_down) tgt_data.disable_lun(ha); - + goto out; } @@ -2120,7 +2120,7 @@ static void q2t_host_action(scsi_qla_host_t *ha, scst_unregister(tgt->scst_tgt); /* * Free of tgt happens via callback q2t_target_release - * called from scst_unregister, so we shouldn't touch it again + * called from scst_unregister, so we shouldn't touch it again */ tgt = NULL; break; @@ -2237,7 +2237,7 @@ static int __init q2t_init(void) goto out_free_kmem; /* - * qla2xxx_tgt_register_driver() happens in q2t_target_detect + * qla2xxx_tgt_register_driver() happens in q2t_target_detect * called via scst_register_target_template() */ @@ -2254,7 +2254,7 @@ out_unreg_target: out_free_kmem: kmem_cache_destroy(q2t_cmd_cachep); - + qla2xxx_tgt_unregister_driver(); goto out; } @@ -2266,9 +2266,9 @@ static void __exit q2t_exit(void) q2t_proc_log_entry_clean(&tgt_template); scst_unregister_target_template(&tgt_template); - + qla2xxx_tgt_unregister_driver(); - + kmem_cache_destroy(q2t_cmd_cachep); TRACE_EXIT(); diff --git a/qla2x00t/qla2x00-target/qla2x00t.h b/qla2x00t/qla2x00-target/qla2x00t.h index cfcea70a7..16c7c875b 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.h +++ b/qla2x00t/qla2x00-target/qla2x00t.h @@ -1,19 +1,19 @@ /* * qla2x00t.h - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * Leonid Stoljar * Nathaniel Clark * - * Significant modification 2006 by Nathaniel Clark + * Significant modification 2006 by Nathaniel Clark * * Qlogic 2x00 SCSI target driver. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -163,10 +163,10 @@ struct q2t_prm }; /* ha->hardware_lock supposed to be held on entry (to protect tgt->sess_list) */ -static inline struct q2t_sess *q2t_find_sess_by_lid(struct q2t_tgt *tgt, - uint16_t lid) +static inline struct q2t_sess *q2t_find_sess_by_lid(struct q2t_tgt *tgt, + uint16_t lid) { - struct q2t_sess *sess, *sess_tmp; + struct q2t_sess *sess, *sess_tmp; sBUG_ON(tgt == NULL); list_for_each_entry_safe(sess, sess_tmp, &tgt->sess_list, list) { if (lid == (sess->loop_id)) diff --git a/qla2x00t/qla2x_tgt.h b/qla2x00t/qla2x_tgt.h index a92327936..ad5b5690e 100644 --- a/qla2x00t/qla2x_tgt.h +++ b/qla2x00t/qla2x_tgt.h @@ -1,16 +1,16 @@ /* * qla2x_tgt.h - * + * * Copyright (C) 2004-2005 Vladislav Bolkhovitin * and Leonid Stoljar * * Additional file for the target driver support. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -49,7 +49,7 @@ extern request_t *qla2x00_req_pkt(scsi_qla_host_t *ha); */ /* Caller MUST have hardware lock held */ static inline void -__qla2x00_en_dis_lun(scsi_qla_host_t *ha, int enable) +__qla2x00_en_dis_lun(scsi_qla_host_t *ha, int enable) { elun_entry_t *pkt; @@ -66,7 +66,7 @@ __qla2x00_en_dis_lun(scsi_qla_host_t *ha, int enable) pkt->immed_notify_count = 0; pkt->timeout = 0; } - DEBUG2(printk(KERN_DEBUG + DEBUG2(printk(KERN_DEBUG "scsi%lu:ENABLE_LUN IOCB imm %u cmd %u timeout %u\n", ha->host_no, pkt->immed_notify_count, pkt->command_count, pkt->timeout)); diff --git a/qla2x00t/qla2x_tgt_def.h b/qla2x00t/qla2x_tgt_def.h index c0594955f..455090cfd 100644 --- a/qla2x00t/qla2x_tgt_def.h +++ b/qla2x00t/qla2x_tgt_def.h @@ -1,17 +1,17 @@ /* * qla2x_tgt_def.h - * + * * Copyright (C) 2004-2005 Vladislav Bolkhovitin * and Leonid Stoljar * * Additional file for the target driver support. Intended to define * for 2200 and 2300 thier own exported symbols with unique names. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -47,7 +47,7 @@ #define QLA_EXTENDED_LUN 1 -/* +/* * Used to mark which completion handles (for RIO Status's) are for CTIO's * vs. regular (non-target) info. */ @@ -330,9 +330,9 @@ typedef struct * Type Definitions used by initiator & target halves \********************************************************************/ -typedef enum { - DISABLE_TARGET_MODE = 0, - ENABLE_TARGET_MODE = 1 +typedef enum { + DISABLE_TARGET_MODE = 0, + ENABLE_TARGET_MODE = 1 } qla2x_tgt_host_action_t; struct qla2x_tgt_initiator @@ -349,7 +349,7 @@ struct qla2x_tgt_initiator struct qla2x_tgt_target { int magic; - + /* Callbacks - H/W lock MUST be held while calling any*/ request_t *(*req_pkt)(scsi_qla_host_t *ha); void (*isp_cmd)(scsi_qla_host_t *ha); @@ -360,7 +360,7 @@ struct qla2x_tgt_target int (*get_counts)(scsi_qla_host_t *ha, uint8_t *cmd, uint8_t *imm); }; -int qla2xxx_tgt_register_driver(/* IN */ struct qla2x_tgt_initiator *tgt, +int qla2xxx_tgt_register_driver(/* IN */ struct qla2x_tgt_initiator *tgt, /* OUT */ struct qla2x_tgt_target *init); void qla2xxx_tgt_unregister_driver(void); diff --git a/qla2x00t/qla_attr.c b/qla2x00t/qla_attr.c index c2edd9c28..97527df15 100644 --- a/qla2x00t/qla_attr.c +++ b/qla2x00t/qla_attr.c @@ -29,7 +29,7 @@ qla2x00_show_tgt_enabled(struct class_device *cdev, char *buffer) ulong max_size = PAGE_SIZE; ulong size; - size = snprintf(buffer, max_size, "%d\n", + size = snprintf(buffer, max_size, "%d\n", ha->flags.enable_target_mode); return size; @@ -58,7 +58,7 @@ qla2x00_store_tgt_enabled(struct class_device *cdev, } switch (buffer[0]) { - case '0' : + case '0' : if ((ha->flags.enable_target_mode) || force) { qla_target.tgt_host_action(ha, DISABLE_TARGET_MODE); msleep_interruptible(10*1000); @@ -79,12 +79,12 @@ qla2x00_store_tgt_enabled(struct class_device *cdev, if ((size > 2) && (buffer[2] == 'r')) { set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); } - + return size; } -static CLASS_DEVICE_ATTR(target_mode_enabled, - S_IRUGO|S_IWUSR, +static CLASS_DEVICE_ATTR(target_mode_enabled, + S_IRUGO|S_IWUSR, qla2x00_show_tgt_enabled, qla2x00_store_tgt_enabled); @@ -106,13 +106,13 @@ qla2x00_show_resource_counts(struct class_device *cdev, char *buffer) rval = qla2x00_mailbox_command(ha, &mc); if (rval != QLA_SUCCESS) { - size = snprintf(buffer, max_size, - "Mailbox Command failed %d, mb %#x", + size = snprintf(buffer, max_size, + "Mailbox Command failed %d, mb %#x", rval, mc.mb[0]); goto out; } - size = snprintf(buffer, max_size, + size = snprintf(buffer, max_size, "immed_notify\t%d\ncommand\t\t%d\n", mc.mb[2], mc.mb[1]); @@ -143,7 +143,7 @@ qla2x00_show_port_database(struct class_device *cdev, char *buffer) dma_addr_t pmap_dma; port_data_t *pmap; ulong dma_size = 0x100*sizeof(*pmap); - pmap = (port_data_t*)dma_alloc_coherent(&ha->pdev->dev, dma_size, + pmap = (port_data_t*)dma_alloc_coherent(&ha->pdev->dev, dma_size, &pmap_dma, GFP_KERNEL); if (pmap == NULL) { size = snprintf(buffer, max_size, "DMA Alloc failed of %ld", @@ -165,30 +165,30 @@ qla2x00_show_port_database(struct class_device *cdev, char *buffer) rval = qla2x00_mailbox_command(ha, &mc); if (rval != QLA_SUCCESS) { - size = snprintf(buffer, max_size, - "Mailbox Command failed %d, mb0 %#x mb1 %#x\n", + size = snprintf(buffer, max_size, + "Mailbox Command failed %d, mb0 %#x mb1 %#x\n", rval, mc.mb[0], mc.mb[1]); goto out_free; } entries = le16_to_cpu(mc.mb[1])/sizeof(*pmap); - - size += snprintf(buffer+size, max_size-size, + + size += snprintf(buffer+size, max_size-size, "Port Name List (%#04x) returned %d bytes\nL_ID WWPN\n", MBC_PORT_NODE_NAME_LIST, le16_to_cpu(mc.mb[1])); for (i = 0; (i < entries) && (size < max_size); ++i) { - size += snprintf(buffer+size, max_size-size, + size += snprintf(buffer+size, max_size-size, "%04x %02x%02x%02x%02x%02x%02x%02x%02x\n", le16_to_cpu(pmap[i].loop_id), - pmap[i].port_name[7], pmap[i].port_name[6], - pmap[i].port_name[5], pmap[i].port_name[4], - pmap[i].port_name[3], pmap[i].port_name[2], + pmap[i].port_name[7], pmap[i].port_name[6], + pmap[i].port_name[5], pmap[i].port_name[4], + pmap[i].port_name[3], pmap[i].port_name[2], pmap[i].port_name[1], pmap[i].port_name[0]); } out_free: - dma_free_coherent(&ha->pdev->dev, dma_size, pmap, pmap_dma); + dma_free_coherent(&ha->pdev->dev, dma_size, pmap, pmap_dma); if (size < max_size) { @@ -204,17 +204,17 @@ out_free: rval = qla2x00_get_id_list(ha, ha->gid_list, ha->gid_list_dma, &entries); if (rval != QLA_SUCCESS) { - size += snprintf(buffer+size, max_size-size, + size += snprintf(buffer+size, max_size-size, "qla2x00_get_id_list failed: %d", rval); goto get_id_failed; } - - size += snprintf(buffer+size, max_size-size, + + size += snprintf(buffer+size, max_size-size, "\nGet ID List (0x007C) returned %d entries\n" "L_ID PortID\n", entries); - + id_iter = (char *)ha->gid_list; for (i = 0; (i < entries) && (size < max_size); ++i) { gid = (struct gid_list_info *)id_iter; @@ -234,7 +234,7 @@ out_free: gid->area, gid->al_pa, gid->loop_id_2100); - + } id_iter += ha->gid_list_info_size; } @@ -245,8 +245,8 @@ get_id_failed: fc_port_t *fcport; char * state; char port_type[] = "URSBIT"; - - size += snprintf(buffer+size, max_size-size, + + size += snprintf(buffer+size, max_size-size, "\nfc_ports database\n"); list_for_each_entry(fcport, &ha->fcports, list) { @@ -262,8 +262,8 @@ get_id_failed: case FCS_FAILOVER_FAILED : state = "Failover Failed"; break; default: state = "Unknown"; break; } - - size += snprintf(buffer+size, max_size-size, + + size += snprintf(buffer+size, max_size-size, "%04x %02x%02x%02x " "%02x%02x%02x%02x%02x%02x%02x%02x " "%c %s\n", @@ -271,9 +271,9 @@ get_id_failed: fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa, - fcport->port_name[0], fcport->port_name[1], - fcport->port_name[2], fcport->port_name[3], - fcport->port_name[4], fcport->port_name[5], + fcport->port_name[0], fcport->port_name[1], + fcport->port_name[2], fcport->port_name[3], + fcport->port_name[4], fcport->port_name[5], fcport->port_name[6], fcport->port_name[7], port_type[fcport->port_type], state); } @@ -291,7 +291,7 @@ qla2x00_update_portdb(struct class_device *cdev, const char *buffer, size_t size { scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); unsigned char reading = '0'; - + switch (reading) { case '2': qla2x00_configure_loop(ha); @@ -385,7 +385,7 @@ qla2x00_sysfs_write_fw_dump(struct kobject *kobj, struct bin_attribute *attr, break; case 1: if ((ha->fw_dump == NULL) && (ha->isp_ops.fw_dump != NULL)) - ha->isp_ops.fw_dump(ha, 0); + ha->isp_ops.fw_dump(ha, 0); if ((ha->fw_dump || ha->fw_dumped) && !ha->fw_dump_reading) { ha->fw_dump_reading = 1; @@ -1031,7 +1031,7 @@ struct class_device_attribute *qla2x00_host_attrs[] = { #if defined(FC_TARGET_SUPPORT) &class_device_attr_target_mode_enabled, &class_device_attr_resource_counts, - &class_device_attr_port_database, + &class_device_attr_port_database, #endif NULL, }; diff --git a/qla2x00t/qla_dbg.c b/qla2x00t/qla_dbg.c index 413dc858e..b48ef70bd 100644 --- a/qla2x00t/qla_dbg.c +++ b/qla2x00t/qla_dbg.c @@ -542,7 +542,7 @@ qla2300_ascii_fw_dump(scsi_qla_host_t *ha) qla_uprintf(&uiter, "\t"); for (cnt2 = 8; cnt2 > 0 && cnt2 <= 8; --cnt2) { #define PRINTC(c) ((c > 0x20 && c < 0x7e) ?c :'.') - qla_uprintf(&uiter, "%c", + qla_uprintf(&uiter, "%c", PRINTC(fw->risc_ram[cnt-cnt2])); #undef PRINTC } @@ -948,7 +948,7 @@ qla2100_ascii_fw_dump(scsi_qla_host_t *ha) qla_uprintf(&uiter, "\t"); for (cnt2 = 8; cnt2 > 0 && cnt2 <= 8; --cnt2) { #define PRINTC(c) ((c > 0x20 && c < 0x7e) ?c :'.') - qla_uprintf(&uiter, "%c", + qla_uprintf(&uiter, "%c", PRINTC(fw->risc_ram[cnt-cnt2])); #undef PRINTC } diff --git a/qla2x00t/qla_init.c b/qla2x00t/qla_init.c index b5fdbd6af..a424c63c1 100644 --- a/qla2x00t/qla_init.c +++ b/qla2x00t/qla_init.c @@ -690,10 +690,10 @@ qla2x00_chip_diag(scsi_qla_host_t *ha) data = RD_REG_WORD(®->ctrl_status); barrier(); } - + if (!cnt) goto chip_diag_failed; - + DEBUG3(printk("scsi(%ld): Reset register cleared by chip reset\n", ha->host_no)); @@ -1432,7 +1432,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) nv->id[2] != 'P' || nv->id[3] != ' ' || nv->nvram_version < 1) { /* Reset NVRAM data. */ qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: " - "checksum=0x%x nv=%p id=%c version=0x%x.\n", chksum, nv, + "checksum=0x%x nv=%p id=%c version=0x%x.\n", chksum, nv, nv->id[0], nv->nvram_version); qla_printk(KERN_WARNING, ha, "Falling back to functioning (yet " "invalid -- WWPN) defaults.\n"); @@ -1510,7 +1510,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) #ifdef FC_TARGET_SUPPORT if (ha->flags.enable_target_mode) nv->firmware_options[0] |= BIT_4; - else + else #endif /* FC_TARGET_SUPPORT */ nv->firmware_options[0] &= ~BIT_4; nv->firmware_options[1] |= (BIT_5 | BIT_0); @@ -1520,7 +1520,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) nv->firmware_options[0] |= BIT_2; nv->firmware_options[0] &= ~BIT_3; nv->add_firmware_options[1] |= BIT_5 | BIT_4; - + if (IS_QLA2300(ha)) { if (ha->fb_rev == FPM_2310) { strcpy(ha->model_number, "QLA2310"); @@ -4001,7 +4001,7 @@ __qla2x00_host_reset(scsi_qla_host_t *ha) { int ret = FAILED; - qla_printk(KERN_INFO, ha, "scsi(%ld): ADAPTER RESET ISSUED.\n", + qla_printk(KERN_INFO, ha, "scsi(%ld): ADAPTER RESET ISSUED.\n", ha->host_no); if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) @@ -4022,7 +4022,7 @@ __qla2x00_host_reset(scsi_qla_host_t *ha) /* Waiting for our command in done_queue to be returned to OS.*/ if (qla2x00_eh_wait_for_pending_commands(ha)) ret = SUCCESS; - + out: qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, (ret == FAILED) ? "failed" : "succeded"); @@ -4035,7 +4035,7 @@ out: * host_reset, bring up w/ Target Mode Enabled */ void -__qla2x00_enable_lun(scsi_qla_host_t *ha) +__qla2x00_enable_lun(scsi_qla_host_t *ha) { unsigned long flags = 0; @@ -4052,9 +4052,9 @@ __qla2x00_enable_lun(scsi_qla_host_t *ha) * * Disable Target Mode and reset the adapter */ -void -__qla2x00_disable_lun(scsi_qla_host_t *ha) -{ +void +__qla2x00_disable_lun(scsi_qla_host_t *ha) +{ unsigned long flags = 0; spin_lock_irqsave(&ha->hardware_lock, flags); @@ -4087,7 +4087,7 @@ __qla2x00_issue_marker(scsi_qla_host_t *ha) int qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp); -int +int qla2x00_get_resource_counts(scsi_qla_host_t *ha, uint8_t *cmd, uint8_t *imm) { mbx_cmd_t mc; @@ -4099,9 +4099,9 @@ qla2x00_get_resource_counts(scsi_qla_host_t *ha, uint8_t *cmd, uint8_t *imm) mc.in_mb = MBX_0|MBX_1|MBX_2; mc.tov = 30; mc.flags = 0; - + rval = qla2x00_mailbox_command(ha, &mc); - + *cmd = mc.mb[1]; *imm = mc.mb[2]; @@ -4134,16 +4134,16 @@ int qla2xxx_tgt_register_driver(struct qla2x_tgt_initiator *tgt_data, int res = 0; ENTER(__func__); - + if ((tgt_data == NULL) || (tgt_data->magic != QLA2X_TARGET_MAGIC)) { printk("***ERROR*** Wrong version of the target driver: %d\n", tgt_data->magic); res = -EINVAL; goto out; } - + memcpy(&qla_target, tgt_data, sizeof(qla_target)); - + init_data->magic = QLA2X_INITIATOR_MAGIC; init_data->req_pkt = qla2x00_req_pkt; init_data->isp_cmd = qla2x00_isp_cmd; @@ -4153,7 +4153,7 @@ int qla2xxx_tgt_register_driver(struct qla2x_tgt_initiator *tgt_data, init_data->req_cont_pkt = qla2x00_req_cont_pkt; init_data->get_counts = qla2x00_get_resource_counts; /* ... */ - + out: LEAVE(__func__); return res; diff --git a/qla2x00t/qla_isr.c b/qla2x00t/qla_isr.c index 0b20724a3..f5f0295d0 100644 --- a/qla2x00t/qla_isr.c +++ b/qla2x00t/qla_isr.c @@ -601,8 +601,8 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) ha->flags.init_done && mb[1] != 0xffff && #ifndef FC_TARGET_SUPPORT ((ha->operating_mode == P2P && mb[1] != 0) || - (ha->operating_mode != P2P && - mb[1] != SNS_FIRST_LOOP_ID)) && + (ha->operating_mode != P2P && + mb[1] != SNS_FIRST_LOOP_ID)) && #endif (mb[2] == 6 || mb[2] == 7)) { int rval; @@ -651,8 +651,8 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) mb[2], mb[3])); #ifdef FC_TARGET_SUPPORT DEBUG2(printk("scsi(%ld): ha state %d init_done %d " - "oper_mode %d topo %d\n", - ha->host_no, + "oper_mode %d topo %d\n", + ha->host_no, atomic_read(&ha->loop_state), ha->flags.init_done, ha->operating_mode, @@ -845,14 +845,14 @@ qla2x00_process_response_queue(struct scsi_qla_host *ha) case STATUS_TYPE_21: handle_cnt = ((sts21_entry_t *)pkt)->handle_count; for (cnt = 0; cnt < handle_cnt; cnt++) { - qla2x00_process_completed_request(ha, + qla2x00_process_completed_request(ha, ((sts21_entry_t *)pkt)->handle[cnt]); } break; case STATUS_TYPE_22: handle_cnt = ((sts22_entry_t *)pkt)->handle_count; for (cnt = 0; cnt < handle_cnt; cnt++) { - qla2x00_process_completed_request(ha, + qla2x00_process_completed_request(ha, ((sts22_entry_t *)pkt)->handle[cnt]); } break; @@ -866,10 +866,10 @@ qla2x00_process_response_queue(struct scsi_qla_host *ha) case ACCEPT_TGT_IO_TYPE: case CONTINUE_TGT_IO_TYPE: case CTIO_A64_TYPE: - case IMMED_NOTIFY_TYPE: + case IMMED_NOTIFY_TYPE: case NOTIFY_ACK_TYPE: case ENABLE_LUN_TYPE: - case MODIFY_LUN_TYPE: + case MODIFY_LUN_TYPE: DEBUG4(printk(KERN_WARNING "qla2x00_response_pkt: " "calling tgt_response_pkt %p " @@ -880,7 +880,7 @@ qla2x00_process_response_queue(struct scsi_qla_host *ha) { qla_target.tgt_response_pkt(ha, pkt); } - break; + break; #endif /* FC_TARGET_SUPPORT */ case MBX_IOCB_TYPE: if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && @@ -1541,7 +1541,7 @@ qla24xx_process_response_queue(struct scsi_qla_host *ha) case IMMED_NOTIFY_TYPE: /* always send these responses if we can */ case NOTIFY_ACK_TYPE: case ENABLE_LUN_TYPE: - case MODIFY_LUN_TYPE: + case MODIFY_LUN_TYPE: DEBUG4(printk(KERN_WARNING "qla2x00_response_pkt: " "calling tgt_response_pkt %p " @@ -1550,10 +1550,10 @@ qla24xx_process_response_queue(struct scsi_qla_host *ha) pkt->entry_type);); if (qla_target.tgt_response_pkt) { - qla_target.tgt_response_pkt(ha, + qla_target.tgt_response_pkt(ha, (sts_entry_t *)pkt); } - break; + break; #endif /* FC_TARGET_SUPPORT */ default: /* Type Not Supported. */ diff --git a/qla2x00t/qla_os.c b/qla2x00t/qla_os.c index 5877ca050..149fcdaa0 100644 --- a/qla2x00t/qla_os.c +++ b/qla2x00t/qla_os.c @@ -804,7 +804,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) "%s: failed while waiting for commands\n", __func__); } else { qla_printk(KERN_INFO, ha, - "scsi(%ld:%d:%d): DEVICE RESET SUCCEEDED.\n", + "scsi(%ld:%d:%d): DEVICE RESET SUCCEEDED.\n", ha->host_no, id, lun); } @@ -1680,7 +1680,7 @@ void qla2x00_remove_one(struct pci_dev *pdev) #if defined(FC_TARGET_SUPPORT) ha->flags.host_shutting_down = 1; - if (qla_target.tgt_host_action != NULL) + if (qla_target.tgt_host_action != NULL) qla_target.tgt_host_action(ha, DISABLE_TARGET_MODE); #endif diff --git a/qla_isp/common/isp.c b/qla_isp/common/isp.c index 6caa330ef..4ade866d4 100644 --- a/qla_isp/common/isp.c +++ b/qla_isp/common/isp.c @@ -2,17 +2,17 @@ /*- * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ @@ -530,7 +530,7 @@ isp_reset(ispsoftc_t *isp) if ((val & BIU2400_DMA_ACTIVE) == 0) { break; } - } + } if (val & BIU2400_DMA_ACTIVE) { ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "DMA Failed to Stop on Reset"); @@ -624,7 +624,7 @@ isp_reset(ispsoftc_t *isp) ISP_WRITE(isp, BIU_SEMA, 0); } - + /* * Post-RISC Reset stuff. */ @@ -851,7 +851,7 @@ isp_reset(ispsoftc_t *isp) break; } ptr += ptr[3]; - } + } isp->isp_loaded_fw = 1; } else if (dodnld && IS_23XX(isp)) { const uint16_t *ptr = isp->isp_mdvec->dv_ispfw; @@ -874,7 +874,7 @@ isp_reset(ispsoftc_t *isp) while (wi < ptr[3]) { uint16_t *cp; uint32_t nw; - + nw = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)) >> 1; if (nw > wl) { nw = wl; @@ -1071,7 +1071,7 @@ isp_reset(ispsoftc_t *isp) isp->isp_fwrev[1] = 37; #endif isp->isp_fwrev[2] = 0; - } + } } else { isp->isp_fwrev[0] = mbs.param[1]; isp->isp_fwrev[1] = mbs.param[2]; @@ -1640,7 +1640,7 @@ isp_fibre_init(ispsoftc_t *isp) /* * Right now we just set extended options to prefer point-to-point * over loop based upon some soft config options. - * + * * NB: for the 2300, ICBOPT_EXTENDED is required. */ if (IS_2200(isp) || IS_23XX(isp)) { @@ -2331,7 +2331,7 @@ isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, msg = buf; break; case PLOGX_IOCBERR_PORTUSED: - lev = ISP_LOGSANCFG|ISP_LOGDEBUG0; + lev = ISP_LOGSANCFG|ISP_LOGDEBUG0; SNPRINTF(buf, sizeof (buf), "already logged in with N-Port handle 0x%x", parm1); msg = buf; @@ -3306,7 +3306,7 @@ isp_scan_loop(ispsoftc_t *isp, int chan) "Valid", chan, tmp.portid, tmp.handle); break; } - + /* * We can wipe out the old handle value * here because it's no longer valid. @@ -3387,7 +3387,7 @@ isp_scan_loop(ispsoftc_t *isp, int chan) */ /* - * Take less than half of our scratch area to store Port IDs + * Take less than half of our scratch area to store Port IDs */ #define GIDLEN ((ISP_FC_SCRLEN >> 1) - 16 - SNS_GID_FT_REQ_SIZE) #define NGENT ((GIDLEN - 16) >> 2) @@ -3856,10 +3856,10 @@ isp_scan_fabric(ispsoftc_t *isp, int chan) /* * Try to re-login to this device using a * new handle. If that fails, mark it dead. - * + * * isp_login_device will check for handle and * portid consistency after re-login. - * + * */ if (isp_login_device(isp, chan, portid, &pdb, &oldhandle)) { @@ -3932,7 +3932,7 @@ isp_scan_fabric(ispsoftc_t *isp, int chan) * with the same port id. While we're at it, mark where the * last free entry was. */ - + dbidx = MAX_FC_TARG; for (lp = fcp->portdb; lp < &fcp->portdb[MAX_FC_TARG]; lp++) { if (lp >= &fcp->portdb[FL_ID] && @@ -5865,7 +5865,7 @@ isp_parse_async(ispsoftc_t *isp, uint16_t mbox) break; } handle = - (ISP_READ(isp, OUTMAILBOX2) << 16) | + (ISP_READ(isp, OUTMAILBOX2) << 16) | (ISP_READ(isp, OUTMAILBOX1)); if (isp_target_async(isp, handle, mbox)) { rval = -1; @@ -6736,7 +6736,7 @@ isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, case RQCS_DATA_UNDERRUN: ru_marked = (sp->req_scsi_status & RQCS_RU) != 0; /* - * We can get an underrun w/o things being marked + * We can get an underrun w/o things being marked * if we got a non-zero status. */ sv_marked = (sp->req_scsi_status & (RQCS_SV|RQCS_RV)) != 0; @@ -7265,7 +7265,7 @@ static const uint32_t mbpfc[] = { /* * Footnotes * - * (1): this sets bits 21..16 in mailbox register #8, which we nominally + * (1): this sets bits 21..16 in mailbox register #8, which we nominally * do not access at this time in the core driver. The caller is * responsible for setting this register first (Gross!). The assumption * is that we won't overflow. @@ -7866,7 +7866,7 @@ isp_setdfltsdparm(ispsoftc_t *isp) return; } } - + } MEMZERO(&mbs, sizeof (mbs)); mbs.param[0] = MBOX_GET_ACT_NEG_STATE; @@ -8127,13 +8127,13 @@ isp_read_nvram_2400(ispsoftc_t *isp, uint8_t *nvram_data) { int retval = 0; uint32_t addr, csum, lwrds, *dptr; - + if (isp->isp_port) { addr = ISP2400_NVRAM_PORT1_ADDR; } else { addr = ISP2400_NVRAM_PORT0_ADDR; } - + dptr = (uint32_t *) nvram_data; for (lwrds = 0; lwrds < ISP2400_NVRAM_SIZE >> 2; lwrds++) { isp_rd_2400_nvram(isp, addr++, dptr++); @@ -8173,7 +8173,7 @@ isp_rdnvram_word(ispsoftc_t *isp, int wo, uint16_t *rp) USEC_DELAY(10); if (IS_FC(isp)) { - wo &= ((ISP2100_NVRAM_SIZE >> 1) - 1); + wo &= ((ISP2100_NVRAM_SIZE >> 1) - 1); if (IS_2312(isp) && isp->isp_port) { wo += 128; } @@ -8582,7 +8582,7 @@ isp_parse_nvram_2100(ispsoftc_t *isp, uint8_t *nvram_data) fcp->isp_loopid = ISP2100_NVRAM_HARDLOOPID(nvram_data); } if ((isp->isp_confopts & ISP_CFG_OWNEXCTHROTTLE) == 0) { - DEFAULT_EXEC_THROTTLE(isp) = + DEFAULT_EXEC_THROTTLE(isp) = ISP2100_NVRAM_EXECUTION_THROTTLE(nvram_data); } fcp->isp_fwoptions = ISP2100_NVRAM_OPTIONS(nvram_data); @@ -8667,7 +8667,7 @@ isp_parse_nvram_2400(ispsoftc_t *isp, uint8_t *nvram_data) fcp->isp_loopid = ISP2400_NVRAM_HARDLOOPID(nvram_data); } if ((isp->isp_confopts & ISP_CFG_OWNEXCTHROTTLE) == 0) { - DEFAULT_EXEC_THROTTLE(isp) = + DEFAULT_EXEC_THROTTLE(isp) = ISP2400_NVRAM_EXECUTION_THROTTLE(nvram_data); } fcp->isp_fwoptions = ISP2400_NVRAM_FIRMWARE_OPTIONS1(nvram_data); diff --git a/qla_isp/common/isp_library.c b/qla_isp/common/isp_library.c index bc0c043f1..bca43bfa1 100644 --- a/qla_isp/common/isp_library.c +++ b/qla_isp/common/isp_library.c @@ -2,17 +2,17 @@ /*- * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -1392,7 +1392,7 @@ isp_put_sns_request(ispsoftc_t *isp, sns_screq_t *src, sns_screq_t *dst) for (i = 0; i < nw; i++) { ISP_IOXPUT_16(isp, src->snscb_data[i], &dst->snscb_data[i]); } - + } void diff --git a/qla_isp/common/isp_library.h b/qla_isp/common/isp_library.h index 06b4db069..2bda0a104 100644 --- a/qla_isp/common/isp_library.h +++ b/qla_isp/common/isp_library.h @@ -2,17 +2,17 @@ /*- * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ #ifndef _ISP_LIBRARY_H diff --git a/qla_isp/common/isp_stds.h b/qla_isp/common/isp_stds.h index 211cc3af3..94b6a6ca6 100644 --- a/qla_isp/common/isp_stds.h +++ b/qla_isp/common/isp_stds.h @@ -2,17 +2,17 @@ /*- * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* diff --git a/qla_isp/common/isp_target.c b/qla_isp/common/isp_target.c index ed2afcc15..1821ffeab 100644 --- a/qla_isp/common/isp_target.c +++ b/qla_isp/common/isp_target.c @@ -2,17 +2,17 @@ /*- * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -459,7 +459,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp) return (rval); } - + /* * Toggle (on/off) target mode for bus/target/lun. * @@ -978,7 +978,7 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep) tmd_notify_t nt; static const char f1[] = "%s from PortID 0x%06x lun %d seq 0x%08x%08x"; - static const char f2[] = + static const char f2[] = "unknown Task Flag 0x%x lun %d PortID 0x%x tag 0x%08x%08x"; uint16_t chan; uint32_t sid, did; diff --git a/qla_isp/common/isp_target.h b/qla_isp/common/isp_target.h index 4018b9d7b..672251222 100644 --- a/qla_isp/common/isp_target.h +++ b/qla_isp/common/isp_target.h @@ -2,17 +2,17 @@ /*- * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* diff --git a/qla_isp/common/isp_tpublic.h b/qla_isp/common/isp_tpublic.h index fd3c2c97e..d5f713b67 100644 --- a/qla_isp/common/isp_tpublic.h +++ b/qla_isp/common/isp_tpublic.h @@ -2,17 +2,17 @@ /*- * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as * published by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -349,7 +349,7 @@ typedef struct tmd_xact { * The cd_xact tag is the first or only transaction structure related to this command. * * The tag cd_lreserved, cd_hreserved are scratch areas for use for the outer and inner layers respectively. - * + * */ #ifndef TMD_CDBLEN diff --git a/qla_isp/common/ispmbox.h b/qla_isp/common/ispmbox.h index 9f3cc9fb4..39acdd327 100644 --- a/qla_isp/common/ispmbox.h +++ b/qla_isp/common/ispmbox.h @@ -2,17 +2,17 @@ /*- * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -399,7 +399,7 @@ typedef struct { uint16_t mrk_lun; uint8_t mrk_reserved1[48]; } isp_marker_t; - + typedef struct { isphdr_t mrk_header; uint32_t mrk_handle; @@ -412,7 +412,7 @@ typedef struct { uint8_t mrk_lun[8]; uint8_t mrk_reserved3[40]; } isp_marker_24xx_t; - + #define SYNC_DEVICE 0 #define SYNC_TARGET 1 @@ -666,7 +666,7 @@ typedef struct { uint8_t req_rsp_sense[28]; } isp24xx_statusreq_t; -/* +/* * For Qlogic 2X00, the high order byte of SCSI status has * additional meaning. */ @@ -719,7 +719,7 @@ typedef struct { ispds64_t ms_dataseg[2]; } isp_ms_t; -/* +/* * Completion Status Codes. */ #define RQCS_COMPLETE 0x0000 @@ -771,7 +771,7 @@ typedef struct { /* - * 1X00 specific State Flags + * 1X00 specific State Flags */ #define RQSF_GOT_BUS 0x0100 #define RQSF_GOT_TARGET 0x0200 @@ -952,7 +952,7 @@ typedef struct { #define ICBXOPT_RIO_32BIT 2 #define ICBXOPT_RIO_16BIT_IOCB 3 #define ICBXOPT_RIO_32BIT_IOCB 4 -#define ICBXOPT_ZIO 5 +#define ICBXOPT_ZIO 5 #define ICBXOPT_TIMER_MASK 0x7 #define ICBZOPT_RATE_MASK 0xC000 @@ -1045,7 +1045,7 @@ typedef struct { uint16_t icb_prqstqlen; uint16_t icb_rqstaddr[4]; uint16_t icb_respaddr[4]; - uint16_t icb_priaddr[4]; + uint16_t icb_priaddr[4]; uint16_t icb_reserved1[4]; uint16_t icb_atio_in; uint16_t icb_atioqlen; @@ -1619,14 +1619,14 @@ typedef struct { typedef struct { uint16_t handle; uint16_t lun; - uint32_t + uint32_t channel : 8, portid : 24; uint32_t timeout; union { struct { uint32_t data_length; - uint32_t + uint32_t no_wait : 1, do_read : 1; uint8_t cdb[16]; diff --git a/qla_isp/common/ispreg.h b/qla_isp/common/ispreg.h index f35b767c2..da2b0aeff 100644 --- a/qla_isp/common/ispreg.h +++ b/qla_isp/common/ispreg.h @@ -2,17 +2,17 @@ /*- * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -374,7 +374,7 @@ /* * 2400 Interface Offsets and Register Definitions - * + * * The 2400 looks quite different in terms of registers from other QLogic cards. * It is getting to be a genuine pain and challenge to keep the same model * for all. @@ -476,7 +476,7 @@ #define OUTMAILBOX7 (MBOX_BLOCK+0xE) /* - * Strictly speaking, it's + * Strictly speaking, it's * SCSI && 2100 : 8 MBOX registers * 2200: 24 MBOX registers * 2300/2400: 32 MBOX registers diff --git a/qla_isp/common/ispvar.h b/qla_isp/common/ispvar.h index cdd3c28b8..514f86240 100644 --- a/qla_isp/common/ispvar.h +++ b/qla_isp/common/ispvar.h @@ -2,17 +2,17 @@ /*- * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -212,7 +212,7 @@ typedef struct { uint8_t isp_retry_count; uint8_t isp_retry_delay; struct { - uint32_t + uint32_t exc_throttle : 8, : 1, dev_enable : 1, /* ignored */ @@ -318,7 +318,7 @@ typedef struct { * from 0..MAX_FC_TARG that is used to index into the isp_ini_map array. If * the value therein is non-zero, then that value minus one is used to index * into the Port Database to find the handle for forming commands. There is - * back-index minus one value within to Port Database entry that tells us + * back-index minus one value within to Port Database entry that tells us * which entry in isp_ini_map points to us (to avoid searching). * * Local loop devices the firmware automatically performs PLOGI on for us @@ -1013,7 +1013,7 @@ void isp_async(ispsoftc_t *, ispasync_t, ...); * * GET_DEFAULT_ROLE(ispsoftc_t *, int) Get Default Role for a channel * SET_DEFAULT_ROLE(ispsoftc_t *, int, int) Set Default Role for a channel - * DEFAULT_IID(ispsoftc_t *, int) Default SCSI initiator ID + * DEFAULT_IID(ispsoftc_t *, int) Default SCSI initiator ID * DEFAULT_LOOPID(ispsoftc_t *, int) Default FC Loop ID * * These establish reasonable defaults for each platform. diff --git a/qla_isp/firmware/asm_1000.h b/qla_isp/firmware/asm_1000.h index 24765adfd..7c049d193 100644 --- a/qla_isp/firmware/asm_1000.h +++ b/qla_isp/firmware/asm_1000.h @@ -23,7 +23,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ #ifndef ISP_TARGET_MODE /* diff --git a/qla_isp/firmware/asm_1040.h b/qla_isp/firmware/asm_1040.h index 4ecc82e62..2c0b575e3 100644 --- a/qla_isp/firmware/asm_1040.h +++ b/qla_isp/firmware/asm_1040.h @@ -23,7 +23,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /************************************************************************ * * diff --git a/qla_isp/firmware/asm_1080.h b/qla_isp/firmware/asm_1080.h index 1e7042476..fc12560b1 100644 --- a/qla_isp/firmware/asm_1080.h +++ b/qla_isp/firmware/asm_1080.h @@ -23,7 +23,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ #ifndef ISP_TARGET_MODE /************************************************************************ diff --git a/qla_isp/firmware/asm_12160.h b/qla_isp/firmware/asm_12160.h index 0d02df910..7be429f94 100644 --- a/qla_isp/firmware/asm_12160.h +++ b/qla_isp/firmware/asm_12160.h @@ -23,7 +23,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /************************************************************************ * * diff --git a/qla_isp/firmware/asm_2100.h b/qla_isp/firmware/asm_2100.h index bf45fb043..6387149fd 100644 --- a/qla_isp/firmware/asm_2100.h +++ b/qla_isp/firmware/asm_2100.h @@ -23,7 +23,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /* * Some very early boards have problems loading firmware that is larger than diff --git a/qla_isp/firmware/asm_2200.h b/qla_isp/firmware/asm_2200.h index fec0bcd19..cd9a77a24 100644 --- a/qla_isp/firmware/asm_2200.h +++ b/qla_isp/firmware/asm_2200.h @@ -23,7 +23,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /************************************************************************ * * diff --git a/qla_isp/firmware/asm_2300.h b/qla_isp/firmware/asm_2300.h index 26ba1d233..a8e991eb4 100644 --- a/qla_isp/firmware/asm_2300.h +++ b/qla_isp/firmware/asm_2300.h @@ -23,7 +23,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /************************************************************************ * * diff --git a/qla_isp/firmware/asm_2322.h b/qla_isp/firmware/asm_2322.h index a152873b9..bc5a7d23e 100644 --- a/qla_isp/firmware/asm_2322.h +++ b/qla_isp/firmware/asm_2322.h @@ -23,7 +23,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /************************************************************************ * * diff --git a/qla_isp/firmware/asm_2400.h b/qla_isp/firmware/asm_2400.h index d2d78433c..68782a522 100644 --- a/qla_isp/firmware/asm_2400.h +++ b/qla_isp/firmware/asm_2400.h @@ -23,7 +23,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /************************************************************************ * * diff --git a/qla_isp/linux/exioct.h b/qla_isp/linux/exioct.h index c4bd9a22f..44c494812 100644 --- a/qla_isp/linux/exioct.h +++ b/qla_isp/linux/exioct.h @@ -35,15 +35,15 @@ * Rev. 1 March 2, 2000 * RLU - Updated with latest definitions. Added more comments. * - * Rev. 2 May 16, 2000 + * Rev. 2 May 16, 2000 * SP - Updated definitions and changed structures (March 27, 2000) - * SP - Addded structures + * SP - Addded structures * - * Rev. 3 June 1, 2000 + * Rev. 3 June 1, 2000 * THL - Made major changes to include all changes talked in our meeting. * * Rev. 4 June 5, 2000 - * RLU - Added new definitions/structures for SDM_GET_AEN and SDM_REG_AEN + * RLU - Added new definitions/structures for SDM_GET_AEN and SDM_REG_AEN * functions. * - Major definition/structure name changes as discussed in meetings. * - Deleted duplicated command code and structure definitions. @@ -68,7 +68,7 @@ * Rev. 4.5 August 15, 2000 * SP - Rolled back some changes made by Todd R. * Kept new status code SDM_STATUS_NO_MEMORY - * Port types fabric and tape device + * Port types fabric and tape device * * Rev. 4.7 Sep 6, 2000 * YPL - Replace SDM_ with EXT_, _ISP with _CHIP. @@ -89,7 +89,7 @@ * * Rev. 5.3 Sep 29, 2000 * THL - Add access mode for NVRAM. - * + * * Rev. 5.4 Oct 03, 2000 * THL - Add EXT_SC_GET_FC_STATISTICS. * @@ -109,55 +109,55 @@ * * Rev. 5.8 Oct 25, 2000 * BN - Added EXT_CC_DRIVER_PROP define - * + * * Rev. 5.9 Oct 26, 2000 * BN - Sync with UnixApi project - * + * * Rev. 5.10 Oct 30, 2000 * BN - Remove not needed #define for EXT_CC_DRIVER_PROP * - Add EXT_ to IS_LUN_BIT_SET, SET_LUN_BIT, CLR_LUN_BIT - * + * * Rev. 5.11 Nov 1, 2000 * BN - Increased [1] of EXT_DEVICEDATA to [EXT_MAX_TARGET] * TLE - Decreased [EXT_MAX_TARGET] of EXT_DEVICEDATA to [1] - * + * * Rev. 5.12 Nov 7, 2000 * RLU - Deleted EXT_DEF_MAX_LUNS define and changed all references * to it to use EXT_MAX_LUN. * - Changed the revision numbers for the last 2 revisions down * to use 5.x. - * + * * Rev. 5.13 Nov 14, 2000 * WTR - Fixed pointer referencing problem in the LUN_BIT_MASK macros. * Updated comment at bit mask definition. * * Rev. 5.14 Dec 6, 2000 * THL - Added Local and LoopID to discovered port/target property. - * + * * Rev. 5.15 Dec 24, 2000 * YPL - Enhance port connection modes and driver attrib - * + * * Rev. 5.16 Dec 27, 2000 * TLE - Add BufferHandle member to _EXT_ASYNC_EVENT data structure for * SCTP support - * + * * Rev. 5.17 Jan 10, 2001 * YPL - Add edtov, ratov & fabric name in port property - * + * * Rev. 5.18 Feb 28, 2001 * YPL - Remove SCTP fields and add fabric parameter flags in port property - * + * * Rev. 5.19 Mar 08, 2001 * YPL - Remove SCTP fields from hba port prop - * + * * Rev. 5.20 June 11, 2001 * YPL - Change to reserved fields and add fabric name field in port property - * + * * Rev. 5.21 June 29, 2001 * YPL - Merge in changes decided long time ago (use _DEF_ for defines) & * reserved some EXT_CC for legacy ioctls, plus add RNID dataformat * values definition - * + * * Rev. 5.21 Sep 18, 2001 * SP - Added New return status codes * @@ -412,14 +412,14 @@ typedef struct { /* Reserved command codes. */ -#define EXT_CC_RESERVED0A EXT_CC_RESERVED0A_OS -#define EXT_CC_RESERVED0B EXT_CC_RESERVED0B_OS -#define EXT_CC_RESERVED0C EXT_CC_RESERVED0C_OS -#define EXT_CC_RESERVED0D EXT_CC_RESERVED0D_OS -#define EXT_CC_RESERVED0E EXT_CC_RESERVED0E_OS -#define EXT_CC_RESERVED0F EXT_CC_RESERVED0F_OS -#define EXT_CC_RESERVED0G EXT_CC_RESERVED0G_OS -#define EXT_CC_RESERVED0H EXT_CC_RESERVED0H_OS +#define EXT_CC_RESERVED0A EXT_CC_RESERVED0A_OS +#define EXT_CC_RESERVED0B EXT_CC_RESERVED0B_OS +#define EXT_CC_RESERVED0C EXT_CC_RESERVED0C_OS +#define EXT_CC_RESERVED0D EXT_CC_RESERVED0D_OS +#define EXT_CC_RESERVED0E EXT_CC_RESERVED0E_OS +#define EXT_CC_RESERVED0F EXT_CC_RESERVED0F_OS +#define EXT_CC_RESERVED0G EXT_CC_RESERVED0G_OS +#define EXT_CC_RESERVED0H EXT_CC_RESERVED0H_OS #define EXT_CC_RESERVED0I EXT_CC_RESERVED0I_OS #define EXT_CC_RESERVED0J EXT_CC_RESERVED0J_OS #define EXT_CC_RESERVED0Z EXT_CC_RESERVED0Z_OS @@ -474,8 +474,8 @@ typedef struct { #define EXT_SC_GET_DR_DUMP_BUF 5 /* Currently Not Supported */ #define EXT_SC_GET_RISC_CODE 6 /* Currently Not Supported */ #define EXT_SC_GET_FLASH_RAM 7 /* for backward compatible */ -#define EXT_SC_GET_BEACON_STATE 8 -#define EXT_SC_GET_FC4_STATISTICS 9 +#define EXT_SC_GET_BEACON_STATE 8 +#define EXT_SC_GET_FC4_STATISTICS 9 #define EXT_SC_GET_LUN_BY_Q 10 /* 100 - 199 FC_INTF_TYPE */ @@ -487,7 +487,7 @@ typedef struct { #define EXT_SC_GET_PORT_SUMMARY 106 #define EXT_SC_GET_POSITION_MAP 107 #define EXT_SC_GET_RETRY_CNT 108 /* Currently Not Supported */ -#define EXT_SC_GET_RNID 109 +#define EXT_SC_GET_RNID 109 #define EXT_SC_GET_RTIN 110 /* Currently Not Supported */ #define EXT_SC_GET_FC_LUN_BITMASK 111 #define EXT_SC_GET_FC_STATISTICS 112 /* for backward compatible */ @@ -496,7 +496,7 @@ typedef struct { #define EXT_SC_GET_SEL_TIMEOUT 201 /* Currently Not Supported */ -/* +/* * Sub codes for Set Data. * Use in combination with EXT_SET_DATA as the ioctl code */ @@ -507,7 +507,7 @@ typedef struct { /* 100 - 199 FC_INTF_TYPE */ #define EXT_SC_SET_LUN_BITMASK 103 -#define EXT_SC_SET_RNID 109 +#define EXT_SC_SET_RNID 109 #define EXT_SC_SET_FC_LUN_BITMASK 111 #define EXT_SC_RESERVED_BC112 112 #define EXT_SC_RESERVED_BC113 113 @@ -638,9 +638,9 @@ typedef struct _EXT_DISC_PORT { UINT16 TargetId; /* 2 */ UINT8 Local; /* 1; Local or Remote */ UINT8 ReservedByte[1]; /* 1 */ - + UINT16 LoopID; /* 2; Loop ID */ - + UINT32 Reserved[7]; /* 28 */ } EXT_DISC_PORT, *PEXT_DISC_PORT; /* 60 */ @@ -662,9 +662,9 @@ typedef struct _EXT_DISC_TARGET { UINT8 Local; /* 1; Local or Remote */ UINT8 ReservedByte[1]; /* 1 */ - + UINT16 LoopID; /* 2; Loop ID */ - + UINT16 Reserved[13]; /* 26 */ } EXT_DISC_TARGET, *PEXT_DISC_TARGET; /* 60 */ @@ -945,7 +945,7 @@ typedef struct _EXT_DEVICEDATAENTRY EXT_SCSI_ADDR TargetAddress; /* scsi address */ UINT32 DeviceFlags; /* Flags for device */ UINT16 LoopID; /* Loop ID */ - UINT16 BaseLunNumber; + UINT16 BaseLunNumber; UINT32 Reserved[32]; } EXT_DEVICEDATAENTRY, *PEXT_DEVICEDATAENTRY; @@ -1068,7 +1068,7 @@ typedef struct _EXT_ELS_PT_REQ { typedef struct _EXT_BEACON_CONTROL { UINT32 State; /* 4 */ - UINT32 Reserved[3]; /* 12 */ + UINT32 Reserved[3]; /* 12 */ } EXT_BEACON_CONTROL , *PEXT_BEACON_CONTROL ; /* 16 */ #ifndef EXTERNAL_LUN_COUNT diff --git a/qla_isp/linux/exioctln.h b/qla_isp/linux/exioctln.h index 2ab01ec01..f0b3dc3ec 100644 --- a/qla_isp/linux/exioctln.h +++ b/qla_isp/linux/exioctln.h @@ -75,41 +75,41 @@ Rev 12 January 20, 2003 RL - Added EXT_DEF_USE_HBASELECT definition for use by the SETINSTANCE command. - + Rev 11 December 10, 2002 RL - Added EXT_CC_SEND_ELS_PASSTHRU_OS definition. - + Rev 10 October 26, 2001 RL - Corrected MAX_HBA, MAX_TARGET and MAX_LUN values to 255. - + Rev 9 July 26, 2001 RL - Added definition of signed types. - + Rev 8 July 05, 2001 RL - Redefined ioctl command values. - + Rev 7 Nov 06, 2000 BN - Added EXT_DEF_MAX_AEN_QUEUE_OS define - Added define for handle_hba_t - + Rev 6 Oct 25, 2000 BN - Added EXT_CC_DRIVER_PROP_OS define - + Rev 5 Oct 25, 2000 BN - Redo the copyright header and add AEN details - + Rev 4 Oct 23, 2000 BN - Added definition for BOOLEAN - + Rev 3 Oct 23, 2000 BN - Added definitions for EXT_ADDR_MODE_OS and also include of - + Rev 2 Oct 18, 2000 BN - Enable API Exention support - + Rev 1 Original version Sep 7, 2000 BN - + */ @@ -225,7 +225,7 @@ /*************************************************************** * These are regular/external command codes, starting from 0. * The regular command code end index must be updated whenever - * adding new commands. + * adding new commands. ***************************************************************/ #define EXT_DEF_LN_REG_CC_START_IDX 0x00 /* reg cmd start index */ diff --git a/qla_isp/linux/isp_cb_ops.c b/qla_isp/linux/isp_cb_ops.c index b97ad4533..bb1b80134 100644 --- a/qla_isp/linux/isp_cb_ops.c +++ b/qla_isp/linux/isp_cb_ops.c @@ -2,17 +2,17 @@ /* * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -64,7 +64,7 @@ #ifdef CONFIG_PROC_FS /* - * 'safe' proc pretty print code + * 'safe' proc pretty print code */ struct info_str { char *buffer; @@ -215,7 +215,7 @@ isplinux_proc_info(struct Scsi_Host *shp, char *buf, char **st, off_t off, int l info.length = len; info.offset = off; info.pos = 0; - + copy_info(&info, (char *)isplinux_info(isp->isp_host)); #ifdef HBA_VERSION copy_info(&info, "\n HBA Version %s, built %s, %s", HBA_VERSION, __DATE__, __TIME__); @@ -903,7 +903,7 @@ isp_exti_setinstance(EXT_IOCTL *ext) api_channel = 0; /* XXXXXXXXXXXXXXXXXXXXXXX */ return (0); } - + static int isp_exti_query(EXT_IOCTL *pext) { @@ -1975,7 +1975,7 @@ isp_perf_test(ispsoftc_t *isp, isp_perftst_t *tt) ISP_LOCKU_SOFTC(isp); ISP_DMAFREE(isp, Cmnd, handle); isp_destroy_handle(isp, handle); - } + } ISP_UNLKU_SOFTC(isp); } out: diff --git a/qla_isp/linux/isp_ioctl.h b/qla_isp/linux/isp_ioctl.h index 78a1f3bfb..0ea6377d8 100644 --- a/qla_isp/linux/isp_ioctl.h +++ b/qla_isp/linux/isp_ioctl.h @@ -2,17 +2,17 @@ /* * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* diff --git a/qla_isp/linux/isp_linux.c b/qla_isp/linux/isp_linux.c index 369bf6340..fa55139a6 100644 --- a/qla_isp/linux/isp_linux.c +++ b/qla_isp/linux/isp_linux.c @@ -2,17 +2,17 @@ /* * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -341,7 +341,7 @@ static inline void isplinux_flushwaitq(ispsoftc_t *isp) { Scsi_Cmnd *Cmnd, *Ncmnd; - + if ((Cmnd = isp->isp_osinfo.wqnext) == NULL) { return; } @@ -2136,7 +2136,7 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep) fcportdb_t *lp; fcparam *fcp; tmd_cmd_t *tmd; - + isp->isp_osinfo.cmds_started++; tattr = aep->at_ta_len >> 12; iulen = aep->at_ta_len & 0xffffff; @@ -3851,7 +3851,7 @@ isplinux_default_wwn(ispsoftc_t *isp, int chan, int isactive, int iswwnn) * The type 2 NAA fields for QLogic cards appear be laid out thusly: * * bits 63..60 NAA == 2 - * bits 59..57 unused/zero + * bits 59..57 unused/zero * bit 56 port (1) or node (0) WWN distinguishor * bit 48 physical port on dual-port chips (23XX/24XX) * @@ -4034,7 +4034,7 @@ isp_parse_rolearg(ispsoftc_t *isp, int chan, char *roles) while (role && *role) { unsigned int id; char *eqtok, *commatok, *p, *q; - + eqtok = role; eqtok = strchr(role, '='); if (eqtok == NULL) { @@ -4109,7 +4109,7 @@ isp_parse_wwnarg(ispsoftc_t *isp, int chan, char *wwns) unsigned int id; int thischan; char *eqtok, *commatok, *colontok, *wwnstart, *p, *q; - + eqtok = wwnt; eqtok = strchr(wwnt, '='); if (eqtok == NULL) { @@ -4210,7 +4210,7 @@ isplinux_common_init(ispsoftc_t *isp) if (isp_fcduplex & (1 << isp->isp_unit)) { isp->isp_confopts |= ISP_CFG_FULL_DUPLEX; } - isp->isp_osinfo.host->max_id = MAX_FC_TARG; + isp->isp_osinfo.host->max_id = MAX_FC_TARG; isp->isp_osinfo.host->max_cmd_len = 16; for (chan = 0; chan < isp->isp_nchan; chan++) { @@ -4326,13 +4326,13 @@ isplinux_reinit(ispsoftc_t *isp) if (isp->isp_state != ISP_RESETSTATE) { isp_prt(isp, ISP_LOGERR, "failed to enter RESET state"); return (-1); - } + } /* * Until the midlayer starts using REPORT LUNS to dertermine how many * luns there are for SCSI-3 devices and sets a reasonable limit for * SCSI-2 devices, we'll follow this ruleset: - * + * * If our isp_maxluns parameter is unchanged from its default, we * limit ourselves to 8 luns for parallel SCSI, 256 for FC-SCSI. * diff --git a/qla_isp/linux/isp_linux.h b/qla_isp/linux/isp_linux.h index eb949d263..2029a1c33 100644 --- a/qla_isp/linux/isp_linux.h +++ b/qla_isp/linux/isp_linux.h @@ -2,17 +2,17 @@ /* * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -61,7 +61,7 @@ //#define DISABLE_FW_LOADER 1 //#define ISP_DISABLE_1080_SUPPORT 1 -//#define ISP_DISABLE_12160_SUPPORT 1 +//#define ISP_DISABLE_12160_SUPPORT 1 //#define ISP_DISABLE_2100_SUPPORT 1 //#define ISP_DISABLE_2200_SUPPORT 1 //#define ISP_DISABLE_2300_SUPPORT 1 @@ -653,7 +653,7 @@ static inline void mbox_wait_complete(ispsoftc_t *, mbreg_t *); int isplinux_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); const char *isplinux_info(struct Scsi_Host *); int isplinux_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *)); -int isplinux_biosparam(struct scsi_device *, struct block_device *, sector_t, int[]); +int isplinux_biosparam(struct scsi_device *, struct block_device *, sector_t, int[]); int isplinux_get_default_id(ispsoftc_t *, int); int isplinux_get_default_role(ispsoftc_t *, int); void isplinux_set_default_role(ispsoftc_t *, int, int); @@ -868,7 +868,7 @@ static inline int fc_scratch_acquire(ispsoftc_t *isp, int chan) { if (ISP_DATA(isp, chan)->scratch_busy) { - return (-1); + return (-1); } ISP_DATA(isp, chan)->scratch_busy = 1; return (0); diff --git a/qla_isp/linux/isp_pci.c b/qla_isp/linux/isp_pci.c index f92e89c56..9b289bac6 100644 --- a/qla_isp/linux/isp_pci.c +++ b/qla_isp/linux/isp_pci.c @@ -2,17 +2,17 @@ /* * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -402,7 +402,7 @@ void unmap_pci_mem(struct isp_pcisoftc *isp_pci, unsigned long size) } } -static __inline int +static __inline int map_isp_mem(struct isp_pcisoftc *isp_pci, u_short cmd, vm_offset_t mem_base) { if (cmd & PCI_COMMAND_MEMORY) { @@ -414,7 +414,7 @@ map_isp_mem(struct isp_pcisoftc *isp_pci, u_short cmd, vm_offset_t mem_base) return (0); } -static __inline int +static __inline int map_isp_io(struct isp_pcisoftc *isp_pci, u_short cmd, vm_offset_t io_base) { if ((cmd & PCI_COMMAND_IO) && (io_base & 3) == 1) { @@ -723,7 +723,7 @@ isplinux_pci_init_one(struct Scsi_Host *host) isp->isp_type = ISP_HA_SCSI_UNKNOWN; if (isp->isp_mdvec->dv_ispfw == NULL) fwname = "ql1020_fw.bin"; - } + } #endif #ifndef ISP_DISABLE_1080_SUPPORT if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1080) { @@ -1592,7 +1592,7 @@ static int tdma_mkfc(ispsoftc_t *, tmd_xact_t *, ct2_entry_t *, uint32_t *, uint /* * We need to handle DMA for target mode differently from initiator mode. - * + * * DMA mapping and construction and submission of CTIO Request Entries * and rendevous for completion are very tightly coupled because we start * out by knowing (per platform) how much data we have to move, but we @@ -1605,7 +1605,7 @@ static int tdma_mkfc(ispsoftc_t *, tmd_xact_t *, ct2_entry_t *, uint32_t *, uint * for the DMA mapping routines comes here instead with a pointer to a * partially filled in already allocated request queue entry. */ - + static int tdma_mk(ispsoftc_t *isp, tmd_xact_t *xact, ct_entry_t *cto, uint32_t *nxtip, uint32_t optr) { @@ -1915,7 +1915,7 @@ tdma_mk_2400(ispsoftc_t *isp, tmd_xact_t *xact, ct7_entry_t *cto, uint32_t *nxti int nseg, seg, ovseg, seglim, new_seg_cnt; #ifdef ALLOW_SYNTHETIC_CTIO ct7_entry_t *cto2 = NULL, ct2; -#endif +#endif nxti = *nxtip; curi = isp->isp_reqidx; @@ -2214,13 +2214,13 @@ tdma_mkfc(ispsoftc_t *isp, tmd_xact_t *xact, ct2_entry_t *cto, uint32_t *nxtip, int nseg, seg, ovseg, seglim, new_seg_cnt; #ifdef ALLOW_SYNTHETIC_CTIO ct2_entry_t *cto2 = NULL, ct2; -#endif +#endif nxti = *nxtip; curi = isp->isp_reqidx; qe = ISP_QUEUE_ENTRY(isp->isp_rquest, curi); - + if (cto->ct_flags & CT2_SENDSTATUS) { int level; if ((cto->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) { @@ -3210,7 +3210,7 @@ isp_pci_reset1(ispsoftc_t *isp) static void isp_pci_dumpregs(ispsoftc_t *isp, const char *msg) { - struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; + struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; uint16_t csr; pci_read_config_word(pcs->pci_dev, PCI_COMMAND, &csr); @@ -3258,7 +3258,7 @@ isplinux_pci_exclude(struct pci_dev *dev) while (wrk && *wrk) { unsigned int id; char *commatok, *p, *q; - + commatok = strchr(wrk, ','); if (commatok) { *commatok = 0; diff --git a/qla_isp/linux/scsi_target.c b/qla_isp/linux/scsi_target.c index 8aadb1c93..253c41d6f 100644 --- a/qla_isp/linux/scsi_target.c +++ b/qla_isp/linux/scsi_target.c @@ -2,17 +2,17 @@ /* * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -163,7 +163,7 @@ /* * Size to allocate both a scatterlist + payload for small allocations - */ + */ #define SGS_SIZE 1024 #define SGS0 (roundup(sizeof (struct scatterlist), sizeof (void *))) #define SGS_PAYLOAD_SIZE (SGS_SIZE - SGS0) @@ -259,7 +259,7 @@ static struct scatterlist *sg_cache = NULL; /* - * A memory disk is constructed of a two dimensional array of pointers to pages. + * A memory disk is constructed of a two dimensional array of pointers to pages. * * Allocate a series of chunks of memory, each of which becomes a flat array * of pointers to pages that we allocate one at a time. @@ -345,7 +345,7 @@ static uint8_t inqdata[INQ_SIZE] = { '0', '0', '0', '1' }; static uint8_t vp0data[7] = { - DEFAULT_DEVICE_TYPE, 0, 0, 0x3, 0, 0x80, 0x83 + DEFAULT_DEVICE_TYPE, 0, 0, 0x3, 0, 0x80, 0x83 }; static uint8_t vp80data[36] = { DEFAULT_DEVICE_TYPE, 0x80, 0, 0x20, @@ -654,7 +654,7 @@ free_sdata_chain(sdata_t *sdp) { while (sdp) { sdata_t *nxt = sdp->next; - scsi_target_kfree(sdp, sizeof (*sdp)); + scsi_target_kfree(sdp, sizeof (*sdp)); sdp = nxt; } } @@ -2474,7 +2474,7 @@ scsi_target_endis(char *hba_name_unit, uint64_t nbytes, int chan, int lun, int e } } spin_unlock_irqrestore(&scsi_target_lock, flags); - + if (en == 0) { scsi_free_disk(bp, chan, lun); } else { diff --git a/qla_isp/linux/scsi_target.h b/qla_isp/linux/scsi_target.h index 99f4da041..fc08424de 100644 --- a/qla_isp/linux/scsi_target.h +++ b/qla_isp/linux/scsi_target.h @@ -2,17 +2,17 @@ /* * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* diff --git a/qla_isp/linux/scsi_target_ctl.c b/qla_isp/linux/scsi_target_ctl.c index b18e4627d..f7a5aff9b 100644 --- a/qla_isp/linux/scsi_target_ctl.c +++ b/qla_isp/linux/scsi_target_ctl.c @@ -2,17 +2,17 @@ /* * Copyright (c) 1997-2008 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -24,32 +24,32 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * + * + * * Alternatively, this software may be distributed under the terms of the * the GNU Public License ("GPL") with platforms where the prevalant license * is the GNU Public License: - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of The Version 2 GNU General Public License as published * by the Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Matthew Jacob * Feral Software * 421 Laurel Avenue * Menlo Park, CA 94025 * USA - * + * * gplbsd at feral com */ /* @@ -157,7 +157,7 @@ main(int a, char **v) if ((fd = open(SCSI_TARGET_DEV, O_RDWR)) < 0) { perror(SCSI_TARGET_DEV); - return (1); + return (1); } if (ioctl(fd, action, &x) < 0) { diff --git a/scst/include/scst.h b/scst/include/scst.h index 7138f6292..5bdeda343 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -1,16 +1,16 @@ /* * include/scst.h - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar - * + * * Main SCSI target mid-level include file. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -53,7 +53,7 @@ typedef _Bool bool; #define SCST_INTERFACE_VERSION SCST_VERSION_STRING "$Revision$" SCST_CONST_VERSION /************************************************************* - ** States of command processing state machine. At first, + ** States of command processing state machine. At first, ** "active" states, then - "passive" ones. This is to have ** more efficient generated code of the corresponding ** "switch" statements. @@ -116,22 +116,22 @@ typedef _Bool bool; /* Waiting for response's transmission finish */ #define SCST_CMD_STATE_XMIT_WAIT (SCST_CMD_STATE_LAST_ACTIVE+6) -/************************************************************* - * Can be retuned instead of cmd's state by dev handlers' +/************************************************************* + * Can be retuned instead of cmd's state by dev handlers' * functions, if the command's state should be set by default *************************************************************/ #define SCST_CMD_STATE_DEFAULT 500 -/************************************************************* - * Can be retuned instead of cmd's state by dev handlers' +/************************************************************* + * Can be retuned instead of cmd's state by dev handlers' * functions, if it is impossible to complete requested - * task in atomic context. The cmd will be restarted in thread + * task in atomic context. The cmd will be restarted in thread * context. *************************************************************/ #define SCST_CMD_STATE_NEED_THREAD_CTX 1000 -/************************************************************* - * Can be retuned instead of cmd's state by dev handlers' +/************************************************************* + * Can be retuned instead of cmd's state by dev handlers' * parse function, if the cmd processing should be stopped * for now. The cmd will be restarted by dev handlers itself. *************************************************************/ @@ -165,19 +165,19 @@ typedef _Bool bool; #define SCST_NON_ATOMIC 0 #define SCST_ATOMIC 1 -/************************************************************* - ** Values for pref_context parameter of scst_cmd_init_done() and - ** scst_rx_data() +/************************************************************* + ** Values for pref_context parameter of scst_cmd_init_done() and + ** scst_rx_data() *************************************************************/ -/* - * Direct cmd's processing (i.e. regular function calls in the current +/* + * Direct cmd's processing (i.e. regular function calls in the current * context) sleeping is not allowed */ #define SCST_CONTEXT_DIRECT_ATOMIC 0 -/* - * Direct cmd's processing (i.e. regular function calls in the current +/* + * Direct cmd's processing (i.e. regular function calls in the current * context), sleeping is allowed, no restrictions */ #define SCST_CONTEXT_DIRECT 1 @@ -196,51 +196,51 @@ typedef _Bool bool; */ #define SCST_CONTEXT_PROCESSABLE 0x100 -/************************************************************* - ** Values for status parameter of scst_rx_data() +/************************************************************* + ** Values for status parameter of scst_rx_data() *************************************************************/ /* Success */ #define SCST_RX_STATUS_SUCCESS 0 -/* +/* * Data receiving finished with error, so set the sense and * finish the command, including xmit_response() call */ #define SCST_RX_STATUS_ERROR 1 -/* +/* * Data receiving finished with error and the sense is set, * so finish the command, including xmit_response() call */ #define SCST_RX_STATUS_ERROR_SENSE_SET 2 -/* +/* * Data receiving finished with fatal error, so finish the command, * but don't call xmit_response() */ #define SCST_RX_STATUS_ERROR_FATAL 3 -/************************************************************* - ** Values for status parameter of scst_restart_cmd() +/************************************************************* + ** Values for status parameter of scst_restart_cmd() *************************************************************/ /* Success */ #define SCST_PREPROCESS_STATUS_SUCCESS 0 -/* +/* * Command's processing finished with error, so set the sense and * finish the command, including xmit_response() call */ #define SCST_PREPROCESS_STATUS_ERROR 1 -/* +/* * Command's processing finished with error and the sense is set, * so finish the command, including xmit_response() call */ #define SCST_PREPROCESS_STATUS_ERROR_SENSE_SET 2 -/* +/* * Command's processing finished with fatal error, so finish the command, * but don't call xmit_response() */ @@ -250,8 +250,8 @@ typedef _Bool bool; #define SCST_PREPROCESS_STATUS_NEED_THREAD 4 /************************************************************* - ** Allowed return codes for xmit_response(), rdy_to_xfer(), - ** report_aen() + ** Allowed return codes for xmit_response(), rdy_to_xfer(), + ** report_aen() *************************************************************/ /* Success */ @@ -260,15 +260,15 @@ typedef _Bool bool; /* Internal device queue is full, retry again later */ #define SCST_TGT_RES_QUEUE_FULL -1 -/* - * It is impossible to complete requested task in atomic context. +/* + * It is impossible to complete requested task in atomic context. * The cmd will be restarted in thread context. */ #define SCST_TGT_RES_NEED_THREAD_CTX -2 -/* - * Fatal error, if returned by xmit_response() the cmd will - * be destroyed, if by any other function, xmit_response() +/* + * Fatal error, if returned by xmit_response() the cmd will + * be destroyed, if by any other function, xmit_response() * will be called with HARDWARE ERROR sense data */ #define SCST_TGT_RES_FATAL_ERROR -3 @@ -283,22 +283,22 @@ typedef _Bool bool; /* The cmd should be sent to SCSI mid-level */ #define SCST_EXEC_NOT_COMPLETED 1 -/* - * Thread context is required to execute the command. +/* + * Thread context is required to execute the command. * Exec() will be called again in the thread context. */ #define SCST_EXEC_NEED_THREAD 2 -/************************************************************* - ** Default timeout for cmd's CDB execution +/************************************************************* + ** Default timeout for cmd's CDB execution ** by SCSI mid-level (cmd's "timeout" field). *************************************************************/ #define SCST_DEFAULT_TIMEOUT (30*HZ) -/* - * Set if cmd is finished and there is status/sense to be sent. - * The status should be not sent (i.e. the flag not set) if the - * possibility to perform a command in "chunks" (i.e. with multiple +/* + * Set if cmd is finished and there is status/sense to be sent. + * The status should be not sent (i.e. the flag not set) if the + * possibility to perform a command in "chunks" (i.e. with multiple * xmit_response()/rdy_to_xfer()) is used (not implemented yet). * Obsolete, use scst_cmd_get_is_send_status() instead. */ @@ -311,7 +311,7 @@ typedef _Bool bool; /* Regular standard actions for the command should be done */ #define SCST_DEV_TM_NOT_COMPLETED 1 -/************************************************************* +/************************************************************* ** Session initialization phases *************************************************************/ @@ -327,7 +327,7 @@ typedef _Bool bool; /* Set if session is initialized and ready */ #define SCST_SESS_IPH_READY 3 -/************************************************************* +/************************************************************* ** Session shutdown phases *************************************************************/ @@ -341,7 +341,7 @@ typedef _Bool bool; #define SCST_SESS_SPH_SHUTDOWN 2 /************************************************************* - ** Cmd's async (atomic) flags + ** Cmd's async (atomic) flags *************************************************************/ /* Set if the cmd is aborted and ABORTED sense will be sent as the result */ @@ -420,21 +420,21 @@ enum scst_cdb_flags SCST_INFO_INVALID = 0x10, }; -/* +/* * Scsi_Target_Template: defines what functions a target driver will - * have to provide in order to work with the target mid-level. - * MUST HAVEs define functions that are expected to be in order to work. + * have to provide in order to work with the target mid-level. + * MUST HAVEs define functions that are expected to be in order to work. * OPTIONAL says that there is a choice. * Also, pay attention to the fact that a command is BLOCKING or NON-BLOCKING. * NON-BLOCKING means that a function returns immediately and will not wait - * for actual data transfer to finish. Blocking in such command could have - * negative impact on overall system performance. If blocking is necessary, - * it is worth to consider creating dedicated thread(s) in target driver, to - * which the commands would be passed and which would perform blocking + * for actual data transfer to finish. Blocking in such command could have + * negative impact on overall system performance. If blocking is necessary, + * it is worth to consider creating dedicated thread(s) in target driver, to + * which the commands would be passed and which would perform blocking * operations instead of SCST. - * If the function allowed to sleep or not is determined by its last - * argument, which is true, if sleeping is not allowed. In this case, - * if the function requires sleeping, it can return + * If the function allowed to sleep or not is determined by its last + * argument, which is true, if sleeping is not allowed. In this case, + * if the function requires sleeping, it can return * SCST_TGT_RES_NEED_THREAD_CTX, and it will be recalled in the thread context, * where sleeping is allowed. */ @@ -442,9 +442,9 @@ struct scst_tgt_template { /* public: */ - /* + /* * SG tablesize allows to check whether scatter/gather can be used - * or not. + * or not. */ int sg_tablesize; @@ -460,7 +460,7 @@ struct scst_tgt_template unsigned use_clustering:1; /* - * True, if this target adapter doesn't support SG-vector clustering + * True, if this target adapter doesn't support SG-vector clustering */ unsigned no_clustering:1; @@ -477,11 +477,11 @@ struct scst_tgt_template /* * This function is equivalent to the SCSI * queuecommand. The target should transmit the response - * buffer and the status in the scst_cmd struct. - * The expectation is that this executing this command is NON-BLOCKING. - * - * After the response is actually transmitted, the target - * should call the scst_tgt_cmd_done() function of the + * buffer and the status in the scst_cmd struct. + * The expectation is that this executing this command is NON-BLOCKING. + * + * After the response is actually transmitted, the target + * should call the scst_tgt_cmd_done() function of the * mid-level, which will allow it to free up the command. * Returns one of the SCST_TGT_RES_* constants. * @@ -502,7 +502,7 @@ struct scst_tgt_template * level protocols have a corresponding function which informs * the initiator that buffers have been allocated e.g., XFER_ * RDY in Fibre Channel. After the data is actually received - * the low-level driver needs to call scst_rx_data() in order to + * the low-level driver needs to call scst_rx_data() in order to * continue processing this command. * Returns one of the SCST_TGT_RES_* constants. * This command is expected to be NON-BLOCKING. @@ -515,7 +515,7 @@ struct scst_tgt_template */ int (*rdy_to_xfer) (struct scst_cmd *cmd); - /* + /* * Called to notify the driver that the command is about to be freed. * Necessary, because for aborted commands xmit_response() could not * be called. Could be called on IRQ context. @@ -600,7 +600,7 @@ struct scst_tgt_template * signify that a Task Management function is completed as far * as the mid-level is concerned. Any information that must be * stored about the command is the responsibility of the low- - * level driver. No return value expected. + * level driver. No return value expected. * This function is expected to be NON-BLOCKING * * Called without any locks held from a thread context. @@ -612,18 +612,18 @@ struct scst_tgt_template /* * This function should detect the target adapters that * are present in the system. The function should return a value - * >= 0 to signify the number of detected target adapters. + * >= 0 to signify the number of detected target adapters. * A negative value should be returned whenever there is - * an error. + * an error. * * MUST HAVE */ int (*detect) (struct scst_tgt_template *tgt_template); /* - * This function should free up the resources allocated to the device. - * The function should return 0 to indicate successful release - * or a negative value if there are some issues with the release. + * This function should free up the resources allocated to the device. + * The function should return 0 to indicate successful release + * or a negative value if there are some issues with the release. * In the current version the return value is ignored. * * MUST HAVE @@ -631,7 +631,7 @@ struct scst_tgt_template int (*release) (struct scst_tgt *tgt); /* - * This function is used for Asynchronous Event Notification. + * This function is used for Asynchronous Event Notification. * It is the responsibility of the driver to notify any/all * initiators about the Asynchronous Event reported. * Returns one of the SCST_TGT_RES_* constants. @@ -651,16 +651,16 @@ struct scst_tgt_template * OPTIONAL */ int (*read_proc) (struct seq_file *seq, struct scst_tgt *tgt); - int (*write_proc) (char *buffer, char **start, off_t offset, + int (*write_proc) (char *buffer, char **start, off_t offset, int length, int *eof, struct scst_tgt *tgt); - /* + /* * Name of the template. Must be unique to identify * the template. MUST HAVE */ const char name[50]; - /* + /* * Number of additional threads to the pool of dedicated threads. * Used if xmit_response() or rdy_to_xfer() is blocking. * It is the target driver's duty to ensure that not more, than that @@ -702,15 +702,15 @@ struct scst_dev_type /* Set, if exec() is synchronous */ unsigned exec_sync:1; - /* - * Called to parse CDB from the cmd and initialize + /* + * Called to parse CDB from the cmd and initialize * cmd->bufflen and cmd->data_direction (both - REQUIRED). - * Returns the command's next state or SCST_CMD_STATE_DEFAULT, - * if the next default state should be used, or - * SCST_CMD_STATE_NEED_THREAD_CTX if the function called in atomic + * Returns the command's next state or SCST_CMD_STATE_DEFAULT, + * if the next default state should be used, or + * SCST_CMD_STATE_NEED_THREAD_CTX if the function called in atomic * context, but requires sleeping, or SCST_CMD_STATE_STOP if the * command should not be further processed for now. In the - * SCST_CMD_STATE_NEED_THREAD_CTX case the function + * SCST_CMD_STATE_NEED_THREAD_CTX case the function * will be recalled in the thread context, where sleeping is allowed. * * Pay attention to "atomic" attribute of the cmd, which can be get @@ -721,11 +721,11 @@ struct scst_dev_type */ int (*parse) (struct scst_cmd *cmd); - /* - * Called to execute CDB. Useful, for instance, to implement - * data caching. The result of CDB execution is reported via + /* + * Called to execute CDB. Useful, for instance, to implement + * data caching. The result of CDB execution is reported via * cmd->scst_cmd_done() callback. - * Returns: + * Returns: * - SCST_EXEC_COMPLETED - the cmd is done, go to other ones * - SCST_EXEC_NEED_THREAD - thread context is required to execute * the command. Exec() will be called again in the thread context. @@ -747,15 +747,15 @@ struct scst_dev_type */ int (*exec) (struct scst_cmd *cmd); - /* + /* * Called to notify dev handler about the result of cmd execution * and perform some post processing. Cmd's fields is_send_status and * resp_data_len should be set by this function, but SCST offers good * defaults. - * Returns the command's next state or SCST_CMD_STATE_DEFAULT, - * if the next default state should be used, or - * SCST_CMD_STATE_NEED_THREAD_CTX if the function called in atomic - * context, but requires sleeping. In the last case, the function + * Returns the command's next state or SCST_CMD_STATE_DEFAULT, + * if the next default state should be used, or + * SCST_CMD_STATE_NEED_THREAD_CTX if the function called in atomic + * context, but requires sleeping. In the last case, the function * will be recalled in the thread context, where sleeping is allowed. * * Pay attention to "atomic" attribute of the cmd, which can be get @@ -764,28 +764,28 @@ struct scst_dev_type */ int (*dev_done) (struct scst_cmd *cmd); - /* + /* * Called to notify dev hander that the command is about to be freed. * Could be called on IRQ context. */ void (*on_free_cmd) (struct scst_cmd *cmd); - /* - * Called to execute a task management command. - * Returns: + /* + * Called to execute a task management command. + * Returns: * - SCST_MGMT_STATUS_SUCCESS - the command is done with success, * no firther actions required - * - The SCST_MGMT_STATUS_* error code if the command is failed and + * - The SCST_MGMT_STATUS_* error code if the command is failed and * no firther actions required * - SCST_DEV_TM_NOT_COMPLETED - regular standard actions for the command * should be done * * Called without any locks held from a thread context. */ - int (*task_mgmt_fn) (struct scst_mgmt_cmd *mgmt_cmd, + int (*task_mgmt_fn) (struct scst_mgmt_cmd *mgmt_cmd, struct scst_tgt_dev *tgt_dev); - /* + /* * Called when new device is attaching to the dev handler * Returns 0 on success, error code otherwise. */ @@ -794,13 +794,13 @@ struct scst_dev_type /* Called when new device is detaching from the dev handler */ void (*detach) (struct scst_device *dev); - /* + /* * Called when new tgt_dev (session) is attaching to the dev handler. * Returns 0 on success, error code otherwise. */ int (*attach_tgt) (struct scst_tgt_dev *tgt_dev); - /* + /* * Called when a session, corresponding to a tgt_dev, is about to be * unregistered and the tgt_dev - detached. Supposed to be used to * clean out "stalled" commands, which otherwise could prevent SCST @@ -827,7 +827,7 @@ struct scst_dev_type char name[15]; /* - * Number of dedicated threads. If 0 - no dedicated threads will + * Number of dedicated threads. If 0 - no dedicated threads will * be created, if <0 - creation of dedicated threads is prohibited. */ int threads_num; @@ -838,7 +838,7 @@ struct scst_dev_type /* list entry in scst_dev_type_list */ struct list_head dev_type_list_entry; - + /* The pointer to the /proc directory entry */ struct proc_dir_entry *proc_dev_type_root; }; @@ -902,11 +902,11 @@ struct scst_session /**************************************************************/ /* Alive commands for this session. ToDo: make it part of the common IO flow control */ - atomic_t sess_cmd_count; + atomic_t sess_cmd_count; spinlock_t sess_list_lock; /* protects search_cmd_list, etc */ - /* + /* * List of cmds in this session. Used to find a cmd in the * session. Protected by sess_list_lock. */ @@ -941,7 +941,7 @@ struct scst_session /* List entry for the list that keeps session, waiting for the shutdown */ struct list_head sess_shut_list_entry; - /* + /* * Lists of deffered during session initialization commands. * Protected by sess_list_lock. */ @@ -999,10 +999,10 @@ struct scst_cmd int state; /************************************************************* - ** Cmd's flags + ** Cmd's flags *************************************************************/ - /* - * Set if expected_sn was incremented, i.e. cmd was sent to + /* + * Set if expected_sn was incremented, i.e. cmd was sent to * SCSI mid-level for execution */ unsigned int sent_to_midlev:1; @@ -1162,7 +1162,7 @@ struct scst_cmd /* List entry for session's search_cmd_list */ struct list_head search_cmd_list_entry; - /* + /* * Used to found the cmd by scst_find_cmd_by_tag(). Set by the * target driver on the cmd's initialization time */ @@ -1184,12 +1184,12 @@ struct scst_cmd /* SCSI data direction, one of SCST_DATA_* constants */ scst_data_direction data_direction; - + /* Remote initiator supplied values, if any */ scst_data_direction expected_data_direction; int expected_transfer_len; - /* + /* * Cmd data length. Could be different from bufflen for commands like * VERIFY, which transfer different amount of data (if any), than * processed. @@ -1204,11 +1204,11 @@ struct scst_cmd int bufflen; /* cmd buffer length */ struct scatterlist *sg; /* cmd data buffer SG vector */ int sg_cnt; /* SG segments count */ - + /* scst_get_sg_buf_[first,next]() support */ int get_sg_buf_entry_num; - /* + /* * Response data length in data buffer. This field must not be set * directly, use scst_set_resp_data_len() for that */ @@ -1227,7 +1227,7 @@ struct scst_cmd /* Used for storage of dev handler private stuff */ void *dh_priv; - /* + /* * Used to restore the SG vector if it was modified by * scst_set_resp_data_len() */ @@ -1332,10 +1332,10 @@ struct scst_device struct scst_cmd_lists cmd_lists; /* How many cmds alive on this dev */ - atomic_t dev_cmd_count; + atomic_t dev_cmd_count; /* How many write cmds alive on this dev. Temporary, ToDo */ - atomic_t write_cmd_count; + atomic_t write_cmd_count; unsigned short type; /* SCSI type of the device */ @@ -1380,13 +1380,13 @@ struct scst_device spinlock_t dev_lock; /* device lock */ - /* + /* * How many times device was blocked for new cmds execution. * Protected by dev_lock */ int block_count; - /* + /* * How many there are "on_dev" commands, i.e. ones those are being * executed by the underlying SCSI/virtual device. */ @@ -1411,19 +1411,19 @@ struct scst_device /* Virtual device internal ID */ int virt_id; - + /* Pointer to virtual device name, for convenience only */ const char *virt_name; - + /* List entry in global devices list */ struct list_head dev_list_entry; - + /* * List of tgt_dev's, one per session, protected by scst_mutex or * dev_lock for reads and both for writes */ struct list_head dev_tgt_dev_list; - + /* List of acg_dev's, one per acg, protected by scst_mutex */ struct list_head dev_acg_dev_list; @@ -1447,7 +1447,7 @@ struct scst_thr_data_hdr void (*free_fn) (struct scst_thr_data_hdr *data); }; -/* +/* * Used to store per-session specific device information */ struct scst_tgt_dev @@ -1467,7 +1467,7 @@ struct scst_tgt_dev unsigned long tgt_dev_flags; /* tgt_dev's async flags */ - /* + /* * Used to execute cmd's in order of arrival, honoring SCSI task * attributes. * @@ -1510,7 +1510,7 @@ struct scst_tgt_dev /* list entry in dev->dev_tgt_dev_list */ struct list_head dev_tgt_dev_list_entry; - + /* internal tmp list entry */ struct list_head extra_tgt_dev_list_entry; }; @@ -1524,10 +1524,10 @@ struct scst_acg_dev lun_t lun; /* device's LUN in this acg */ unsigned int rd_only_flag:1; /* if != 0, then read only */ struct scst_acg *acg; /* parent acg */ - + /* list entry in dev->dev_acg_dev_list */ struct list_head dev_acg_dev_list_entry; - + /* list entry in acg->acg_dev_list */ struct list_head acg_dev_list_entry; }; @@ -1569,7 +1569,7 @@ struct scst_acn struct list_head acn_list_entry; }; -/* +/* * Used to store per-session UNIT ATTENTIONs */ struct scst_tgt_dev_UA @@ -1585,7 +1585,7 @@ struct scst_tgt_dev_UA #define smp_mb__after_set_bit() smp_mb(); #endif -/* +/* * Registers target template * Returns 0 on success or appropriate error code otherwise */ @@ -1596,28 +1596,28 @@ static inline int scst_register_target_template(struct scst_tgt_template *vtt) return __scst_register_target_template(vtt, SCST_INTERFACE_VERSION); } -/* +/* * Unregisters target template */ void scst_unregister_target_template(struct scst_tgt_template *vtt); -/* +/* * Registers and returns target adapter * Returns new target structure on success or NULL otherwise. * - * If parameter "target_name" isn't NULL, then security group with name + * If parameter "target_name" isn't NULL, then security group with name * "Default_##target_name", if created, will be used as the default * instead of "Default" one for all initiators not assigned to any other group. */ struct scst_tgt *scst_register(struct scst_tgt_template *vtt, const char *target_name); -/* +/* * Unregisters target adapter */ void scst_unregister(struct scst_tgt *tgt); -/* +/* * Registers and returns a session * * Returns new session on success or NULL otherwise @@ -1627,18 +1627,18 @@ void scst_unregister(struct scst_tgt *tgt); * atomic - true, if the function called in the atomic context * initiator_name - remote initiator's name, any NULL-terminated string, * e.g. iSCSI name, which used as the key to found appropriate access - * control group. Could be NULL, then "default" group is used. + * control group. Could be NULL, then "default" group is used. * The groups are set up via /proc interface. * data - any target driver supplied data - * result_fn - pointer to the function that will be + * result_fn - pointer to the function that will be * asynchronously called when session initialization finishes. * Can be NULL. Parameters: * - sess - session * - data - target driver supplied to scst_register_session() data - * - result - session initialization result, 0 on success or + * - result - session initialization result, 0 on success or * appropriate error code otherwise * - * Note: A session creation and initialization is a complex task, + * Note: A session creation and initialization is a complex task, * which requires sleeping state, so it can't be fully done * in interrupt context. Therefore the "bottom half" of it, if * scst_register_session() is called from atomic context, will be @@ -1648,7 +1648,7 @@ void scst_unregister(struct scst_tgt *tgt); * Those commands processing will be delayed inside SCST until * the session initialization is finished, then their processing * will be restarted. The target driver will be notified about - * finish of the session initialization by function result_fn(). + * finish of the session initialization by function result_fn(). * On success the target driver could do nothing, but if the * initialization fails, the target driver must ensure that * no more new commands being sent or will be sent to SCST after @@ -1661,23 +1661,23 @@ struct scst_session *scst_register_session(struct scst_tgt *tgt, int atomic, const char *initiator_name, void *data, void (*result_fn) (struct scst_session *sess, void *data, int result)); -/* +/* * Unregisters a session. * Parameters: * sess - session to be unregistered * wait - if true, instructs to wait until all commands, which * currently is being executed and belonged to the session, finished. * Otherwise, target driver should be prepared to receive - * xmit_response() for the session's command after + * xmit_response() for the session's command after * scst_unregister_session() returns. - * unreg_done_fn - pointer to the function that will be + * unreg_done_fn - pointer to the function that will be * asynchronously called when the last session's command finishes and - * the session is about to be completely freed. Can be NULL. + * the session is about to be completely freed. Can be NULL. * Parameter: * - sess - session - * unreg_cmds_done_fn - pointer to the function that will be + * unreg_cmds_done_fn - pointer to the function that will be * asynchronously called when the last session's command completes, i.e. - * goes to XMIT stage. Can be NULL. + * goes to XMIT stage. Can be NULL. * Parameter: * - sess - session * @@ -1709,7 +1709,7 @@ static inline void scst_unregister_session(struct scst_session *sess, int wait, scst_unregister_session_ex(sess, wait, unreg_done_fn, NULL); } -/* +/* * Registers dev handler driver * Returns 0 on success or appropriate error code otherwise */ @@ -1720,12 +1720,12 @@ static inline int scst_register_dev_driver(struct scst_dev_type *dev_type) return __scst_register_dev_driver(dev_type, SCST_INTERFACE_VERSION); } -/* +/* * Unregisters dev handler driver */ void scst_unregister_dev_driver(struct scst_dev_type *dev_type); -/* +/* * Registers dev handler driver for virtual devices (eg VDISK) * Returns 0 on success or appropriate error code otherwise */ @@ -1738,12 +1738,12 @@ static inline int scst_register_virtual_dev_driver( SCST_INTERFACE_VERSION); } -/* +/* * Unregisters dev handler driver for virtual devices */ void scst_unregister_virtual_dev_driver(struct scst_dev_type *dev_type); -/* +/* * Creates and sends new command to SCST. * Must not be called in parallel with scst_unregister_session() for the * same sess. Returns the command on success or NULL otherwise @@ -1752,10 +1752,10 @@ struct scst_cmd *scst_rx_cmd(struct scst_session *sess, const uint8_t *lun, int lun_len, const uint8_t *cdb, int cdb_len, int atomic); -/* - * Notifies SCST that the driver finished its part of the command +/* + * Notifies SCST that the driver finished its part of the command * initialization, and the command is ready for execution. - * The second argument sets preferred command execition context. + * The second argument sets preferred command execition context. * See SCST_CONTEXT_* constants for details. * * !!IMPORTANT!! @@ -1772,7 +1772,7 @@ struct scst_cmd *scst_rx_cmd(struct scst_session *sess, */ void scst_cmd_init_done(struct scst_cmd *cmd, int pref_context); -/* +/* * Notifies SCST that the driver finished the first stage of the command * initialization, and the command is ready for execution, but after * SCST done the command's preprocessing preprocessing_done() function @@ -1789,7 +1789,7 @@ static inline void scst_cmd_init_stage1_done(struct scst_cmd *cmd, scst_cmd_init_done(cmd, pref_context); } -/* +/* * Notifies SCST that the driver finished its part of the command's * preprocessing and it is ready for further processing. * The second argument sets data receiving completion status @@ -1801,8 +1801,8 @@ static inline void scst_cmd_init_stage1_done(struct scst_cmd *cmd, */ void scst_restart_cmd(struct scst_cmd *cmd, int status, int pref_context); -/* - * Notifies SCST that the driver received all the necessary data +/* + * Notifies SCST that the driver received all the necessary data * and the command is ready for further processing. * The second argument sets data receiving completion status * (see SCST_RX_STATUS_* constants for details) @@ -1811,7 +1811,7 @@ void scst_restart_cmd(struct scst_cmd *cmd, int status, int pref_context); */ void scst_rx_data(struct scst_cmd *cmd, int status, int pref_context); -/* +/* * Notifies SCST that the driver sent the response and the command * can be freed now. Don't forget to set the delivery status, if it * isn't success, using scst_set_delivery_status() before calling @@ -1819,18 +1819,18 @@ void scst_rx_data(struct scst_cmd *cmd, int status, int pref_context); */ void scst_tgt_cmd_done(struct scst_cmd *cmd); -/* +/* * Creates new management command sends it for execution. - * Must not be called in parallel with scst_unregister_session() for the + * Must not be called in parallel with scst_unregister_session() for the * same sess. Returns 0 for success, error code otherwise. */ int scst_rx_mgmt_fn(struct scst_session *sess, const struct scst_rx_mgmt_params *params); -/* +/* * Creates new management command using tag and sends it for execution. * Can be used for SCST_ABORT_TASK only. - * Must not be called in parallel with scst_unregister_session() for the + * Must not be called in parallel with scst_unregister_session() for the * same sess. Returns 0 for success, error code otherwise. * * Obsolete in favor of scst_rx_mgmt_fn() @@ -1851,10 +1851,10 @@ static inline int scst_rx_mgmt_fn_tag(struct scst_session *sess, int fn, return scst_rx_mgmt_fn(sess, ¶ms); } -/* +/* * Creates new management command using LUN and sends it for execution. * Currently can be used for any fn, except SCST_ABORT_TASK. - * Must not be called in parallel with scst_unregister_session() for the + * Must not be called in parallel with scst_unregister_session() for the * same sess. Returns 0 for success, error code otherwise. * * Obsolete in favor of scst_rx_mgmt_fn() @@ -1886,29 +1886,29 @@ static inline int scst_rx_mgmt_fn_lun(struct scst_session *sess, int fn, */ int scst_get_cdb_info(struct scst_cmd *cmd); -/* +/* * Set error SCSI status in the command and prepares it for returning it */ void scst_set_cmd_error_status(struct scst_cmd *cmd, int status); -/* +/* * Set error in the command and fill the sense buffer */ void scst_set_cmd_error(struct scst_cmd *cmd, int key, int asc, int ascq); -/* +/* * Sets BUSY or TASK QUEUE FULL status */ void scst_set_busy(struct scst_cmd *cmd); -/* +/* * Finds a command based on the supplied tag comparing it with one - * that previously set by scst_cmd_set_tag(). + * that previously set by scst_cmd_set_tag(). * Returns the command on success or NULL otherwise */ struct scst_cmd *scst_find_cmd_by_tag(struct scst_session *sess, uint64_t tag); -/* +/* * Finds a command based on user supplied data and comparision * callback function, that should return true, if the command is found. * Returns the command on success or NULL otherwise @@ -1962,7 +1962,7 @@ static inline int scst_is_cmd_local(struct scst_cmd *cmd) * remain valid during the device lifetime. * Returns assinged to the device ID on success, or negative value otherwise */ -int scst_register_virtual_device(struct scst_dev_type *dev_handler, +int scst_register_virtual_device(struct scst_dev_type *dev_handler, const char *dev_name); /* @@ -2077,7 +2077,7 @@ static inline unsigned int scst_cmd_get_bufflen(struct scst_cmd *cmd) return cmd->bufflen; } -/* +/* * Returns cmd's sg_cnt. * * Usage of this function is not recommended, use scst_get_buf_*() @@ -2236,7 +2236,7 @@ static inline int scst_cmd_is_expected_set(struct scst_cmd *cmd) { return cmd->expected_values_set; } - + static inline scst_data_direction scst_cmd_get_expected_data_direction( struct scst_cmd *cmd) { @@ -2379,7 +2379,7 @@ static inline void sg_clear(struct scatterlist *sg) * Functions for access to the commands data (SG) buffer, * including HIGHMEM environment. Should be used instead of direct * access. Returns the mapped buffer length for success, 0 for EOD, - * negative error code otherwise. + * negative error code otherwise. * * "Buf" argument returns the mapped buffer * @@ -2390,14 +2390,14 @@ static inline int __scst_get_buf(struct scst_cmd *cmd, uint8_t **buf) int res = 0; struct scatterlist *sg = cmd->sg; int i = cmd->get_sg_buf_entry_num; - + *buf = NULL; - + if ((i >= cmd->sg_cnt) || unlikely(sg == NULL)) goto out; #ifdef SCST_HIGHMEM /* HIGHMEM isn't currently supported */ - /* - * HIGHMEM pages not merged (clustered), so if it's + /* + * HIGHMEM pages not merged (clustered), so if it's * not HIGHMEM page, kmap() is the same as page_address() */ if (scst_cmd_atomic(cmd)) { @@ -2415,7 +2415,7 @@ static inline int __scst_get_buf(struct scst_cmd *cmd, uint8_t **buf) *buf += sg[i].offset; res = sg[i].length; cmd->get_sg_buf_entry_num++; - + out: return res; } @@ -2451,7 +2451,7 @@ static inline void scst_put_buf(struct scst_cmd *cmd, void *buf) } /* - * Returns approximate higher rounded buffers count that + * Returns approximate higher rounded buffers count that * scst_get_buf_[first|next]() return. */ static inline int scst_get_buf_count(struct scst_cmd *cmd) @@ -2465,8 +2465,8 @@ static inline int scst_get_buf_count(struct scst_cmd *cmd) return res; } -/* - * Suspends and resumes any activity. +/* + * Suspends and resumes any activity. * scst_suspend_activity() doesn't return until there are any * active commands (state after SCST_CMD_STATE_INIT). New arriving * commands stay in that state until scst_resume_activity() is called. @@ -2493,7 +2493,7 @@ void scst_process_active_cmd(struct scst_cmd *cmd, int context); */ int scst_check_local_events(struct scst_cmd *cmd); -/* +/* * Returns target driver's root entry in SCST's /proc hierarchy. * The driver can create own files/directoryes here, which should * be deleted in the driver's release(). @@ -2504,7 +2504,7 @@ static inline struct proc_dir_entry *scst_proc_get_tgt_root( return vtt->proc_tgt_root; } -/* +/* * Returns device handler's root entry in SCST's /proc hierarchy. * The driver can create own files/directoryes here, which should * be deleted in the driver's detach()/release(). @@ -2516,7 +2516,7 @@ static inline struct proc_dir_entry *scst_proc_get_dev_type_root( } /** - ** Two library functions and the structure to help the drivers + ** Two library functions and the structure to help the drivers ** that use scst_debug.* facilities manage "trace_level" /proc entry. ** The functions service "standard" log levels and allow to work ** with driver specific levels, which should be passed inside as @@ -2530,7 +2530,7 @@ struct scst_proc_log { const char *token; }; -int scst_proc_log_entry_read(struct seq_file *seq, unsigned long log_level, +int scst_proc_log_entry_read(struct seq_file *seq, unsigned long log_level, const struct scst_proc_log *tbl); int scst_proc_log_entry_write(struct file *file, const char *buf, @@ -2575,7 +2575,7 @@ int scst_alloc_set_sense(struct scst_cmd *cmd, int atomic, void scst_set_sense(uint8_t *buffer, int len, int key, int asc, int ascq); -void scst_set_cmd_error_sense(struct scst_cmd *cmd, uint8_t *sense, +void scst_set_cmd_error_sense(struct scst_cmd *cmd, uint8_t *sense, unsigned int len); /* @@ -2601,14 +2601,14 @@ void scst_set_resp_data_len(struct scst_cmd *cmd, int resp_data_len); */ int scst_check_mem(struct scst_cmd *cmd); -/* +/* * Get/put global ref counter that prevents from entering into suspended * activities stage, so protects from any global management operations. */ void scst_get(void); void scst_put(void); -/* +/* * Cmd ref counters */ void scst_cmd_get(struct scst_cmd *cmd); @@ -2625,7 +2625,7 @@ struct scatterlist *scst_alloc(int size, unsigned long gfp_mask, int *count); void scst_free(struct scatterlist *sg, int count); /* - * Adds local to the current thread data to tgt_dev + * Adds local to the current thread data to tgt_dev * (they will be local for the tgt_dev and current thread). */ void scst_add_thr_data(struct scst_tgt_dev *tgt_dev, diff --git a/scst/include/scst_const.h b/scst/include/scst_const.h index a499760ae..efd584bf3 100644 --- a/scst/include/scst_const.h +++ b/scst/include/scst_const.h @@ -1,15 +1,15 @@ /* * include/scst_const.h - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin - * + * * Contains common SCST constants. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -39,7 +39,7 @@ #define SCST_CMD_DELIVERY_FAILED -1 #define SCST_CMD_DELIVERY_ABORTED -2 -/************************************************************* +/************************************************************* ** Values for task management functions *************************************************************/ #define SCST_ABORT_TASK 0 @@ -51,7 +51,7 @@ /** SCST extensions **/ -/* +/* * Notifies about I_T nexus loss event in the corresponding session. * Aborts all tasks there, resets the reservation, if any, and sets * up the I_T Nexus loss UA. @@ -61,7 +61,7 @@ /* Aborts all tasks in the corresponding session */ #define SCST_ABORT_ALL_TASKS_SESS 7 -/* +/* * Notifies about I_T nexus loss event. Aborts all tasks in all sessions * of the tgt, resets the reservations, if any, and sets up the I_T Nexus * loss UA. @@ -79,7 +79,7 @@ */ #define SCST_UNREG_SESS_TM 10 -/************************************************************* +/************************************************************* ** Values for mgmt cmd's status field. Codes taken from iSCSI *************************************************************/ #define SCST_MGMT_STATUS_SUCCESS 0 @@ -89,7 +89,7 @@ #define SCST_MGMT_STATUS_REJECTED -255 #define SCST_MGMT_STATUS_FAILED -129 -/************************************************************* +/************************************************************* ** SCSI task attribute queue types *************************************************************/ enum scst_cmd_queue_type @@ -101,8 +101,8 @@ enum scst_cmd_queue_type SCST_CMD_QUEUE_ACA }; -/************************************************************* - ** Data direction aliases +/************************************************************* + ** Data direction aliases *************************************************************/ #define SCST_DATA_UNKNOWN 0 #define SCST_DATA_WRITE 1 @@ -151,7 +151,7 @@ static inline int scst_is_ua_sense(const uint8_t *sense) #define SCST_STANDARD_SENSE_LEN 14 -/************************************************************* +/************************************************************* * SCSI opcodes not listed anywhere else *************************************************************/ #ifndef REPORT_DEVICE_IDENTIFIER @@ -271,7 +271,7 @@ static inline int scst_is_ua_sense(const uint8_t *sense) #define SCST_CONTR_MODE_QUEUE_ALG_RESTRICTED_REORDER 0 #define SCST_CONTR_MODE_QUEUE_ALG_UNRESTRICTED_REORDER 1 -/************************************************************* +/************************************************************* ** Misc SCSI constants *************************************************************/ #define SCST_SENSE_ASC_UA_RESET 0x29 diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index 6cf75caed..f140a0402 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -1,16 +1,16 @@ /* * include/scst_debug.h - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar - * + * * Contains macroses for execution tracing and error reporting - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/scst/include/scst_user.h b/scst/include/scst_user.h index 90614be2e..0f0ce6fed 100644 --- a/scst/include/scst_user.h +++ b/scst/include/scst_user.h @@ -1,17 +1,17 @@ /* * include/scst_user.h - * + * * Copyright (C) 2007 Vladislav Bolkhovitin - * + * * Contains constants and data structures for scst_user module. * See http://scst.sourceforge.net/doc/scst_user_spec.txt or * scst_user_spec.txt for description. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -28,8 +28,8 @@ #define DEV_USER_VERSION_NAME "0.9.6" #define DEV_USER_VERSION DEV_USER_VERSION_NAME "$Revision$" SCST_CONST_VERSION -/* - * Chosen so sizeof(scst_user_sess) <= sizeof(scst_user_scsi_cmd_exec) +/* + * Chosen so sizeof(scst_user_sess) <= sizeof(scst_user_scsi_cmd_exec) * (the largest one) */ #define SCST_MAX_NAME 45 @@ -62,7 +62,7 @@ #define aligned_u64 uint64_t __attribute__((aligned(8))) #endif -/************************************************************* +/************************************************************* ** Private ucmd states *************************************************************/ #define UCMD_STATE_NEW 0 diff --git a/scst/src/dev_handlers/scst_cdrom.c b/scst/src/dev_handlers/scst_cdrom.c index a9d01f76e..a4199aeae 100644 --- a/scst/src/dev_handlers/scst_cdrom.c +++ b/scst/src/dev_handlers/scst_cdrom.c @@ -1,16 +1,16 @@ /* * scst_cdrom.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar * * SCSI CDROM (type 5) dev handler - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -59,11 +59,11 @@ static struct scst_dev_type cdrom_devtype = CDROM_TYPE; /************************************************************** * Function: cdrom_attach * - * Argument: + * Argument: * * Returns : 1 if attached, error code otherwise * - * Description: + * Description: *************************************************************/ int cdrom_attach(struct scst_device *dev) { @@ -113,8 +113,8 @@ int cdrom_attach(struct scst_device *dev) sbuff = sense_buffer; TRACE_DBG("%s", "Doing READ_CAPACITY"); - res = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer, - buffer_size, sbuff, + res = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer, + buffer_size, sbuff, CDROM_REG_TIMEOUT, 3, 0); TRACE_DBG("READ_CAPACITY done: %x", res); @@ -170,7 +170,7 @@ out: /************************************************************ * Function: cdrom_detach * - * Argument: + * Argument: * * Returns : None * @@ -193,7 +193,7 @@ void cdrom_detach(struct scst_device *dev) static int cdrom_get_block_shift(struct scst_cmd *cmd) { struct cdrom_params *params = (struct cdrom_params *)cmd->dev->dh_priv; - /* + /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. */ @@ -203,7 +203,7 @@ static int cdrom_get_block_shift(struct scst_cmd *cmd) /******************************************************************** * Function: cdrom_parse * - * Argument: + * Argument: * * Returns : The state of the command * @@ -232,7 +232,7 @@ int cdrom_parse(struct scst_cmd *cmd) static void cdrom_set_block_shift(struct scst_cmd *cmd, int block_shift) { struct cdrom_params *params = (struct cdrom_params *)cmd->dev->dh_priv; - /* + /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. */ @@ -246,13 +246,13 @@ static void cdrom_set_block_shift(struct scst_cmd *cmd, int block_shift) /******************************************************************** * Function: cdrom_done * - * Argument: + * Argument: * - * Returns : + * Returns : * * Description: This is the completion routine for the command, * it is used to extract any necessary information - * about a command. + * about a command. ********************************************************************/ int cdrom_done(struct scst_cmd *cmd) { @@ -271,7 +271,7 @@ static int __init cdrom_init(void) int res = 0; TRACE_ENTRY(); - + cdrom_devtype.module = THIS_MODULE; res = scst_register_dev_driver(&cdrom_devtype); diff --git a/scst/src/dev_handlers/scst_changer.c b/scst/src/dev_handlers/scst_changer.c index c1419486e..fed57492c 100644 --- a/scst/src/dev_handlers/scst_changer.c +++ b/scst/src/dev_handlers/scst_changer.c @@ -1,16 +1,16 @@ /* * scst_changer.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar * * SCSI medium changer (type 8) dev handler - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -52,11 +52,11 @@ static struct scst_dev_type changer_devtype = CHANGER_TYPE; /************************************************************** * Function: changer_attach * - * Argument: + * Argument: * * Returns : 1 if attached, error code otherwise * - * Description: + * Description: *************************************************************/ int changer_attach(struct scst_device *dev) { @@ -86,7 +86,7 @@ int changer_attach(struct scst_device *dev) retries = SCST_DEV_UA_RETRIES; do { TRACE_DBG("%s", "Doing TEST_UNIT_READY"); - res = scsi_test_unit_ready(dev->scsi_dev, CHANGER_TIMEOUT, + res = scsi_test_unit_ready(dev->scsi_dev, CHANGER_TIMEOUT, CHANGER_RETRIES #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) ); @@ -117,7 +117,7 @@ out: /************************************************************ * Function: changer_detach * - * Argument: + * Argument: * * Returns : None * @@ -134,7 +134,7 @@ void changer_detach(struct scst_device *dev) /******************************************************************** * Function: changer_parse * - * Argument: + * Argument: * * Returns : The state of the command * @@ -162,13 +162,13 @@ int changer_parse(struct scst_cmd *cmd) /******************************************************************** * Function: changer_done * - * Argument: + * Argument: * - * Returns : + * Returns : * * Description: This is the completion routine for the command, * it is used to extract any necessary information - * about a command. + * about a command. ********************************************************************/ int changer_done(struct scst_cmd *cmd) { @@ -199,13 +199,13 @@ static int __init changer_init(void) int res = 0; TRACE_ENTRY(); - + changer_devtype.module = THIS_MODULE; res = scst_register_dev_driver(&changer_devtype); if (res < 0) goto out; - + res = scst_dev_handler_build_std_proc(&changer_devtype); if (res != 0) goto out_err; diff --git a/scst/src/dev_handlers/scst_dev_handler.h b/scst/src/dev_handlers/scst_dev_handler.h index 29580c234..726fa73df 100644 --- a/scst/src/dev_handlers/scst_dev_handler.h +++ b/scst/src/dev_handlers/scst_dev_handler.h @@ -23,7 +23,7 @@ TRACE_MINOR | TRACE_SPECIAL) #endif -static unsigned long dh_trace_flag = SCST_DEFAULT_DEV_LOG_FLAGS; +static unsigned long dh_trace_flag = SCST_DEFAULT_DEV_LOG_FLAGS; #define trace_flag dh_trace_flag #ifndef trace_log_tbl diff --git a/scst/src/dev_handlers/scst_disk.c b/scst/src/dev_handlers/scst_disk.c index cc17b05ec..908be0e87 100644 --- a/scst/src/dev_handlers/scst_disk.c +++ b/scst/src/dev_handlers/scst_disk.c @@ -1,6 +1,6 @@ /* * scst_disk.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar * @@ -8,12 +8,12 @@ * & * SCSI disk (type 0) "performance" device handler (skip all READ and WRITE * operations). - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -135,11 +135,11 @@ module_exit(exit_scst_disk_driver); /************************************************************** * Function: disk_attach * - * Argument: + * Argument: * * Returns : 1 if attached, error code otherwise * - * Description: + * Description: *************************************************************/ int disk_attach(struct scst_device *dev) { @@ -189,13 +189,13 @@ int disk_attach(struct scst_device *dev) sbuff = sense_buffer; TRACE_DBG("%s", "Doing READ_CAPACITY"); - res = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer, - buffer_size, sbuff, + res = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer, + buffer_size, sbuff, DISK_REG_TIMEOUT, 3, 0); TRACE_DBG("READ_CAPACITY done: %x", res); - if (!res || (sbuff[12] != 0x28 && sbuff[12] != 0x29)) + if (!res || (sbuff[12] != 0x28 && sbuff[12] != 0x29)) { break; } @@ -245,7 +245,7 @@ out: /************************************************************ * Function: disk_detach * - * Argument: + * Argument: * * Returns : None * @@ -268,7 +268,7 @@ void disk_detach(struct scst_device *dev) static int disk_get_block_shift(struct scst_cmd *cmd) { struct disk_params *params = (struct disk_params *)cmd->dev->dh_priv; - /* + /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. */ @@ -278,7 +278,7 @@ static int disk_get_block_shift(struct scst_cmd *cmd) /******************************************************************** * Function: disk_parse * - * Argument: + * Argument: * * Returns : The state of the command * @@ -307,7 +307,7 @@ int disk_parse(struct scst_cmd *cmd) static void disk_set_block_shift(struct scst_cmd *cmd, int block_shift) { struct disk_params *params = (struct disk_params *)cmd->dev->dh_priv; - /* + /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. */ @@ -321,13 +321,13 @@ static void disk_set_block_shift(struct scst_cmd *cmd, int block_shift) /******************************************************************** * Function: disk_done * - * Argument: + * Argument: * - * Returns : + * Returns : * * Description: This is the completion routine for the command, * it is used to extract any necessary information - * about a command. + * about a command. ********************************************************************/ int disk_done(struct scst_cmd *cmd) { @@ -344,9 +344,9 @@ int disk_done(struct scst_cmd *cmd) /******************************************************************** * Function: disk_exec * - * Argument: + * Argument: * - * Returns : + * Returns : * * Description: Make SCST do nothing for data READs and WRITES. * Intended for raw line performance testing diff --git a/scst/src/dev_handlers/scst_modisk.c b/scst/src/dev_handlers/scst_modisk.c index 558167a20..4f98a2c55 100644 --- a/scst/src/dev_handlers/scst_modisk.c +++ b/scst/src/dev_handlers/scst_modisk.c @@ -1,6 +1,6 @@ /* * scst_modisk.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar * @@ -8,12 +8,12 @@ * & * SCSI MO disk (type 7) "performance" device handler (skip all READ and WRITE * operations). - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -93,7 +93,7 @@ static int __init init_scst_modisk_driver(void) if (res != 0) goto out_unreg1; - modisk_devtype_perf.module = THIS_MODULE; + modisk_devtype_perf.module = THIS_MODULE; res = scst_register_dev_driver(&modisk_devtype_perf); if (res < 0) @@ -115,7 +115,7 @@ out_unreg1_err1: out_unreg1: scst_unregister_dev_driver(&modisk_devtype); - goto out; + goto out; } static void __exit exit_scst_modisk_driver(void) @@ -135,11 +135,11 @@ module_exit(exit_scst_modisk_driver); /************************************************************** * Function: modisk_attach * - * Argument: + * Argument: * * Returns : 1 if attached, error code otherwise * - * Description: + * Description: *************************************************************/ int modisk_attach(struct scst_device *dev) { @@ -201,8 +201,8 @@ int modisk_attach(struct scst_device *dev) sbuff = sense_buffer; TRACE_DBG("%s", "Doing READ_CAPACITY"); - res = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer, - buffer_size, sbuff, + res = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer, + buffer_size, sbuff, MODISK_REG_TIMEOUT, 3, 0); TRACE_DBG("READ_CAPACITY done: %x", res); @@ -228,7 +228,7 @@ int modisk_attach(struct scst_device *dev) sector_size, dev->scsi_dev->scsi_level, SCSI_2); } else { TRACE_BUFFER("Sense set", sbuff, SCST_SENSE_BUFFERSIZE); - + if (sbuff[2] != NOT_READY) { res = -ENODEV; goto out_free_buf; @@ -261,7 +261,7 @@ out: /************************************************************ * Function: modisk_detach * - * Argument: + * Argument: * * Returns : None * @@ -284,7 +284,7 @@ void modisk_detach(struct scst_device *dev) static int modisk_get_block_shift(struct scst_cmd *cmd) { struct modisk_params *params = (struct modisk_params *)cmd->dev->dh_priv; - /* + /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. */ @@ -294,7 +294,7 @@ static int modisk_get_block_shift(struct scst_cmd *cmd) /******************************************************************** * Function: modisk_parse * - * Argument: + * Argument: * * Returns : The state of the command * @@ -323,7 +323,7 @@ int modisk_parse(struct scst_cmd *cmd) static void modisk_set_block_shift(struct scst_cmd *cmd, int block_shift) { struct modisk_params *params = (struct modisk_params *)cmd->dev->dh_priv; - /* + /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. */ @@ -337,13 +337,13 @@ static void modisk_set_block_shift(struct scst_cmd *cmd, int block_shift) /******************************************************************** * Function: modisk_done * - * Argument: + * Argument: * - * Returns : + * Returns : * * Description: This is the completion routine for the command, * it is used to extract any necessary information - * about a command. + * about a command. ********************************************************************/ int modisk_done(struct scst_cmd *cmd) { @@ -360,9 +360,9 @@ int modisk_done(struct scst_cmd *cmd) /******************************************************************** * Function: modisk_exec * - * Argument: + * Argument: * - * Returns : + * Returns : * * Description: Make SCST do nothing for data READs and WRITES. * Intended for raw line performance testing diff --git a/scst/src/dev_handlers/scst_processor.c b/scst/src/dev_handlers/scst_processor.c index 644155ee1..02d1095c9 100644 --- a/scst/src/dev_handlers/scst_processor.c +++ b/scst/src/dev_handlers/scst_processor.c @@ -1,16 +1,16 @@ /* * scst_processor.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar * * SCSI medium processor (type 3) dev handler - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -52,11 +52,11 @@ static struct scst_dev_type processor_devtype = PROCESSOR_TYPE; /************************************************************** * Function: processor_attach * - * Argument: + * Argument: * * Returns : 1 if attached, error code otherwise * - * Description: + * Description: *************************************************************/ int processor_attach(struct scst_device *dev) { @@ -86,7 +86,7 @@ int processor_attach(struct scst_device *dev) retries = SCST_DEV_UA_RETRIES; do { TRACE_DBG("%s", "Doing TEST_UNIT_READY"); - res = scsi_test_unit_ready(dev->scsi_dev, PROCESSOR_TIMEOUT, + res = scsi_test_unit_ready(dev->scsi_dev, PROCESSOR_TIMEOUT, PROCESSOR_RETRIES #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) ); @@ -117,7 +117,7 @@ out: /************************************************************ * Function: processor_detach * - * Argument: + * Argument: * * Returns : None * @@ -134,7 +134,7 @@ void processor_detach(struct scst_device *dev) /******************************************************************** * Function: processor_parse * - * Argument: + * Argument: * * Returns : The state of the command * @@ -161,13 +161,13 @@ int processor_parse(struct scst_cmd *cmd) /******************************************************************** * Function: processor_done * - * Argument: + * Argument: * - * Returns : + * Returns : * * Description: This is the completion routine for the command, * it is used to extract any necessary information - * about a command. + * about a command. ********************************************************************/ int processor_done(struct scst_cmd *cmd) { @@ -204,7 +204,7 @@ static int __init processor_init(void) res = scst_register_dev_driver(&processor_devtype); if (res < 0) goto out; - + res = scst_dev_handler_build_std_proc(&processor_devtype); if (res != 0) goto out_err; diff --git a/scst/src/dev_handlers/scst_raid.c b/scst/src/dev_handlers/scst_raid.c index d553b6df1..c39439b5c 100644 --- a/scst/src/dev_handlers/scst_raid.c +++ b/scst/src/dev_handlers/scst_raid.c @@ -1,16 +1,16 @@ /* * scst_raid.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar * * SCSI raid(controller) (type 0xC) dev handler - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -52,11 +52,11 @@ static struct scst_dev_type raid_devtype = RAID_TYPE; /************************************************************** * Function: raid_attach * - * Argument: + * Argument: * * Returns : 1 if attached, error code otherwise * - * Description: + * Description: *************************************************************/ int raid_attach(struct scst_device *dev) { @@ -86,7 +86,7 @@ int raid_attach(struct scst_device *dev) retries = SCST_DEV_UA_RETRIES; do { TRACE_DBG("%s", "Doing TEST_UNIT_READY"); - res = scsi_test_unit_ready(dev->scsi_dev, RAID_TIMEOUT, + res = scsi_test_unit_ready(dev->scsi_dev, RAID_TIMEOUT, RAID_RETRIES #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) ); @@ -117,7 +117,7 @@ out: /************************************************************ * Function: raid_detach * - * Argument: + * Argument: * * Returns : None * @@ -134,7 +134,7 @@ void raid_detach(struct scst_device *dev) /******************************************************************** * Function: raid_parse * - * Argument: + * Argument: * * Returns : The state of the command * @@ -161,13 +161,13 @@ int raid_parse(struct scst_cmd *cmd) /******************************************************************** * Function: raid_done * - * Argument: + * Argument: * - * Returns : + * Returns : * * Description: This is the completion routine for the command, * it is used to extract any necessary information - * about a command. + * about a command. ********************************************************************/ int raid_done(struct scst_cmd *cmd) { @@ -204,7 +204,7 @@ static int __init raid_init(void) res = scst_register_dev_driver(&raid_devtype); if (res < 0) goto out; - + res = scst_dev_handler_build_std_proc(&raid_devtype); if (res != 0) goto out_err; diff --git a/scst/src/dev_handlers/scst_tape.c b/scst/src/dev_handlers/scst_tape.c index 806249631..ea1a12dd7 100644 --- a/scst/src/dev_handlers/scst_tape.c +++ b/scst/src/dev_handlers/scst_tape.c @@ -1,19 +1,19 @@ /* * scst_tape.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar * - * SCSI tape (type 1) dev handler + * SCSI tape (type 1) dev handler * & * SCSI tape (type 1) "performance" device handler (skip all READ and WRITE * operations). - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -140,11 +140,11 @@ module_exit(exit_scst_tape_driver); /************************************************************** * Function: tape_attach * - * Argument: + * Argument: * * Returns : 1 if attached, error code otherwise * - * Description: + * Description: *************************************************************/ int tape_attach(struct scst_device *dev) { @@ -182,7 +182,7 @@ int tape_attach(struct scst_device *dev) retries = SCST_DEV_UA_RETRIES; do { TRACE_DBG("%s", "Doing TEST_UNIT_READY"); - res = scsi_test_unit_ready(dev->scsi_dev, TAPE_SMALL_TIMEOUT, + res = scsi_test_unit_ready(dev->scsi_dev, TAPE_SMALL_TIMEOUT, TAPE_RETRIES #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) ); @@ -197,10 +197,10 @@ int tape_attach(struct scst_device *dev) } TRACE_DBG("%s", "Doing MODE_SENSE"); - res = scsi_mode_sense(dev->scsi_dev, + res = scsi_mode_sense(dev->scsi_dev, ((dev->scsi_dev->scsi_level <= SCSI_2) ? ((dev->scsi_dev->lun << 5) & 0xe0) : 0), - 0 /* Mode Page 0 */, + 0 /* Mode Page 0 */, buffer, buffer_size, TAPE_SMALL_TIMEOUT, TAPE_RETRIES, &data, NULL); @@ -253,7 +253,7 @@ out: /************************************************************ * Function: tape_detach * - * Argument: + * Argument: * * Returns : None * @@ -276,7 +276,7 @@ void tape_detach(struct scst_device *dev) static int tape_get_block_size(struct scst_cmd *cmd) { struct tape_params *params = (struct tape_params *)cmd->dev->dh_priv; - /* + /* * No need for locks here, since *_detach() can not be called, * when there are existing commands. */ @@ -286,7 +286,7 @@ static int tape_get_block_size(struct scst_cmd *cmd) /******************************************************************** * Function: tape_parse * - * Argument: + * Argument: * * Returns : The state of the command * @@ -315,7 +315,7 @@ int tape_parse(struct scst_cmd *cmd) static void tape_set_block_size(struct scst_cmd *cmd, int block_size) { struct tape_params *params = (struct tape_params *)cmd->dev->dh_priv; - /* + /* * No need for locks here, since *_detach() can not be called, when * there are existing commands. */ @@ -326,13 +326,13 @@ static void tape_set_block_size(struct scst_cmd *cmd, int block_size) /******************************************************************** * Function: tape_done * - * Argument: + * Argument: * - * Returns : + * Returns : * * Description: This is the completion routine for the command, * it is used to extract any necessary information - * about a command. + * about a command. ********************************************************************/ int tape_done(struct scst_cmd *cmd) { @@ -344,8 +344,8 @@ int tape_done(struct scst_cmd *cmd) if ((status == SAM_STAT_GOOD) || (status == SAM_STAT_CONDITION_MET)) { res = scst_tape_generic_dev_done(cmd, tape_set_block_size); - } else if ((status == SAM_STAT_CHECK_CONDITION) && - SCST_SENSE_VALID(cmd->sense)) + } else if ((status == SAM_STAT_CHECK_CONDITION) && + SCST_SENSE_VALID(cmd->sense)) { struct tape_params *params; TRACE_DBG("%s", "Extended sense"); @@ -371,8 +371,8 @@ int tape_done(struct scst_cmd *cmd) if (TransferLength > Residue) { int resp_data_len = TransferLength - Residue; if (cmd->cdb[1] & SCST_TRANSFER_LEN_TYPE_FIXED) { - /* - * No need for locks here, since + /* + * No need for locks here, since * *_detach() can not be called, when * there are existing commands. */ @@ -394,9 +394,9 @@ int tape_done(struct scst_cmd *cmd) /******************************************************************** * Function: tape_exec * - * Argument: + * Argument: * - * Returns : + * Returns : * * Description: Make SCST do nothing for data READs and WRITES. * Intended for raw line performance testing diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index f0091c01e..a83680d9f 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -1,15 +1,15 @@ /* * scst_user.c - * + * * Copyright (C) 2007 Vladislav Bolkhovitin * * SCSI virtual user space device handler - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -119,7 +119,7 @@ struct scst_user_cmd { struct scst_cmd *cmd; struct scst_user_dev *dev; - + atomic_t ucmd_ref; unsigned int buff_cached:1; @@ -157,7 +157,7 @@ static void dev_user_free_ucmd(struct scst_user_cmd *ucmd); static int dev_user_parse(struct scst_cmd *cmd); static int dev_user_exec(struct scst_cmd *cmd); static void dev_user_on_free_cmd(struct scst_cmd *cmd); -static int dev_user_task_mgmt_fn(struct scst_mgmt_cmd *mcmd, +static int dev_user_task_mgmt_fn(struct scst_mgmt_cmd *mcmd, struct scst_tgt_dev *tgt_dev); static int dev_user_disk_done(struct scst_cmd *cmd); @@ -238,7 +238,7 @@ static inline int calc_num_pg(unsigned long buf, int len) static inline int is_need_offs_page(unsigned long buf, int len) { - return ((buf & ~PAGE_MASK) != 0) && + return ((buf & ~PAGE_MASK) != 0) && ((buf & PAGE_MASK) != ((buf+len-1) & PAGE_MASK)); } @@ -590,10 +590,10 @@ static int dev_user_alloc_space(struct scst_user_cmd *ucmd) ucmd->user_cmd.cmd_h = ucmd->h; ucmd->user_cmd.subcode = SCST_USER_ALLOC_MEM; ucmd->user_cmd.alloc_cmd.sess_h = (unsigned long)cmd->tgt_dev; - memcpy(ucmd->user_cmd.alloc_cmd.cdb, cmd->cdb, + memcpy(ucmd->user_cmd.alloc_cmd.cdb, cmd->cdb, min(sizeof(ucmd->user_cmd.alloc_cmd.cdb), sizeof(cmd->cdb))); ucmd->user_cmd.alloc_cmd.cdb_len = cmd->cdb_len; - ucmd->user_cmd.alloc_cmd.alloc_len = ucmd->buff_cached ? + ucmd->user_cmd.alloc_cmd.alloc_len = ucmd->buff_cached ? (cmd->sg_cnt << PAGE_SHIFT) : cmd->bufflen; ucmd->user_cmd.alloc_cmd.queue_type = cmd->queue_type; ucmd->user_cmd.alloc_cmd.data_direction = cmd->data_direction; @@ -642,7 +642,7 @@ out: static int dev_user_get_block(struct scst_cmd *cmd) { struct scst_user_dev *dev = (struct scst_user_dev*)cmd->dev->dh_priv; - /* + /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. */ @@ -710,7 +710,7 @@ static int dev_user_parse(struct scst_cmd *cmd) ucmd->user_cmd.cmd_h = ucmd->h; ucmd->user_cmd.subcode = SCST_USER_PARSE; ucmd->user_cmd.parse_cmd.sess_h = (unsigned long)cmd->tgt_dev; - memcpy(ucmd->user_cmd.parse_cmd.cdb, cmd->cdb, + memcpy(ucmd->user_cmd.parse_cmd.cdb, cmd->cdb, min(sizeof(ucmd->user_cmd.parse_cmd.cdb), sizeof(cmd->cdb))); ucmd->user_cmd.parse_cmd.cdb_len = cmd->cdb_len; @@ -769,7 +769,7 @@ static void dev_user_flush_dcache(struct scst_user_cmd *ucmd) page = buf_ucmd->data_pages[i]; #ifdef ARCH_HAS_FLUSH_ANON_PAGE struct vm_area_struct *vma = find_vma(current->mm, start); - if (vma != NULL) + if (vma != NULL) flush_anon_page(vma, page, start); #endif flush_dcache_page(page); @@ -810,7 +810,7 @@ static int dev_user_exec(struct scst_cmd *cmd) ucmd->user_cmd.cmd_h = ucmd->h; ucmd->user_cmd.subcode = SCST_USER_EXEC; ucmd->user_cmd.exec_cmd.sess_h = (unsigned long)cmd->tgt_dev; - memcpy(ucmd->user_cmd.exec_cmd.cdb, cmd->cdb, + memcpy(ucmd->user_cmd.exec_cmd.cdb, cmd->cdb, min(sizeof(ucmd->user_cmd.exec_cmd.cdb), sizeof(cmd->cdb))); ucmd->user_cmd.exec_cmd.cdb_len = cmd->cdb_len; @@ -818,7 +818,7 @@ static int dev_user_exec(struct scst_cmd *cmd) ucmd->user_cmd.exec_cmd.data_len = cmd->data_len; ucmd->user_cmd.exec_cmd.pbuf = ucmd->ubuff; if ((ucmd->ubuff == 0) && (cmd->data_direction != SCST_DATA_NONE)) { - ucmd->user_cmd.exec_cmd.alloc_len = ucmd->buff_cached ? + ucmd->user_cmd.exec_cmd.alloc_len = ucmd->buff_cached ? (cmd->sg_cnt << PAGE_SHIFT) : cmd->bufflen; } ucmd->user_cmd.exec_cmd.queue_type = cmd->queue_type; @@ -894,7 +894,7 @@ out: static void dev_user_set_block(struct scst_cmd *cmd, int block) { struct scst_user_dev *dev = (struct scst_user_dev*)cmd->dev->dh_priv; - /* + /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. */ @@ -938,7 +938,7 @@ static void dev_user_add_to_ready(struct scst_user_cmd *ucmd) TRACE_ENTRY(); - do_wake = (in_interrupt() || + do_wake = (in_interrupt() || (ucmd->state == UCMD_STATE_ON_CACHE_FREEING)); if (ucmd->cmd) do_wake |= ucmd->cmd->preprocessing_only; @@ -1134,7 +1134,7 @@ static int dev_user_process_reply_parse(struct scst_user_cmd *ucmd, struct scst_user_reply_cmd *reply) { int res = 0; - struct scst_user_scsi_cmd_reply_parse *preply = + struct scst_user_scsi_cmd_reply_parse *preply = &reply->parse_reply; struct scst_cmd *cmd = ucmd->cmd; @@ -1381,7 +1381,7 @@ unlock_process: case UCMD_STATE_EXECING: res = dev_user_process_reply_exec(ucmd, reply); break; - + case UCMD_STATE_ON_FREEING: res = dev_user_process_reply_on_free(ucmd); break; @@ -1512,9 +1512,9 @@ again: if (unlikely(rc != 0)) { u->cmd->scst_cmd_done(u->cmd, SCST_CMD_STATE_DEFAULT); - /* + /* * !! At this point cmd & u can be !! - * !! already freed !! + * !! already freed !! */ spin_lock_irq( &dev->cmd_lists.cmd_list_lock); @@ -1901,7 +1901,7 @@ static void dev_user_unjam_cmd(struct scst_user_cmd *ucmd, int busy, spin_unlock_irqrestore(&dev->cmd_lists.cmd_list_lock, *flags); else spin_unlock_irq(&dev->cmd_lists.cmd_list_lock); - + TRACE_MGMT_DBG("EXEC: unjamming ucmd %p", ucmd); if (test_bit(SCST_CMD_ABORTED, &ucmd->cmd->cmd_flags)) @@ -2040,7 +2040,7 @@ repeat: if (ucmd->state & UCMD_STATE_SENT_MASK) { int st = ucmd->state & ~UCMD_STATE_SENT_MASK; if (tgt_dev != NULL) { - if (__unjam_check_tgt_dev(ucmd, st, + if (__unjam_check_tgt_dev(ucmd, st, tgt_dev) == 0) continue; } else if (tm) { @@ -2131,7 +2131,7 @@ static int dev_user_process_reply_tm_exec(struct scst_user_cmd *ucmd, return res; } -static int dev_user_task_mgmt_fn(struct scst_mgmt_cmd *mcmd, +static int dev_user_task_mgmt_fn(struct scst_mgmt_cmd *mcmd, struct scst_tgt_dev *tgt_dev) { int res, rc; @@ -2273,7 +2273,7 @@ static void dev_user_detach(struct scst_device *sdev) /* dev will be freed by the caller */ sdev->dh_priv = NULL; dev->sdev = NULL; - + TRACE_EXIT(); return; } diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index a0fce19f5..8e6fef5aa 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -1,26 +1,26 @@ /* * scst_vdisk.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar * (C) 2007 Ming Zhang * (C) 2007 Ross Walker * - * SCSI disk (type 0) and CDROM (type 5) dev handler using files + * SCSI disk (type 0) and CDROM (type 5) dev handler using files * on file systems or block devices (VDISK) - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -#include +#include #include #include #include @@ -319,7 +319,7 @@ static struct scst_dev_type vcdrom_devtype = VCDROM_TYPE; static char *vdisk_proc_help_string = "echo \"open|close NAME [FILE_NAME [BLOCK_SIZE] [WRITE_THROUGH " - "READ_ONLY O_DIRECT NULLIO NV_CACHE BLOCKIO]]\" >/proc/scsi_tgt/" + "READ_ONLY O_DIRECT NULLIO NV_CACHE BLOCKIO]]\" >/proc/scsi_tgt/" VDISK_NAME "/" VDISK_NAME "\n"; static char *vcdrom_proc_help_string = @@ -335,11 +335,11 @@ MODULE_PARM_DESC(scst_vdisk_ID, "SCST virtual disk subsystem ID"); /************************************************************** * Function: vdisk_open * - * Argument: + * Argument: * * Returns : fd, use IS_ERR(fd) to get error status * - * Description: + * Description: *************************************************************/ static struct file *vdisk_open(const struct scst_vdisk_dev *virt_dev) { @@ -366,11 +366,11 @@ static struct file *vdisk_open(const struct scst_vdisk_dev *virt_dev) /************************************************************** * Function: vdisk_attach * - * Argument: + * Argument: * * Returns : 1 if attached, error code otherwise * - * Description: + * Description: *************************************************************/ static int vdisk_attach(struct scst_device *dev) { @@ -390,12 +390,12 @@ static int vdisk_attach(struct scst_device *dev) goto out; } - vd = (dev->handler->type == TYPE_DISK) ? + vd = (dev->handler->type == TYPE_DISK) ? &vdisk_dev_list : &vcdrom_dev_list; - /* - * scst_vdisk_mutex must be already taken before + /* + * scst_vdisk_mutex must be already taken before * scst_register_virtual_device() */ list_for_each_entry(vv, vd, vdisk_dev_list_entry) { @@ -404,7 +404,7 @@ static int vdisk_attach(struct scst_device *dev) break; } } - + if (virt_dev == NULL) { PRINT_ERROR("Device %s not found", dev->virt_name); res = -EINVAL; @@ -431,10 +431,10 @@ static int vdisk_attach(struct scst_device *dev) } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) - if ((fd->f_op == NULL) || (fd->f_op->readv == NULL) || + if ((fd->f_op == NULL) || (fd->f_op->readv == NULL) || (fd->f_op->writev == NULL)) #else - if ((fd->f_op == NULL) || (fd->f_op->aio_read == NULL) || + if ((fd->f_op == NULL) || (fd->f_op->aio_read == NULL) || (fd->f_op->aio_write == NULL)) #endif { @@ -444,7 +444,7 @@ static int vdisk_attach(struct scst_device *dev) filp_close(fd, NULL); goto out; } - + inode = fd->f_dentry->d_inode; if (virt_dev->blockio && !S_ISBLK(inode->i_mode)) { @@ -465,7 +465,7 @@ static int vdisk_attach(struct scst_device *dev) goto out; } err = inode->i_size; - + filp_close(fd, NULL); } virt_dev->file_size = err; @@ -512,7 +512,7 @@ out: /************************************************************ * Function: vdisk_detach * - * Argument: + * Argument: * * Returns : None * @@ -532,7 +532,7 @@ static void vdisk_detach(struct scst_device *dev) /* virt_dev will be freed by the caller */ dev->dh_priv = NULL; - + TRACE_EXIT(); return; } @@ -622,7 +622,7 @@ static int vdisk_attach_tgt(struct scst_tgt_dev *tgt_dev) } tgt_dev->dh_priv = ftgt_dev; - + out: TRACE_EXIT_RES(res); return res; @@ -630,7 +630,7 @@ out: static void vdisk_detach_tgt(struct scst_tgt_dev *tgt_dev) { - struct scst_vdisk_tgt_dev *ftgt_dev = + struct scst_vdisk_tgt_dev *ftgt_dev = (struct scst_vdisk_tgt_dev *)tgt_dev->dh_priv; TRACE_ENTRY(); @@ -761,10 +761,10 @@ static int vdisk_do_job(struct scst_cmd *cmd) lba_start |= ((u64)cdb[3]) << 16; lba_start |= ((u64)cdb[4]) << 8; lba_start |= ((u64)cdb[5]); - data_len = ((cdb[7] << (BYTE * 1)) + (cdb[8] << (BYTE * 0))) + data_len = ((cdb[7] << (BYTE * 1)) + (cdb[8] << (BYTE * 0))) << virt_dev->block_shift; if (data_len == 0) - data_len = virt_dev->file_size - + data_len = virt_dev->file_size - ((loff_t)lba_start << virt_dev->block_shift); break; } @@ -775,7 +775,7 @@ static int vdisk_do_job(struct scst_cmd *cmd) 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, + "(%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( scst_sense_block_out_range_error)); @@ -977,7 +977,7 @@ static int vdisk_get_block_shift(struct scst_cmd *cmd) /******************************************************************** * Function: vdisk_parse * - * Argument: + * Argument: * * Returns : The state of the command * @@ -994,7 +994,7 @@ static int vdisk_parse(struct scst_cmd *cmd) /******************************************************************** * Function: vcdrom_parse * - * Argument: + * Argument: * * Returns : The state of the command * @@ -1011,11 +1011,11 @@ static int vcdrom_parse(struct scst_cmd *cmd) /******************************************************************** * Function: vcdrom_exec * - * Argument: + * Argument: * - * Returns : + * Returns : * - * Description: + * Description: ********************************************************************/ static int vcdrom_exec(struct scst_cmd *cmd) { @@ -1038,7 +1038,7 @@ static int vcdrom_exec(struct scst_cmd *cmd) goto out_done; } - if (virt_dev->media_changed && (cmd->cdb[0] != INQUIRY) && + if (virt_dev->media_changed && (cmd->cdb[0] != INQUIRY) && (cmd->cdb[0] != REQUEST_SENSE) && (cmd->cdb[0] != REPORT_LUNS)) { spin_lock(&virt_dev->flags_lock); if (virt_dev->media_changed) { @@ -1080,7 +1080,7 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd) TRACE_ENTRY(); - buf = kzalloc(INQ_BUF_SZ, + buf = kzalloc(INQ_BUF_SZ, scst_cmd_atomic(cmd) ? GFP_ATOMIC : GFP_KERNEL); if (buf == NULL) { scst_set_busy(cmd); @@ -1110,7 +1110,7 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd) if (cmd->cdb[1] & EVPD) { int dev_id_num; char dev_id_str[6]; - + for (dev_id_num = 0, i = 0; i < (int)strlen(virt_dev->name); i++) { unsigned int rv = random_values[(int)(virt_dev->name[i])]; /* @@ -1270,7 +1270,7 @@ out: return; } -/* +/* * <> * * ToDo: revise them @@ -1405,7 +1405,7 @@ static void vdisk_exec_mode_sense(struct scst_cmd *cmd) virt_dev = (struct scst_vdisk_dev *)cmd->dev->dh_priv; blocksize = virt_dev->block_size; nblocks = virt_dev->nblocks; - + type = cmd->dev->handler->type; /* type dev */ dbd = cmd->cdb[1] & DBD; pcontrol = (cmd->cdb[2] & 0xc0) >> 6; @@ -1621,7 +1621,7 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd) goto out_put; } break; -#if 0 /* +#if 0 /* * It's too early to implement it, since we can't control the backstorage * device parameters. ToDo */ @@ -1635,7 +1635,7 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd) } #endif } else { - PRINT_ERROR("MODE SELECT: Invalid request %x", + PRINT_ERROR("MODE SELECT: Invalid request %x", address[offset] & 0x3f); scst_set_cmd_error(cmd, SCST_LOAD_SENSE( scst_sense_invalid_field_in_parm_list)); @@ -1696,7 +1696,7 @@ static void vdisk_exec_read_capacity(struct scst_cmd *cmd) buffer[5] = (blocksize >> (BYTE * 2)) & 0xFF; buffer[6] = (blocksize >> (BYTE * 1)) & 0xFF; buffer[7] = (blocksize >> (BYTE * 0)) & 0xFF; - + length = scst_get_buf_first(cmd, &address); if (unlikely(length <= 0)) { PRINT_ERROR("scst_get_buf_first() failed: %d", length); @@ -1777,7 +1777,7 @@ static void vdisk_exec_read_toc(struct scst_cmd *cmd) uint8_t *address; struct scst_vdisk_dev *virt_dev; uint32_t nblocks; - uint8_t buffer[4+8+8] = { 0x00, 0x0a, 0x01, 0x01, 0x00, 0x14, + uint8_t buffer[4+8+8] = { 0x00, 0x0a, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }; TRACE_ENTRY(); @@ -1867,7 +1867,7 @@ static void vdisk_exec_prevent_allow_medium_removal(struct scst_cmd *cmd) if (cmd->dev->handler->type == TYPE_ROM) { spin_lock(&virt_dev->flags_lock); - virt_dev->prevent_allow_medium_removal = + virt_dev->prevent_allow_medium_removal = cmd->cdb[4] & 0x01 ? 1 : 0; spin_unlock(&virt_dev->flags_lock); } @@ -1915,7 +1915,7 @@ static struct iovec *vdisk_alloc_iv(struct scst_cmd *cmd, struct scst_vdisk_thr *thr) { int iv_count; - + iv_count = scst_get_buf_count(cmd); if (iv_count > thr->iv_count) { if (thr->iv != NULL) @@ -1989,11 +1989,11 @@ static void vdisk_exec_read(struct scst_cmd *cmd, int iv_count, i; TRACE_ENTRY(); - + iv = vdisk_alloc_iv(cmd, thr); if (iv == NULL) goto out; - + iv_count = 0; full_len = 0; i = -1; @@ -2020,14 +2020,14 @@ static void vdisk_exec_read(struct scst_cmd *cmd, if (virt_dev->nullio) err = full_len; else { - /* SEEK */ + /* SEEK */ if (fd->f_op->llseek) { err = fd->f_op->llseek(fd, loff, 0/*SEEK_SET*/); } else { err = default_llseek(fd, loff, 0/*SEEK_SET*/); } if (err != loff) { - PRINT_ERROR("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; @@ -2041,7 +2041,7 @@ 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, + PRINT_ERROR("readv() returned %Ld from %zd", (uint64_t)err, full_len); if (err == -EAGAIN) scst_set_busy(cmd); @@ -2054,11 +2054,11 @@ static void vdisk_exec_read(struct scst_cmd *cmd, out_set_fs: set_fs(old_fs); - -out_put: + +out_put: for(; i >= 0; i--) scst_put_buf(cmd, iv[i].iov_base); - + out: TRACE_EXIT(); return; @@ -2082,7 +2082,7 @@ static void vdisk_exec_write(struct scst_cmd *cmd, iv = vdisk_alloc_iv(cmd, thr); if (iv == NULL) goto out; - + iv_count = 0; full_len = 0; length = scst_get_buf_first(cmd, &address); @@ -2118,7 +2118,7 @@ restart: err = default_llseek(fd, loff, 0 /*SEEK_SET */ ); } if (err != loff) { - PRINT_ERROR("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)); @@ -2129,13 +2129,13 @@ restart: #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) err = fd->f_op->writev(fd, eiv, eiv_count, &fd->f_pos); #else - err = do_sync_readv_writev(fd, iv, iv_count, full_len, &fd->f_pos, + err = do_sync_readv_writev(fd, iv, iv_count, full_len, &fd->f_pos, fd->f_op->aio_write); #endif } if (err < 0) { - PRINT_ERROR("write() returned %Ld from %zd", + PRINT_ERROR("write() returned %Ld from %zd", (uint64_t)err, full_len); if (err == -EAGAIN) scst_set_busy(cmd); @@ -2145,7 +2145,7 @@ restart: } goto out_set_fs; } else if (err < full_len) { - /* + /* * Probably that's wrong, but sometimes write() returns * value less, than requested. Let's restart. */ @@ -2164,7 +2164,7 @@ restart: eiv++; eiv_count--; } else { - eiv->iov_base = + eiv->iov_base = (uint8_t*)eiv->iov_base + err; eiv->iov_len -= err; break; @@ -2176,7 +2176,7 @@ restart: out_set_fs: set_fs(old_fs); -out_put: +out_put: while (iv_count > 0) { scst_put_buf(cmd, iv[iv_count-1].iov_base); iv_count--; @@ -2221,7 +2221,7 @@ static void blockio_endio(struct bio *bio, int error) if (unlikely(error != 0)) { PRINT_ERROR("cmd %p returned error %d", blockio_work->cmd, error); - /* + /* * The race with other such bio's doesn't matter, since all * scst_set_cmd_error() calls do the same local to this cmd * operations. @@ -2266,7 +2266,7 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr, blockio_work = kmalloc(sizeof (*blockio_work), GFP_KERNEL); if (blockio_work == NULL) goto out_no_mem; - + blockio_work->cmd = cmd; if (q) @@ -2304,7 +2304,7 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr, bios++; need_new_bio = 0; bio->bi_end_io = blockio_endio; - bio->bi_sector = lba_start0 << + bio->bi_sector = lba_start0 << (virt_dev->block_shift - 9); bio->bi_bdev = bdev; bio->bi_private = blockio_work; @@ -2373,7 +2373,7 @@ out_no_mem: goto out; } -static void vdisk_exec_verify(struct scst_cmd *cmd, +static void vdisk_exec_verify(struct scst_cmd *cmd, struct scst_vdisk_thr *thr, loff_t loff) { mm_segment_t old_fs; @@ -2391,7 +2391,7 @@ static void vdisk_exec_verify(struct scst_cmd *cmd, if (vdisk_fsync(thr, loff, cmd->bufflen, cmd) != 0) goto out; - /* + /* * Until the cache is cleared prior the verifying, there is not * much point in this code. ToDo. * @@ -2410,7 +2410,7 @@ static void vdisk_exec_verify(struct scst_cmd *cmd, err = default_llseek(fd, loff, 0/*SEEK_SET*/); } if (err != loff) { - PRINT_ERROR("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; @@ -2523,7 +2523,7 @@ static int vdisk_task_mgmt_fn(struct scst_mgmt_cmd *mcmd, return SCST_DEV_TM_NOT_COMPLETED; } -/* +/* * Called when a file in the /proc/VDISK_NAME/VDISK_NAME is read */ static int vdisk_read_proc(struct seq_file *seq, struct scst_dev_type *dev_type) @@ -2532,12 +2532,12 @@ static int vdisk_read_proc(struct seq_file *seq, struct scst_dev_type *dev_type) struct scst_vdisk_dev *virt_dev; TRACE_ENTRY(); - + if (mutex_lock_interruptible(&scst_vdisk_mutex) != 0) { res = -EINTR; goto out; } - + seq_printf(seq, "%-17s %-11s %-11s %-15s %s\n", "Name", "Size(MB)", "Block size", "Options", "File name"); @@ -2632,7 +2632,7 @@ static void vdisk_report_registering(const char *type, return; } -/* +/* * Called when a file in the /proc/VDISK_NAME/VDISK_NAME is written */ static int vdisk_write_proc(char *buffer, char **start, off_t offset, @@ -2646,12 +2646,12 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, size_t len; TRACE_ENTRY(); - + /* VERY UGLY code. You can rewrite it if you want */ if (buffer[0] == '\0') goto out; - + if (mutex_lock_interruptible(&scst_vdisk_mutex) != 0) { res = -EINTR; goto out; @@ -2750,7 +2750,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, } virt_dev->block_size = block_size; virt_dev->block_shift = block_shift; - + while (*p != '\0') { if (!strncmp("WRITE_THROUGH", p, 13)) { p += 13; @@ -2767,7 +2767,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, } else if (!strncmp("O_DIRECT", p, 8)) { p += 8; #if 0 - + virt_dev->o_direct_flag = 1; TRACE_DBG("%s", "O_DIRECT"); #else @@ -2854,7 +2854,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, goto out_up; } scst_unregister_virtual_device(virt_dev->virt_id); - PRINT_INFO("Virtual device %s unregistered", + PRINT_INFO("Virtual device %s unregistered", virt_dev->name); TRACE_DBG("virt_id %d unregister", virt_dev->virt_id); @@ -2995,7 +2995,7 @@ static int vcdrom_close(char *name) goto out; } scst_unregister_virtual_device(virt_dev->virt_id); - PRINT_INFO("Virtual device %s unregistered", + PRINT_INFO("Virtual device %s unregistered", virt_dev->name); TRACE_DBG("virt_id %d unregister", virt_dev->virt_id); @@ -3158,7 +3158,7 @@ out_free_resume: goto out_resume; } -/* +/* * Called when a file in the /proc/VCDROM_NAME/VCDROM_NAME is read */ static int vcdrom_read_proc(struct seq_file *seq, struct scst_dev_type *dev_type) @@ -3172,10 +3172,10 @@ static int vcdrom_read_proc(struct seq_file *seq, struct scst_dev_type *dev_type res = -EINTR; goto out; } - + seq_printf(seq, "%-17s %-9s %s\n", "Name", "Size(MB)", "File name"); - list_for_each_entry(virt_dev, &vcdrom_dev_list, + list_for_each_entry(virt_dev, &vcdrom_dev_list, vdisk_dev_list_entry) { seq_printf(seq, "%-17s %-9d %s\n", virt_dev->name, (uint32_t)(virt_dev->file_size >> 20), @@ -3189,8 +3189,8 @@ out: return res; } -/* - * Called when a file in the /proc/VCDROM_NAME/VCDROM_NAME is written +/* + * Called when a file in the /proc/VCDROM_NAME/VCDROM_NAME is written */ static int vcdrom_write_proc(char *buffer, char **start, off_t offset, int length, int *eof, struct scst_dev_type *dev_type) @@ -3205,7 +3205,7 @@ static int vcdrom_write_proc(char *buffer, char **start, off_t offset, res = -EINTR; goto out; } - + p = buffer; if (p[strlen(p) - 1] == '\n') { p[strlen(p) - 1] = '\0'; @@ -3290,7 +3290,7 @@ static int vdisk_proc_help_build(struct scst_dev_type *dev_type) TRACE_ENTRY(); root = scst_proc_get_dev_type_root(dev_type); - vdisk_help_proc_data.data = (dev_type->type == TYPE_DISK) ? + vdisk_help_proc_data.data = (dev_type->type == TYPE_DISK) ? vdisk_proc_help_string : vcdrom_proc_help_string; p = scst_create_proc_entry(root, VDISK_PROC_HELP, &vdisk_help_proc_data); @@ -3364,7 +3364,7 @@ static void exit_scst_vdisk(struct scst_dev_type *devtype, if (list_empty(vdisk_dev_list)) break; - + virt_dev = list_entry(vdisk_dev_list->next, typeof(*virt_dev), vdisk_dev_list_entry); diff --git a/scst/src/scst_cdbprobe.h b/scst/src/scst_cdbprobe.h index 10f92e895..5aa8aea9f 100644 --- a/scst/src/scst_cdbprobe.h +++ b/scst/src/scst_cdbprobe.h @@ -1,20 +1,20 @@ /* * scst_cdbprobe.h - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ - + /* Must be included in only one .c file in the project!! */ #ifndef __SCST_CDBPROBE_H @@ -42,7 +42,7 @@ static int get_trans_len_read_pos(struct scst_cmd *cmd, uint8_t off); +=========================================================+ |Key: M = command implementation is mandatory. | | O = command implementation is optional. | -| V = Vendor-specific | +| V = Vendor-specific | | R = Reserved | | ' '= DON'T use for this device | +=========================================================+ diff --git a/scst/src/scst_debug.c b/scst/src/scst_debug.c index 59cc03f9e..06393b7b3 100644 --- a/scst/src/scst_debug.c +++ b/scst/src/scst_debug.c @@ -1,17 +1,17 @@ /* * scst_debug.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar - * - * Contains helper functions for execution tracing and error reporting. + * + * Contains helper functions for execution tracing and error reporting. * Intended to be included in main .c file. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index bcbf42ef2..fc6e88280 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -1,14 +1,14 @@ /* * scst_lib.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -139,7 +139,7 @@ void scst_set_sense(uint8_t *buffer, int len, int key, return; } -void scst_set_cmd_error_sense(struct scst_cmd *cmd, uint8_t *sense, +void scst_set_cmd_error_sense(struct scst_cmd *cmd, uint8_t *sense, unsigned int len) { TRACE_ENTRY(); @@ -259,7 +259,7 @@ void scst_free_device(struct scst_device *dev) TRACE_ENTRY(); #ifdef EXTRACHECKS - if (!list_empty(&dev->dev_tgt_dev_list) || + if (!list_empty(&dev->dev_tgt_dev_list) || !list_empty(&dev->dev_acg_dev_list)) { PRINT_CRIT_ERROR("%s: dev_tgt_dev_list or dev_acg_dev_list " "is not empty!", __FUNCTION__); @@ -296,7 +296,7 @@ struct scst_acg_dev *scst_alloc_acg_dev(struct scst_acg *acg, res->dev = dev; res->acg = acg; res->lun = lun; - + out: TRACE_EXIT_HRES(res); return res; @@ -306,14 +306,14 @@ out: void scst_free_acg_dev(struct scst_acg_dev *acg_dev) { TRACE_ENTRY(); - - TRACE_DBG("Removing acg_dev %p from acg_dev_list and dev_acg_dev_list", + + TRACE_DBG("Removing acg_dev %p from acg_dev_list and dev_acg_dev_list", acg_dev); list_del(&acg_dev->acg_dev_list_entry); list_del(&acg_dev->dev_acg_dev_list_entry); - + kmem_cache_free(scst_acgd_cachep, acg_dev); - + TRACE_EXIT(); return; } @@ -335,10 +335,10 @@ struct scst_acg *scst_alloc_add_acg(const char *acg_name) INIT_LIST_HEAD(&acg->acg_sess_list); INIT_LIST_HEAD(&acg->acn_list); acg->acg_name = acg_name; - + TRACE_DBG("Adding acg %s to scst_acg_list", acg_name); list_add_tail(&acg->scst_acg_list_entry, &scst_acg_list); - + out: TRACE_EXIT_HRES(acg); return acg; @@ -361,9 +361,9 @@ int scst_destroy_acg(struct scst_acg *acg) TRACE_DBG("Removing acg %s from scst_acg_list", acg->acg_name); list_del(&acg->scst_acg_list_entry); - + /* Freeing acg_devs */ - list_for_each_entry_safe(acg_dev, acg_dev_tmp, &acg->acg_dev_list, + list_for_each_entry_safe(acg_dev, acg_dev_tmp, &acg->acg_dev_list, acg_dev_list_entry) { struct scst_tgt_dev *tgt_dev, *tt; list_for_each_entry_safe(tgt_dev, tt, @@ -376,7 +376,7 @@ int scst_destroy_acg(struct scst_acg *acg) } /* Freeing names */ - list_for_each_entry_safe(n, nn, &acg->acn_list, + list_for_each_entry_safe(n, nn, &acg->acn_list, acn_list_entry) { list_del(&n->acn_list_entry); kfree(n->name); @@ -422,13 +422,13 @@ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess, tgt_dev->acg_dev = acg_dev; tgt_dev->sess = sess; atomic_set(&tgt_dev->tgt_dev_cmd_count, 0); - + scst_sgv_pool_use_norm(tgt_dev); if (dev->scsi_dev != NULL) { ini_sg = dev->scsi_dev->host->sg_tablesize; ini_unchecked_isa_dma = dev->scsi_dev->host->unchecked_isa_dma; - ini_use_clustering = (dev->scsi_dev->host->use_clustering == + ini_use_clustering = (dev->scsi_dev->host->use_clustering == ENABLE_CLUSTERING); } else { ini_sg = (1 << 15) /* infinite */; @@ -437,9 +437,9 @@ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess, } tgt_dev->max_sg_cnt = min(ini_sg, sess->tgt->sg_tablesize); - if ((sess->tgt->tgtt->use_clustering || ini_use_clustering) && + if ((sess->tgt->tgtt->use_clustering || ini_use_clustering) && !sess->tgt->tgtt->no_clustering) { - scst_sgv_pool_use_norm_clust(tgt_dev); + scst_sgv_pool_use_norm_clust(tgt_dev); } if (sess->tgt->tgtt->unchecked_isa_dma || ini_unchecked_isa_dma) { @@ -452,12 +452,12 @@ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess, if (dev->scsi_dev != NULL) { 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, + "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); } else { - TRACE_MGMT_DBG("Virtual device %s on SCST lun=%Ld", + TRACE_MGMT_DBG("Virtual device %s on SCST lun=%Ld", dev->virt_name, (uint64_t)tgt_dev->lun); } @@ -474,7 +474,7 @@ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess, for(i = 0; i < (int)ARRAY_SIZE(tgt_dev->sn_slots); i++) atomic_set(&tgt_dev->sn_slots[i], 0); - if (dev->handler->parse_atomic && + if (dev->handler->parse_atomic && (sess->tgt->tgtt->preprocessing_done == NULL)) { if (sess->tgt->tgtt->rdy_to_xfer_atomic || (sess->tgt->tgtt->rdy_to_xfer == NULL)) @@ -531,13 +531,13 @@ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess, } } - spin_lock_bh(&dev->dev_lock); + spin_lock_bh(&dev->dev_lock); list_add_tail(&tgt_dev->dev_tgt_dev_list_entry, &dev->dev_tgt_dev_list); if (dev->dev_reserved) __set_bit(SCST_TGT_DEV_RESERVED, &tgt_dev->tgt_dev_flags); spin_unlock_bh(&dev->dev_lock); - sess_tgt_dev_list_head = + sess_tgt_dev_list_head = &sess->sess_tgt_dev_list_hash[HASH_VAL(tgt_dev->lun)]; list_add_tail(&tgt_dev->sess_tgt_dev_list_entry, sess_tgt_dev_list_head); @@ -631,7 +631,7 @@ int scst_sess_alloc_tgt_devs(struct scst_session *sess) TRACE_ENTRY(); - list_for_each_entry(acg_dev, &sess->acg->acg_dev_list, + list_for_each_entry(acg_dev, &sess->acg->acg_dev_list, acg_dev_list_entry) { tgt_dev = scst_alloc_add_tgt_dev(sess, acg_dev); if (tgt_dev == NULL) { @@ -656,7 +656,7 @@ void scst_sess_free_tgt_devs(struct scst_session *sess) struct scst_tgt_dev *tgt_dev, *t; TRACE_ENTRY(); - + /* The session is going down, no users, so no locks */ for(i = 0; i < TGT_DEV_HASH_SIZE; i++) { struct list_head *sess_tgt_dev_list_head = @@ -681,22 +681,22 @@ int scst_acg_add_dev(struct scst_acg *acg, struct scst_device *dev, lun_t lun, struct scst_tgt_dev *tgt_dev; struct scst_session *sess; LIST_HEAD(tmp_tgt_dev_list); - + TRACE_ENTRY(); - + INIT_LIST_HEAD(&tmp_tgt_dev_list); - + #ifdef EXTRACHECKS list_for_each_entry(acg_dev, &acg->acg_dev_list, acg_dev_list_entry) { if (acg_dev->dev == dev) { - PRINT_ERROR("Device is already in group %s", + PRINT_ERROR("Device is already in group %s", acg->acg_name); res = -EINVAL; goto out; } } #endif - + acg_dev = scst_alloc_acg_dev(acg, dev, lun); if (acg_dev == NULL) { res = -ENOMEM; @@ -704,12 +704,12 @@ int scst_acg_add_dev(struct scst_acg *acg, struct scst_device *dev, lun_t lun, } acg_dev->rd_only_flag = read_only; - TRACE_DBG("Adding acg_dev %p to acg_dev_list and dev_acg_dev_list", + TRACE_DBG("Adding acg_dev %p to acg_dev_list and dev_acg_dev_list", acg_dev); list_add_tail(&acg_dev->acg_dev_list_entry, &acg->acg_dev_list); list_add_tail(&acg_dev->dev_acg_dev_list_entry, &dev->dev_acg_dev_list); - - list_for_each_entry(sess, &acg->acg_sess_list, acg_sess_list_entry) + + list_for_each_entry(sess, &acg->acg_sess_list, acg_sess_list_entry) { tgt_dev = scst_alloc_add_tgt_dev(sess, acg_dev); if (tgt_dev == NULL) { @@ -753,16 +753,16 @@ int scst_acg_remove_dev(struct scst_acg *acg, struct scst_device *dev) int res = 0; struct scst_acg_dev *acg_dev = NULL, *a; struct scst_tgt_dev *tgt_dev, *tt; - + TRACE_ENTRY(); - + list_for_each_entry(a, &acg->acg_dev_list, acg_dev_list_entry) { if (a->dev == dev) { acg_dev = a; break; } } - + if (acg_dev == NULL) { PRINT_ERROR("Device is not found in group %s", acg->acg_name); res = -EINVAL; @@ -800,10 +800,10 @@ int scst_acg_add_name(struct scst_acg *acg, const char *name) struct scst_acn *n; int len; char *nm; - + TRACE_ENTRY(); - list_for_each_entry(n, &acg->acn_list, acn_list_entry) + list_for_each_entry(n, &acg->acn_list, acn_list_entry) { if (strcmp(n->name, name) == 0) { PRINT_ERROR("Name %s already exists in group %s", @@ -812,14 +812,14 @@ int scst_acg_add_name(struct scst_acg *acg, const char *name) goto out; } } - + n = kmalloc(sizeof(*n), GFP_KERNEL); if (n == NULL) { PRINT_ERROR("%s", "Unable to allocate scst_acn"); res = -ENOMEM; goto out; } - + len = strlen(name); nm = kmalloc(len + 1, GFP_KERNEL); if (nm == NULL) { @@ -827,10 +827,10 @@ int scst_acg_add_name(struct scst_acg *acg, const char *name) res = -ENOMEM; goto out_free; } - + strcpy(nm, name); n->name = nm; - + list_add_tail(&n->acn_list_entry, &acg->acn_list); out: @@ -851,9 +851,9 @@ int scst_acg_remove_name(struct scst_acg *acg, const char *name) { int res = -EINVAL; struct scst_acn *n; - + TRACE_ENTRY(); - + list_for_each_entry(n, &acg->acn_list, acn_list_entry) { if (strcmp(n->name, name) == 0) { @@ -864,7 +864,7 @@ int scst_acg_remove_name(struct scst_acg *acg, const char *name) break; } } - + if (res == 0) { PRINT_INFO("Removed name %s from group %s", name, acg->acg_name); @@ -977,7 +977,7 @@ struct scst_cmd *scst_complete_request_sense(struct scst_cmd *req_cmd) if (scsi_status_is_good(req_cmd->status) && (len > 0) && SCST_SENSE_VALID(buf) && (!SCST_NO_SENSE(buf))) { - PRINT_BUFF_FLAG(TRACE_SCSI, "REQUEST SENSE returned", + PRINT_BUFF_FLAG(TRACE_SCSI, "REQUEST SENSE returned", buf, len); scst_alloc_set_sense(orig_cmd, scst_cmd_atomic(req_cmd), buf, len); @@ -1023,7 +1023,7 @@ static void scst_send_release(struct scst_device *dev) uint8_t cdb[6]; TRACE_ENTRY(); - + if (dev->scsi_dev == NULL) goto out; @@ -1069,7 +1069,7 @@ static void scst_send_release(struct scst_device *dev) int rc, i; TRACE_ENTRY(); - + if (dev->scsi_dev == NULL) goto out; @@ -1189,10 +1189,10 @@ struct scst_session *scst_alloc_session(struct scst_tgt *tgt, int gfp_mask, PRINT_ERROR("%s", "Unable to allocate sess->initiator_name"); goto out_free; } - + strcpy(nm, initiator_name); sess->initiator_name = nm; - + out: TRACE_EXIT(); return sess; @@ -1261,7 +1261,7 @@ void scst_sched_session_free(struct scst_session *sess) TRACE_DBG("Adding sess %p to scst_sess_shut_list", sess); list_add_tail(&sess->sess_shut_list_entry, &scst_sess_shut_list); spin_unlock_irqrestore(&scst_mgmt_lock, flags); - + wake_up(&scst_mgmt_waitQ); TRACE_EXIT(); @@ -1418,13 +1418,13 @@ void scst_check_retries(struct scst_tgt *tgt) TRACE_ENTRY(); - /* - * We don't worry about overflow of finished_cmds, because we check - * only for its change + /* + * We don't worry about overflow of finished_cmds, because we check + * only for its change */ atomic_inc(&tgt->finished_cmds); smp_mb__after_atomic_inc(); - if (unlikely(tgt->retry_cmds > 0)) + if (unlikely(tgt->retry_cmds > 0)) { struct scst_cmd *c, *tc; unsigned long flags; @@ -1447,7 +1447,7 @@ void scst_check_retries(struct scst_tgt *tgt) need_wake_up++; if (need_wake_up >= 2) /* "slow start" */ - break; + break; } spin_unlock_irqrestore(&tgt->tgt_lock, flags); } @@ -1789,7 +1789,7 @@ int scst_get_cdb_info(struct scst_cmd *cmd) while (i < SCST_CDB_TBL_SIZE && scst_scsi_op_table[i].ops == op) { if (scst_scsi_op_table[i].devkey[dev_type] != SCST_CDB_NOTSUPP) { ptr = &scst_scsi_op_table[i]; - TRACE_DBG("op = 0x%02x+'%c%c%c%c%c%c%c%c%c%c'+<%s>", + TRACE_DBG("op = 0x%02x+'%c%c%c%c%c%c%c%c%c%c'+<%s>", ptr->ops, ptr->devkey[0], /* disk */ ptr->devkey[1], /* tape */ ptr->devkey[2], /* printer */ @@ -1854,7 +1854,7 @@ lun_t scst_unpack_lun(const uint8_t *lun, int len) if (len > 2) { switch(len) { case 8: - if ((*((uint64_t*)lun) & + if ((*((uint64_t*)lun) & __constant_cpu_to_be64(0x0000FFFFFFFFFFFFLL)) != 0) goto out_err; break; @@ -1941,7 +1941,7 @@ int scst_calc_block_shift(int sector_size) if (block_shift < 9) { PRINT_ERROR("Wrong sector size %d", sector_size); block_shift = -1; - } + } TRACE_EXIT_RES(block_shift); return block_shift; @@ -1953,7 +1953,7 @@ int scst_sbc_generic_parse(struct scst_cmd *cmd, int res = 0; TRACE_ENTRY(); - + /* * SCST sets good defaults for cmd->data_direction and cmd->bufflen, * therefore change them only if necessary @@ -1986,7 +1986,7 @@ int scst_sbc_generic_parse(struct scst_cmd *cmd, } if (cmd->op_flags & SCST_TRANSFER_LEN_TYPE_FIXED) { - /* + /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. */ @@ -2242,7 +2242,7 @@ int scst_tape_generic_dev_done(struct scst_cmd *cmd, * based on cmd->status and cmd->data_direction, therefore change * them only if necessary */ - + switch (opcode) { case MODE_SENSE: case MODE_SELECT: @@ -2278,7 +2278,7 @@ int scst_tape_generic_dev_done(struct scst_cmd *cmd, /* It's all good */ break; } - + switch (opcode) { case MODE_SENSE: case MODE_SELECT: @@ -2334,7 +2334,7 @@ int scst_obtain_device_parameters(struct scst_device *dev) memset(sense_buffer, 0, sizeof(sense_buffer)); TRACE(TRACE_SCSI, "%s", "Doing internal MODE_SENSE"); - res = scsi_execute(dev->scsi_dev, cmd, SCST_DATA_READ, buffer, + res = scsi_execute(dev->scsi_dev, cmd, SCST_DATA_READ, buffer, sizeof(buffer), sense_buffer, SCST_DEFAULT_TIMEOUT, 0, 0); @@ -2450,7 +2450,7 @@ void scst_process_reset(struct scst_device *dev, dev->dev_double_ua_possible = 1; dev->dev_serialized = 1; - list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, + list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { struct scst_session *sess = tgt_dev->sess; @@ -2461,12 +2461,12 @@ void scst_process_reset(struct scst_device *dev, spin_lock_irq(&sess->sess_list_lock); TRACE_DBG("Searching in search cmd list (sess=%p)", sess); - list_for_each_entry(cmd, &sess->search_cmd_list, + list_for_each_entry(cmd, &sess->search_cmd_list, search_cmd_list_entry) { if (cmd == exclude_cmd) continue; if ((cmd->tgt_dev == tgt_dev) || - ((cmd->tgt_dev == NULL) && + ((cmd->tgt_dev == NULL) && (cmd->lun == tgt_dev->lun))) { scst_abort_cmd(cmd, mcmd, (tgt_dev->sess != originator), 0); @@ -2626,7 +2626,7 @@ void scst_dev_check_set_local_UA(struct scst_device *dev, if (exclude != NULL) exclude_tgt_dev = exclude->tgt_dev; - list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, + list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { if (tgt_dev != exclude_tgt_dev) scst_check_set_UA(tgt_dev, sense, sense_len, 0); @@ -2663,7 +2663,7 @@ void scst_free_all_UA(struct scst_tgt_dev *tgt_dev) TRACE_ENTRY(); 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", + TRACE_MGMT_DBG("Clearing UA for tgt_dev lun %Ld", tgt_dev->lun); list_del(&UA_entry->UA_list_entry); kfree(UA_entry); @@ -2718,7 +2718,7 @@ restart: SCST_CMD_QUEUE_HEAD_OF_QUEUE); if (cmd->sn == expected_sn) { atomic_t *slot = cmd->sn_slot; - /* + /* * !! At this point any pointer in cmd, except !! * !! sn_slot and sn_cmd_list_entry, could be !! * !! already destroyed !! @@ -2728,7 +2728,7 @@ restart: tgt_dev->def_cmd_count--; list_del(&cmd->sn_cmd_list_entry); spin_unlock_irq(&tgt_dev->sn_lock); - if (test_and_set_bit(SCST_CMD_CAN_BE_DESTROYED, + if (test_and_set_bit(SCST_CMD_CAN_BE_DESTROYED, &cmd->cmd_flags)) { scst_destroy_put_cmd(cmd); } @@ -2827,7 +2827,7 @@ void scst_block_dev(struct scst_device *dev, int outstanding) TRACE_MGMT_DBG("Waiting during blocking outstanding %d (on_dev_count " "%d)", outstanding, atomic_read(&dev->on_dev_count)); - wait_event(dev->on_dev_waitQ, + wait_event(dev->on_dev_waitQ, atomic_read(&dev->on_dev_count) <= outstanding); TRACE_MGMT_DBG("%s", "wait_event() returned"); } @@ -2957,7 +2957,7 @@ void scst_unblock_cmds(struct scst_device *dev) list_for_each_entry_safe(cmd, t, &dev->blocked_cmd_list, blocked_cmd_list_entry) { int brk = 0; - /* + /* * Since only one cmd per time is being executed, expected_sn * can't change behind us, if the corresponding cmd is in * blocked_cmd_list, but we could be called before @@ -2973,7 +2973,7 @@ void scst_unblock_cmds(struct scst_device *dev) else if (cmd->sn != (expected_sn+1)) continue; } - + list_del(&cmd->blocked_cmd_list_entry); TRACE_MGMT_DBG("Adding cmd %p to head of active cmd list", cmd); spin_lock(&cmd->cmd_lists->cmd_list_lock); @@ -3096,7 +3096,7 @@ void scst_xmit_process_aborted_cmd(struct scst_cmd *cmd) /* It's completed and it's OK to return its result */ goto out; } - + if (cmd->dev->tas) { TRACE_MGMT_DBG("Flag ABORTED OTHER set for cmd %p " "(tag %llu), returning TASK ABORTED ", cmd, @@ -3204,7 +3204,7 @@ void tm_dbg_init_tgt_dev(struct scst_tgt_dev *tgt_dev, unsigned long flags; /* Do TM debugging only for LUN 0 */ spin_lock_irqsave(&scst_tm_dbg_lock, flags); - tm_dbg_p_cmd_list_waitQ = + tm_dbg_p_cmd_list_waitQ = &tgt_dev->dev->p_cmd_lists->cmd_list_waitQ; tm_dbg_state = INIT_TM_DBG_STATE; tm_dbg_on_state_passes = @@ -3288,7 +3288,7 @@ void tm_dbg_check_released_cmds(void) if (tm_dbg_flags.tm_dbg_release) { struct scst_cmd *cmd, *tc; spin_lock_irq(&scst_tm_dbg_lock); - list_for_each_entry_safe_reverse(cmd, tc, + list_for_each_entry_safe_reverse(cmd, tc, &tm_dbg_delayed_cmd_list, cmd_list_entry) { TRACE_MGMT_DBG("Releasing timed cmd %p (tag %llu), " "delayed_cmds_count=%d", cmd, cmd->tag, @@ -3336,7 +3336,7 @@ static void tm_dbg_change_state(void) tm_dbg_on_state_passes = tm_dbg_on_state_num_passes[tm_dbg_state]; } - + TRACE_MGMT_DBG("%s", "Deleting timer"); del_timer(&tm_dbg_timer); } @@ -3404,7 +3404,7 @@ void tm_dbg_release_cmd(struct scst_cmd *cmd) } spin_lock(&cmd->cmd_lists->cmd_list_lock); - list_move(&c->cmd_list_entry, + list_move(&c->cmd_list_entry, &c->cmd_lists->active_cmd_list); wake_up(&c->cmd_lists->cmd_list_waitQ); spin_unlock(&cmd->cmd_lists->cmd_list_lock); diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 2b2729bdc..a024724be 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -1,14 +1,14 @@ /* * scst_main.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -133,7 +133,7 @@ static int suspend_count; static int scst_virt_dev_last_id; /* protected by scst_mutex */ -/* +/* * This buffer and lock are intended to avoid memory allocation, which * could fail in improper places. */ @@ -147,7 +147,7 @@ module_param_named(scst_max_cmd_mem, scst_max_cmd_mem, long, 0); MODULE_PARM_DESC(scst_max_cmd_mem, "Maximum memory allowed to be consumed by " "the SCST commands at any given time in MB"); -struct scst_dev_type scst_null_devtype = +struct scst_dev_type scst_null_devtype = { name: "none", }; @@ -175,7 +175,7 @@ int __scst_register_target_template(struct scst_tgt_template *vtt, res = -EINVAL; goto out_err; } - + if (!vtt->release) { PRINT_ERROR("Target driver %s doesn't have a " "release() method.", vtt->name); @@ -539,14 +539,14 @@ out_up: if (res == 0) { 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, + "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("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, + "at scsi%d, channel %d, id %d, lun %d, type %d", + scsidp->host->host_no, scsidp->channel, scsidp->id, scsidp->lun, scsidp->type); } @@ -568,7 +568,7 @@ static void scst_unregister_device(struct scsi_device *scsidp) struct scst_acg_dev *acg_dev, *aa; TRACE_ENTRY(); - + scst_suspend_activity(); mutex_lock(&scst_mutex); @@ -585,9 +585,9 @@ static void scst_unregister_device(struct scsi_device *scsidp) } list_del(&dev->dev_list_entry); - + list_for_each_entry_safe(acg_dev, aa, &dev->dev_acg_dev_list, - dev_acg_dev_list_entry) + dev_acg_dev_list_entry) { scst_acg_remove_dev(acg_dev->acg, dev); } @@ -636,21 +636,21 @@ out: return res; } -int scst_register_virtual_device(struct scst_dev_type *dev_handler, +int scst_register_virtual_device(struct scst_dev_type *dev_handler, const char *dev_name) { int res, rc; struct scst_device *dev = NULL; TRACE_ENTRY(); - + if (dev_handler == NULL) { - PRINT_ERROR("%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("%s: device name must be non-NULL", __FUNCTION__); res = -EINVAL; @@ -696,7 +696,7 @@ out: if (res > 0) { PRINT_INFO("Attached SCSI target mid-level to virtual " "device %s (id %d)", dev_name, dev->virt_id); - } + } else { PRINT_INFO("Failed to attach SCSI target mid-level to " "virtual device %s", dev_name); @@ -734,9 +734,9 @@ void scst_unregister_virtual_device(int id) } list_del(&dev->dev_list_entry); - + list_for_each_entry_safe(acg_dev, aa, &dev->dev_acg_dev_list, - dev_acg_dev_list_entry) + dev_acg_dev_list_entry) { scst_acg_remove_dev(acg_dev->acg, dev); } @@ -1068,22 +1068,22 @@ out: } /* The activity supposed to be suspended and scst_mutex held */ -int scst_assign_dev_handler(struct scst_device *dev, +int scst_assign_dev_handler(struct scst_device *dev, struct scst_dev_type *handler) { int res = 0; struct scst_tgt_dev *tgt_dev; LIST_HEAD(attached_tgt_devs); - + TRACE_ENTRY(); sBUG_ON(handler == NULL); - + if (dev->handler == handler) goto out; - + if (dev->handler && dev->handler->detach_tgt) { - list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, + list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { TRACE_DBG("Calling dev handler's detach_tgt(%p)", tgt_dev); @@ -1118,9 +1118,9 @@ int scst_assign_dev_handler(struct scst_device *dev, } goto out_thr_null; } - + if (handler && handler->attach_tgt) { - list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, + list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { TRACE_DBG("Calling dev handler's attach_tgt(%p)", tgt_dev); @@ -1143,7 +1143,7 @@ out_thr_null: out_null: if (res != 0) dev->handler = &scst_null_devtype; - + out: TRACE_EXIT_RES(res); return res; @@ -1151,7 +1151,7 @@ out: out_err_detach_tgt: if (handler && handler->detach_tgt) { list_for_each_entry(tgt_dev, &attached_tgt_devs, - extra_tgt_dev_list_entry) + extra_tgt_dev_list_entry) { TRACE_DBG("Calling handler's detach_tgt(%p)", tgt_dev); @@ -1224,7 +1224,7 @@ int __scst_add_cmd_threads(int num) { int res = 0, i; static int scst_thread_num = 0; - + TRACE_ENTRY(); for (i = 0; i < num; i++) { @@ -1311,7 +1311,7 @@ static int scst_start_all_threads(int num) TRACE_ENTRY(); - mutex_lock(&scst_threads_info.cmd_threads_mutex); + mutex_lock(&scst_threads_info.cmd_threads_mutex); res = __scst_add_cmd_threads(num); if (res < 0) goto out; @@ -1346,7 +1346,7 @@ static int scst_start_all_threads(int num) out: mutex_unlock(&scst_threads_info.cmd_threads_mutex); TRACE_EXIT_RES(res); - return res; + return res; } void scst_get(void) @@ -1369,7 +1369,7 @@ static int scst_add(struct class_device *cdev, struct class_interface *intf) int res = 0; TRACE_ENTRY(); - + scsidp = to_scsi_device(cdev->dev); res = scst_register_device(scsidp); @@ -1538,10 +1538,10 @@ static int __init init_scst(void) scst_num_cpus = num_online_cpus(); /* ToDo: register_cpu_notifier() */ - + if (scst_threads == 0) scst_threads = scst_num_cpus; - + if (scst_threads < 1) { PRINT_ERROR("%s", "scst_threads can not be less than 1"); scst_threads = scst_num_cpus; @@ -1555,7 +1555,7 @@ static int __init init_scst(void) sizeof(struct s)); \ if (p == NULL) { res = -ENOMEM; goto o; } \ } while (0) - + INIT_CACHEP(scst_mgmt_cachep, scst_mgmt_cmd, out); INIT_CACHEP(scst_mgmt_stub_cachep, scst_mgmt_cmd_stub, out_destroy_mgmt_cache); @@ -1620,7 +1620,7 @@ static int __init init_scst(void) res = -ENOMEM; goto out_destroy_sgv_pool; } - + res = scsi_register_interface(&scst_interface); if (res != 0) goto out_free_acg; @@ -1712,7 +1712,7 @@ static void __exit exit_scst(void) DECLARE_MUTEX_LOCKED(shm); TRACE_ENTRY(); - + /* ToDo: unregister_cpu_notifier() */ scst_proc_cleanup_module(); diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index 87112edea..d1304b821 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -1,15 +1,15 @@ /* * scst_mem.c - * + * * Copyright (C) 2006-2007 Vladislav Bolkhovitin * Copyright (C) 2007 Krzysztof Blaszkowski * Copyright (C) 2007 CMS Distribution Limited - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -97,7 +97,7 @@ static int scst_check_clustering(struct scatterlist *sg, int cur, int hint) pfn = page_to_pfn(sg_page(&sg[i])); pfn_next = pfn + (sg[i].length >> PAGE_SHIFT); full_page = (sg[i].length & (PAGE_SIZE - 1)) == 0; - + if ((pfn == pfn_cur_next) && full_page_cur) goto out_head; @@ -110,7 +110,7 @@ static int scst_check_clustering(struct scatterlist *sg, int cur, int hint) pfn = page_to_pfn(sg_page(&sg[i])); pfn_next = pfn + (sg[i].length >> PAGE_SHIFT); full_page = (sg[i].length & (PAGE_SIZE - 1)) == 0; - + if ((pfn == pfn_cur_next) && full_page_cur) goto out_head; @@ -150,13 +150,13 @@ static void scst_free_sys_sg_entries(struct scatterlist *sg, int sg_count, int pages = (len >> PAGE_SHIFT) + ((len & ~PAGE_MASK) != 0); - TRACE_MEM("page %lx, len %d, pages %d", + TRACE_MEM("page %lx, len %d, pages %d", (unsigned long)p, len, pages); while(pages > 0) { int order = 0; -/* +/* * __free_pages() doesn't like freeing pages with not that order with * which they were allocated, so disable this small optimization. */ @@ -321,7 +321,7 @@ static void sgv_dtor_and_free(struct sgv_pool_obj *obj) } kfree(obj->sg_entries); } - + kmem_cache_free(obj->owner_pool->caches[obj->order], obj); return; } @@ -363,7 +363,7 @@ static struct sgv_pool_obj *sgv_pool_cached_get(struct sgv_pool *pool, } out: - return obj; + return obj; } static void sgv_pool_cached_put(struct sgv_pool_obj *sgv) @@ -400,13 +400,13 @@ static void sgv_pool_cached_put(struct sgv_pool_obj *sgv) &sgv_pools_mgr.mgr.sorted_recycling_list); sgv->recycle_entry.time_stamp = jiffies; - + sgv_pools_mgr.mgr.thr.inactive_pages_total += 1 << sgv->order; if (!sgv_pools_mgr.mgr.pitbool_running) { sgv_pools_mgr.mgr.pitbool_running = 1; sched = 1; } - + spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); if (sched) @@ -579,11 +579,11 @@ struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, order, gfp_mask) != 0)) goto out_fail_free; } - - if ((flags & SCST_POOL_NO_ALLOC_ON_CACHE_MISS) && + + if ((flags & SCST_POOL_NO_ALLOC_ON_CACHE_MISS) && (flags & SCST_POOL_RETURN_OBJ_ON_ALLOC_FAIL)) goto out_return; - + obj->allocator_priv = priv; if (sgv_pool_hiwmk_check(pages_to_alloc, no_fail) != 0) goto out_fail_free_sg_entries; @@ -607,10 +607,10 @@ struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, obj->sg_entries = obj->sg_entries_data; sg_init_table(obj->sg_entries, pages); - + if (sgv_pool_hiwmk_check(pages_to_alloc, no_fail) != 0) goto out_fail_free_sg_entries; - TRACE_MEM("Big or no_cached sgv_obj %p (size %d)", obj, sz); + TRACE_MEM("Big or no_cached sgv_obj %p (size %d)", obj, sz); } obj->sg_count = scst_alloc_sg_entries(obj->sg_entries, @@ -655,7 +655,7 @@ success: obj->orig_sg = sg; obj->orig_length = obj->sg_entries[sg].length; if (pool->clustered) { - obj->sg_entries[sg].length = + obj->sg_entries[sg].length = (pages - obj->trans_tbl[sg].pg_count) << PAGE_SHIFT; } } else { @@ -727,7 +727,7 @@ void *sgv_get_priv(struct sgv_pool_obj *sgv) void sgv_pool_free(struct sgv_pool_obj *sgv) { int order = sgv->order, pages; - + TRACE_MEM("Freeing sgv_obj %p, order %d, sg_entries %p, " "sg_count %d, allocator_priv %p", sgv, order, sgv->sg_entries, sgv->sg_count, sgv->allocator_priv); @@ -849,17 +849,17 @@ int sgv_pool_init(struct sgv_pool *pool, const char *name, int clustered) atomic_set(&pool->cache_acc[i].merged, 0); if (i <= sgv_pools_mgr.sgv_max_local_order) { - size = sizeof(*obj) + (1 << i) * + size = sizeof(*obj) + (1 << i) * (sizeof(obj->sg_entries[0]) + (clustered ? sizeof(obj->trans_tbl[0]) : 0)); } else if (i <= sgv_pools_mgr.sgv_max_trans_order) { - /* sgv ie sg_entries is allocated outside object but ttbl + /* sgv ie sg_entries is allocated outside object but ttbl is embedded still */ - size = sizeof(*obj) + (1 << i) * - ((clustered ? sizeof(obj->trans_tbl[0]) : 0)); + size = sizeof(*obj) + (1 << i) * + ((clustered ? sizeof(obj->trans_tbl[0]) : 0)); } else { size = sizeof(*obj); - + /* both sgv and ttbl are kallocated() */ } @@ -867,7 +867,7 @@ int sgv_pool_init(struct sgv_pool *pool, const char *name, int clustered) scnprintf(pool->cache_names[i], sizeof(pool->cache_names[i]), "%s-%luK", name, (PAGE_SIZE >> 10) << i); - pool->caches[i] = kmem_cache_create(pool->cache_names[i], + pool->caches[i] = kmem_cache_create(pool->cache_names[i], size, 0, SCST_SLAB_FLAGS, NULL #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) , NULL); @@ -921,11 +921,11 @@ static void sgv_pool_evaluate_local_order(struct scst_sgv_pools_manager *pmgr) TRACE_MEM("sgv_max_local_order %d, sgv_max_trans_order %d", pmgr->sgv_max_local_order, pmgr->sgv_max_trans_order); TRACE_MEM("max object size with embedded sgv & ttbl %zd", - (1 << pmgr->sgv_max_local_order) * + (1 << pmgr->sgv_max_local_order) * (sizeof(struct trans_tbl_ent) + sizeof(struct scatterlist)) + sizeof(struct sgv_pool_obj)); TRACE_MEM("max object size with embedded sgv (!clustered) %zd", - (1 << pmgr->sgv_max_local_order) * + (1 << pmgr->sgv_max_local_order) * (sizeof(struct scatterlist)) + sizeof(struct sgv_pool_obj)); TRACE_MEM("max object size with embedded ttbl %zd", @@ -945,13 +945,13 @@ void sgv_pool_deinit(struct sgv_pool *pool) for(i = 0; i < SGV_POOL_ELEMENTS; i++) { struct sgv_pool_obj *e; - - spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); + + spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); while(!list_empty(&pool->recycling_lists[i])) { e = list_entry(pool->recycling_lists[i].next, struct sgv_pool_obj, recycle_entry.recycling_list_entry); - + __sgv_pool_cached_purge(e); spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); @@ -961,7 +961,7 @@ void sgv_pool_deinit(struct sgv_pool *pool) spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); } spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); - + if (pool->caches[i]) kmem_cache_destroy(pool->caches[i]); pool->caches[i] = NULL; @@ -1021,11 +1021,11 @@ static int sgv_pool_cached_shrinker(int nr, gfp_t gfpm) TRACE_ENTRY(); spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); - + if (nr > 0) { struct sgv_pool_obj *e; unsigned long rt = jiffies; - + while(!list_empty(&sgv_pools_mgr.mgr.sorted_recycling_list)) { e = list_entry( sgv_pools_mgr.mgr.sorted_recycling_list.next, @@ -1037,14 +1037,14 @@ static int sgv_pool_cached_shrinker(int nr, gfp_t gfpm) spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); sgv_dtor_and_free(e); spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); - } else + } else break; - - if (nr <= 0) + + if (nr <= 0) break; } } - + nr = sgv_pools_mgr.mgr.thr.inactive_pages_total; spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); @@ -1074,19 +1074,19 @@ static void sgv_pool_cached_pitbool(void *p) spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); sgv_dtor_and_free(e); spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); - } else + } else break; } - + total_pages = sgv_pools_mgr.mgr.thr.inactive_pages_total; spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); - + if (total_pages) { schedule_delayed_work(&sgv_pools_mgr.mgr.apit_pool, PURGE_INTERVAL); } - + TRACE_EXIT(); return; } @@ -1110,7 +1110,7 @@ int scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmark) atomic_set(&pools->sgv_other_total_alloc, 0); INIT_LIST_HEAD(&pools->scst_sgv_pool_list); mutex_init(&pools->scst_sgv_pool_mutex); - + INIT_LIST_HEAD(&pools->mgr.sorted_recycling_list); spin_lock_init(&pools->mgr.pool_mgr_lock); @@ -1196,7 +1196,7 @@ static void scst_do_sgv_read(struct seq_file *seq, const struct sgv_pool *pool) { int i, total = 0, hit = 0, merged = 0, allocated = 0; int oa, om; - + for(i = 0; i < SGV_POOL_ELEMENTS; i++) { int t; diff --git a/scst/src/scst_mem.h b/scst/src/scst_mem.h index 752544c5b..8f54142f3 100644 --- a/scst/src/scst_mem.h +++ b/scst/src/scst_mem.h @@ -1,13 +1,13 @@ /* * scst_mem.h - * + * * Copyright (C) 2006-2007 Vladislav Bolkhovitin - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -20,7 +20,7 @@ #define SGV_POOL_ELEMENTS 11 -/* +/* * sg_num is indexed by the page number, pg_count is indexed by the sg number. * Made in one entry to simplify the code (eg all sizeof(*) parts) and save * some CPU cache for non-clustered case. @@ -33,7 +33,7 @@ struct trans_tbl_ent { struct sgv_pool_obj { int order; - + struct { unsigned long time_stamp; /* jiffies, protected by pool_mgr_lock */ struct list_head recycling_list_entry; @@ -102,25 +102,25 @@ struct scst_sgv_pools_manager struct sgv_pool_mgr { spinlock_t pool_mgr_lock; struct list_head sorted_recycling_list; /* protected by pool_mgr_lock */ - int pitbool_running:1; /* protected by pool_mgr_lock */ + int pitbool_running:1; /* protected by pool_mgr_lock */ struct sgv_mem_throttling { - u32 inactive_pages_total; + u32 inactive_pages_total; atomic_t active_pages_total; - + u32 hi_wmk; /* compared against inactive_pages_total + active_pages_total */ u32 lo_wmk; /* compared against inactive_pages_total only */ - + u32 releases_on_hiwmk; u32 releases_failed; } thr; /* protected by pool_mgr_lock */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) struct shrinker *sgv_shrinker; #else struct shrinker sgv_shrinker; #endif - + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) struct delayed_work apit_pool; #else @@ -129,13 +129,13 @@ struct scst_sgv_pools_manager } mgr; int sgv_max_local_order, sgv_max_trans_order; - + atomic_t sgv_other_total_alloc; struct mutex scst_sgv_pool_mutex; struct list_head scst_sgv_pool_list; }; -int sgv_pool_init(struct sgv_pool *pool, const char *name, +int sgv_pool_init(struct sgv_pool *pool, const char *name, int clustered); void sgv_pool_deinit(struct sgv_pool *pool); diff --git a/scst/src/scst_module.c b/scst/src/scst_module.c index f36457826..75061a4b4 100644 --- a/scst/src/scst_module.c +++ b/scst/src/scst_module.c @@ -1,16 +1,16 @@ /* * scst_module.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar * * Support for loading target modules. The usage is similar to scsi_module.c - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -27,7 +27,7 @@ static int __init init_this_scst_driver(void) int res; TRACE_ENTRY(); - + res = scst_register_target_template(&driver_target_template); TRACE_DBG("scst_register_target_template() returned %d", res); if (res < 0) @@ -59,7 +59,7 @@ static void __exit exit_this_scst_driver(void) #endif scst_unregister_target_template(&driver_target_template); - + TRACE_EXIT(); return; } diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 48ba7115b..6d1f0cf74 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -1,14 +1,14 @@ /* * scst_priv.h - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -39,7 +39,7 @@ #define TRACE_RTRY 0x80000000 #define TRACE_SCSI_SERIALIZING 0x40000000 #define TRACE_SND_TOP 0x20000000 /** top being the edge away from the interupt */ -#define TRACE_RCV_TOP 0x01000000 +#define TRACE_RCV_TOP 0x01000000 #define TRACE_SND_BOT 0x08000000 /** bottom being the edge toward the interupt */ #define TRACE_RCV_BOT 0x04000000 @@ -83,10 +83,10 @@ extern unsigned long scst_trace_flag; #endif /** - ** Bits for scst_flags + ** Bits for scst_flags **/ -/* +/* * Set if new commands initialization is being suspended for a while. * Used to let TM commands execute while preparing the suspend, since * RESET or ABORT could be necessary to free SCSI commands. @@ -96,8 +96,8 @@ extern unsigned long scst_trace_flag; /* Set if new commands initialization is suspended for a while */ #define SCST_FLAG_SUSPENDED 1 -/** - ** Return codes for cmd state process functions +/** + ** Return codes for cmd state process functions **/ #define SCST_CMD_STATE_RES_CONT_SAME 0 #define SCST_CMD_STATE_RES_CONT_NEXT 1 @@ -107,7 +107,7 @@ extern unsigned long scst_trace_flag; #define SCST_DEFAULT_ACG_NAME "Default" /** - ** Maximum count of uncompleted commands that an initiator could + ** Maximum count of uncompleted commands that an initiator could ** queue on any device. Then it will start getting TASK QUEUE FULL status. **/ #define SCST_MAX_TGT_DEV_COMMANDS 48 @@ -299,7 +299,7 @@ void scst_free_internal_cmd(struct scst_cmd *cmd); int scst_prepare_request_sense(struct scst_cmd *orig_cmd); struct scst_cmd *scst_complete_request_sense(struct scst_cmd *cmd); -int scst_assign_dev_handler(struct scst_device *dev, +int scst_assign_dev_handler(struct scst_device *dev, struct scst_dev_type *handler); struct scst_session *scst_alloc_session(struct scst_tgt *tgt, int gfp_mask, @@ -324,8 +324,8 @@ void scst_tgt_retry_timer_fn(unsigned long arg); int scst_alloc_request(struct scst_cmd *cmd); void scst_release_request(struct scst_cmd *cmd); -static inline void scst_do_req(struct scsi_request *sreq, - const void *cmnd, void *buffer, unsigned bufflen, +static inline void scst_do_req(struct scsi_request *sreq, + const void *cmnd, void *buffer, unsigned bufflen, void (*done)(struct scsi_cmnd *), int timeout, int retries) { #ifdef STRICT_SERIALIZING @@ -361,7 +361,7 @@ void scst_scsi_op_list_init(void); lun_t scst_unpack_lun(const uint8_t *lun, int len); -struct scst_cmd *__scst_find_cmd_by_tag(struct scst_session *sess, +struct scst_cmd *__scst_find_cmd_by_tag(struct scst_session *sess, uint64_t tag); struct scst_mgmt_cmd *scst_alloc_mgmt_cmd(int gfp_mask); @@ -408,7 +408,7 @@ void scst_process_reset(struct scst_device *dev, static inline int scst_is_ua_command(struct scst_cmd *cmd) { - return ((cmd->cdb[0] != INQUIRY) && + return ((cmd->cdb[0] != INQUIRY) && (cmd->cdb[0] != REQUEST_SENSE) && (cmd->cdb[0] != REPORT_LUNS)); } @@ -425,8 +425,8 @@ static inline int scst_is_implicit_hq(struct scst_cmd *cmd) /* * Some notes on devices "blocking". Blocking means that no - * commands will go from SCST to underlying SCSI device until it - * is unblocked. But we don't care about all commands that + * commands will go from SCST to underlying SCSI device until it + * is unblocked. But we don't care about all commands that * already on the device. */ diff --git a/scst/src/scst_proc.c b/scst/src/scst_proc.c index 4a1ffdd99..73cb2b1d3 100644 --- a/scst/src/scst_proc.c +++ b/scst/src/scst_proc.c @@ -1,14 +1,14 @@ /* * scst_proc.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -52,9 +52,9 @@ static struct scst_proc_data scst_threads_proc_data; static struct scst_proc_data scst_scsi_tgt_proc_data; static struct scst_proc_data scst_dev_handler_proc_data; -/* - * Must be less than 4K page size, since our output routines - * use some slack for overruns +/* + * Must be less than 4K page size, since our output routines + * use some slack for overruns */ #define SCST_PROC_BLOCK_SIZE (PAGE_SIZE - 512) @@ -395,7 +395,7 @@ static int lat_info_show(struct seq_file *seq, void *v) goto out; } - seq_printf(seq, "%-20s %-45s %-15s %15s\n", "Target name", "Initiator name", + seq_printf(seq, "%-20s %-45s %-15s %15s\n", "Target name", "Initiator name", "SCST latency", "Processing latency (us)"); list_for_each_entry(acg, &scst_acg_list, scst_acg_list_entry) { @@ -685,7 +685,7 @@ static int __init scst_proc_init_groups(void) goto out_nomem; } - res = scst_proc_group_add_tree(scst_default_acg, + res = scst_proc_group_add_tree(scst_default_acg, SCST_DEFAULT_ACG_NAME); if (res != 0) goto out_remove; @@ -716,7 +716,7 @@ static void scst_proc_cleanup_groups(void) scst_proc_del_acg_tree(scst_default_acg->acg_proc_root, SCST_DEFAULT_ACG_NAME); - TRACE_DBG("remove_proc_entry(%s, %p)", + TRACE_DBG("remove_proc_entry(%s, %p)", SCST_PROC_GROUPS_ENTRY_NAME, scst_proc_scsi_tgt); remove_proc_entry(SCST_PROC_GROUPS_ENTRY_NAME, scst_proc_scsi_tgt); @@ -1416,7 +1416,7 @@ static int scst_proc_assign_handler(char *buf) if (dev->scsi_dev->type != handler->type) { PRINT_ERROR("Type %d of device %s differs from type " - "%d of dev handler %s", dev->handler->type, + "%d of dev handler %s", dev->handler->type, dev->handler->name, handler->type, handler->name); res = -EINVAL; goto out; @@ -1521,7 +1521,7 @@ static ssize_t scst_proc_groups_devices_write(struct file *file, const char __us } *e = 0; } - + list_for_each_entry(d, &scst_dev_list, dev_list_entry) { if (virt) { if (d->virt_id && !strcmp(d->virt_name, p)) { @@ -1711,7 +1711,7 @@ static ssize_t scst_proc_groups_names_write(struct file *file, const char __user scst_acg_remove_name(acg, p); break; case SCST_PROC_ACTION_CLEAR: - list_for_each_entry_safe(n, nn, &acg->acn_list, + list_for_each_entry_safe(n, nn, &acg->acn_list, acn_list_entry) { list_del(&n->acn_list_entry); kfree(n->name); @@ -1839,7 +1839,7 @@ static int scst_sessions_info_show(struct seq_file *seq, void *v) goto out; } - seq_printf(seq, "%-20s %-45s %-35s %-15s\n", "Target name", "Initiator name", + seq_printf(seq, "%-20s %-45s %-35s %-15s\n", "Target name", "Initiator name", "Group name", "Command Count"); list_for_each_entry(acg, &scst_acg_list, scst_acg_list_entry) { @@ -1951,7 +1951,7 @@ static struct scst_proc_data scst_groups_devices_proc_data = { #if defined(DEBUG) || defined(TRACING) -int scst_proc_read_tlb(const struct scst_proc_log *tbl, struct seq_file *seq, +int scst_proc_read_tlb(const struct scst_proc_log *tbl, struct seq_file *seq, unsigned long log_level, int *first) { const struct scst_proc_log *t = tbl; diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 622539147..10c1e0c37 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -1,14 +1,14 @@ /* * scst_targ.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -49,8 +49,8 @@ static inline void scst_schedule_tasklet(struct scst_cmd *cmd) tasklet_schedule(&t->tasklet); } -/* - * Must not be called in parallel with scst_unregister_session_ex() for the +/* + * Must not be called in parallel with scst_unregister_session_ex() for the * same sess */ struct scst_cmd *scst_rx_cmd(struct scst_session *sess, @@ -78,7 +78,7 @@ struct scst_cmd *scst_rx_cmd(struct scst_session *sess, cmd->start_time = jiffies; - /* + /* * For both wrong lun and CDB defer the error reporting for * scst_cmd_init_done() */ @@ -122,7 +122,7 @@ static int scst_init_cmd(struct scst_cmd *cmd, int context) /* Small context optimization */ if (((context == SCST_CONTEXT_TASKLET) || - (context == SCST_CONTEXT_DIRECT_ATOMIC)) && + (context == SCST_CONTEXT_DIRECT_ATOMIC)) && scst_cmd_is_expected_set(cmd)) { if (cmd->expected_data_direction == SCST_DATA_WRITE) { if ( !test_bit(SCST_TGT_DEV_AFTER_INIT_WR_ATOMIC, @@ -142,7 +142,7 @@ out: out_redirect: if (cmd->preprocessing_only) { /* - * Poor man solution for single threaded targets, where + * Poor man solution for single threaded targets, where * blocking receiver at least sometimes means blocking all. */ sBUG_ON(context != SCST_CONTEXT_DIRECT); @@ -194,7 +194,7 @@ 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, + TRACE(TRACE_SCSI, "tag=%llu, lun=%Ld, CDB len=%d", cmd->tag, (uint64_t)cmd->lun, cmd->cdb_len); PRINT_BUFF_FLAG(TRACE_SCSI|TRACE_RCV_BOT, "Recieving CDB", cmd->cdb, cmd->cdb_len); @@ -229,7 +229,7 @@ void scst_cmd_init_done(struct scst_cmd *cmd, int pref_context) break; case SCST_SESS_IPH_INITING: TRACE_DBG("Adding cmd %p to init deferred cmd list", cmd); - list_add_tail(&cmd->cmd_list_entry, + list_add_tail(&cmd->cmd_list_entry, &sess->init_deferred_cmd_list); spin_unlock_irqrestore(&sess->sess_list_lock, flags); goto out; @@ -351,7 +351,7 @@ static int scst_pre_parse(struct scst_cmd *cmd) cmd->expected_data_direction, cmd->expected_transfer_len); cmd->data_direction = cmd->expected_data_direction; - + cmd->bufflen = cmd->expected_transfer_len; /* Restore (likely) lost CDB length */ cmd->cdb_len = scst_get_cdb_len(cmd->cdb); @@ -496,7 +496,7 @@ static int scst_parse_cmd(struct scst_cmd *cmd) ((cmd->sg == NULL) && (state > SCST_CMD_STATE_PREPARE_SPACE)))) { PRINT_ERROR("Dev handler %s parse() returned " "invalid cmd data_direction %d, bufflen %d, state %d " - "or sg %p (opcode 0x%x)", dev->handler->name, + "or sg %p (opcode 0x%x)", dev->handler->name, cmd->data_direction, cmd->bufflen, state, cmd->sg, cmd->cdb[0]); PRINT_BUFFER("Failed CDB", cmd->cdb, cmd->cdb_len); @@ -579,11 +579,11 @@ set_res: default: if (state >= 0) { PRINT_ERROR("Dev handler %s parse() returned " - "invalid cmd state %d (opcode %d)", + "invalid cmd state %d (opcode %d)", dev->handler->name, state, cmd->cdb[0]); } else { PRINT_ERROR("Dev handler %s parse() returned " - "error %d (opcode %d)", dev->handler->name, + "error %d (opcode %d)", dev->handler->name, state, cmd->cdb[0]); } goto out_error; @@ -595,7 +595,7 @@ set_res: else cmd->resp_data_len = 0; } - + out: TRACE_EXIT_HRES(res); return res; @@ -653,7 +653,7 @@ alloc: r = scst_alloc_space(cmd); else TRACE_MEM("%s", "data_buf_alloced set, returning"); - + check: if (r != 0) { if (scst_cmd_atomic(cmd)) { @@ -744,7 +744,7 @@ void scst_restart_cmd(struct scst_cmd *cmd, int status, int pref_context) if (cmd->set_sn_on_restart_cmd) scst_cmd_set_sn(cmd); /* Small context optimization */ - if ((pref_context == SCST_CONTEXT_TASKLET) || + if ((pref_context == SCST_CONTEXT_TASKLET) || (pref_context == SCST_CONTEXT_DIRECT_ATOMIC)) { if (cmd->data_direction == SCST_DATA_WRITE) { if ( !test_bit(SCST_TGT_DEV_AFTER_RESTART_WR_ATOMIC, @@ -975,9 +975,9 @@ void scst_rx_data(struct scst_cmd *cmd, int status, int pref_context) case SCST_RX_STATUS_SUCCESS: cmd->state = SCST_CMD_STATE_TGT_PRE_EXEC; /* Small context optimization */ - if ((pref_context == SCST_CONTEXT_TASKLET) || + if ((pref_context == SCST_CONTEXT_TASKLET) || (pref_context == SCST_CONTEXT_DIRECT_ATOMIC)) { - if ( !test_bit(SCST_TGT_DEV_AFTER_RX_DATA_ATOMIC, + if ( !test_bit(SCST_TGT_DEV_AFTER_RX_DATA_ATOMIC, &cmd->tgt_dev->tgt_dev_flags)) pref_context = SCST_CONTEXT_THREAD; } @@ -1104,9 +1104,9 @@ static void scst_do_cmd_done(struct scst_cmd *cmd, int result, static inline int scst_optimize_post_exec_context(struct scst_cmd *cmd, int context) { - if ((context == SCST_CONTEXT_TASKLET) || + if ((context == SCST_CONTEXT_TASKLET) || (context == SCST_CONTEXT_DIRECT_ATOMIC)) { - if ( !test_bit(SCST_TGT_DEV_AFTER_EXEC_ATOMIC, + if ( !test_bit(SCST_TGT_DEV_AFTER_EXEC_ATOMIC, &cmd->tgt_dev->tgt_dev_flags)) context = SCST_CONTEXT_THREAD; } @@ -1216,7 +1216,7 @@ static void scst_cmd_done_local(struct scst_cmd *cmd, int next_state) TRACE_RECV_TOP("Exec'd %d S/G(s) at %p sg[0].page at " "%p", cmd->sg_cnt, sg, (void*)sg_page(&sg[0])); for(i = 0; i < cmd->sg_cnt; ++i) { - TRACE_BUFF_FLAG(TRACE_RCV_TOP, + TRACE_BUFF_FLAG(TRACE_RCV_TOP, "Exec'd sg", sg_virt(&sg[i]), sg[i].length); } @@ -1228,7 +1228,7 @@ static void scst_cmd_done_local(struct scst_cmd *cmd, int next_state) #ifdef EXTRACHECKS if ((next_state != SCST_CMD_STATE_PRE_DEV_DONE) && (next_state != SCST_CMD_STATE_PRE_XMIT_RESP) && - (next_state != SCST_CMD_STATE_FINISHED)) + (next_state != SCST_CMD_STATE_FINISHED)) { PRINT_ERROR("scst_cmd_done_local() received invalid cmd " "state %d (opcode %d)", next_state, cmd->cdb[0]); @@ -1345,7 +1345,7 @@ out_done: TRACE_EXIT(); return SCST_EXEC_COMPLETED; - + out_put_err: scst_put_buf(cmd, buffer); @@ -1431,13 +1431,13 @@ static int scst_reserve_local(struct scst_cmd *cmd) list_for_each_entry(tgt_dev_tmp, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { if (cmd->tgt_dev != tgt_dev_tmp) - set_bit(SCST_TGT_DEV_RESERVED, + set_bit(SCST_TGT_DEV_RESERVED, &tgt_dev_tmp->tgt_dev_flags); } dev->dev_reserved = 1; spin_unlock_bh(&dev->dev_lock); - + out: TRACE_EXIT_RES(res); return res; @@ -1478,9 +1478,9 @@ static int scst_release_local(struct scst_cmd *cmd) spin_lock_bh(&dev->dev_lock); - /* - * The device could be RELEASED behind us, if RESERVING session - * is closed (see scst_free_tgt_dev()), but this actually doesn't + /* + * The device could be RELEASED behind us, if RESERVING session + * is closed (see scst_free_tgt_dev()), but this actually doesn't * matter, so use lock and no retest for DEV_RESERVED bits again */ if (test_bit(SCST_TGT_DEV_RESERVED, &cmd->tgt_dev->tgt_dev_flags)) { @@ -1494,7 +1494,7 @@ static int scst_release_local(struct scst_cmd *cmd) list_for_each_entry(tgt_dev_tmp, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { - clear_bit(SCST_TGT_DEV_RESERVED, + clear_bit(SCST_TGT_DEV_RESERVED, &tgt_dev_tmp->tgt_dev_flags); } dev->dev_reserved = 0; @@ -1565,7 +1565,7 @@ int scst_check_local_events(struct scst_cmd *cmd) } } - if (unlikely(test_bit(SCST_TGT_DEV_UA_PENDING, + if (unlikely(test_bit(SCST_TGT_DEV_UA_PENDING, &cmd->tgt_dev->tgt_dev_flags))) { if (scst_is_ua_command(cmd)) { rc = scst_set_pending_UA(cmd); @@ -1590,9 +1590,9 @@ out_uncomplete: goto out; } -/* - * The result of cmd execution, if any, should be reported - * via scst_cmd_done_local() +/* + * The result of cmd execution, if any, should be reported + * via scst_cmd_done_local() */ static int scst_pre_exec(struct scst_cmd *cmd) { @@ -1634,9 +1634,9 @@ out_done: goto out; } -/* - * The result of cmd execution, if any, should be reported - * via scst_cmd_done_local() +/* + * The result of cmd execution, if any, should be reported + * via scst_cmd_done_local() */ static inline int scst_local_exec(struct scst_cmd *cmd) { @@ -1725,7 +1725,7 @@ static int scst_do_send_to_midlev(struct scst_cmd *cmd) } TRACE_DBG("Sending cmd %p to SCSI mid-level", cmd); - + if (unlikely(dev->scsi_dev == NULL)) { PRINT_ERROR("Command for virtual device must be " "processed by device handler (lun %Ld)!", @@ -1747,7 +1747,7 @@ static int scst_do_send_to_midlev(struct scst_cmd *cmd) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) if (unlikely(scst_alloc_request(cmd) != 0)) { if (scst_cmd_atomic(cmd)) { rc = SCST_EXEC_NEED_THREAD; @@ -1758,7 +1758,7 @@ static int scst_do_send_to_midlev(struct scst_cmd *cmd) goto out_busy; } } - + scst_do_req(cmd->scsi_req, (void *)cmd->cdb, (void *)cmd->scsi_req->sr_buffer, cmd->scsi_req->sr_bufflen, scst_cmd_done, cmd->timeout, @@ -1799,7 +1799,7 @@ out_rc_error: out_error: scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) out_busy: scst_set_busy(cmd); /* go through */ @@ -1837,14 +1837,14 @@ void scst_inc_expected_sn(struct scst_tgt_dev *tgt_dev, atomic_t *slot) tgt_dev->num_free_sn_slots++; TRACE_SN("Incremented num_free_sn_slots (%d)", tgt_dev->num_free_sn_slots); - + } spin_unlock_irq(&tgt_dev->sn_lock); } inc: /* - * No locks is needed, because only one thread at time can + * No locks is needed, because only one thread at time can * be here (serialized by sn). Also it is supposed that there * could not be half-incremented halves. */ @@ -2049,7 +2049,7 @@ static int scst_check_sense(struct scst_cmd *cmd) spin_unlock_bh(&dev->dev_lock); } - if (unlikely(cmd->status == SAM_STAT_CHECK_CONDITION) && + if (unlikely(cmd->status == SAM_STAT_CHECK_CONDITION) && SCST_SENSE_VALID(cmd->sense)) { PRINT_BUFF_FLAG(TRACE_SCSI, "Sense", cmd->sense, SCST_SENSE_BUFFERSIZE); @@ -2058,7 +2058,7 @@ static int scst_check_sense(struct scst_cmd *cmd) if (cmd->sense[12] == SCST_SENSE_ASC_UA_RESET) { if (dbl_ua_possible) { if (ua_sent) { - TRACE(TRACE_MGMT_MINOR, "%s", + TRACE(TRACE_MGMT_MINOR, "%s", "Double UA detected"); /* Do retry */ TRACE(TRACE_MGMT_MINOR, "Retrying cmd %p " @@ -2072,7 +2072,7 @@ static int scst_check_sense(struct scst_cmd *cmd) cmd->retry = 1; cmd->state = SCST_CMD_STATE_SEND_TO_MIDLEV; res = 1; - /* + /* * Dev is still blocked by this cmd, so * it's OK to clear SCST_DEV_SERIALIZED * here. @@ -2200,7 +2200,7 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) scst_put_buf(cmd, address); } - /* + /* * Check and clear NormACA option for the device, if necessary, * since we don't support ACA */ @@ -2216,7 +2216,7 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) #ifdef EXTRACHECKS if (buffer[SCST_INQ_BYTE3] & SCST_INQ_NORMACA_BIT) { PRINT_INFO("NormACA set for device: " - "lun=%Ld, type 0x%02x", + "lun=%Ld, type 0x%02x", (uint64_t)cmd->lun, buffer[0]); } #endif @@ -2231,7 +2231,7 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) scst_put_buf(cmd, buffer); } - if (unlikely((cmd->cdb[0] == MODE_SELECT) || + if (unlikely((cmd->cdb[0] == MODE_SELECT) || (cmd->cdb[0] == MODE_SELECT_10) || (cmd->cdb[0] == LOG_SELECT))) { TRACE(TRACE_SCSI, "MODE/LOG SELECT succeeded (LUN %Ld)", @@ -2257,7 +2257,7 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) spin_lock_bh(&dev->dev_lock); list_for_each_entry(tgt_dev_tmp, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { - clear_bit(SCST_TGT_DEV_RESERVED, + clear_bit(SCST_TGT_DEV_RESERVED, &tgt_dev_tmp->tgt_dev_flags); } dev->dev_reserved = 0; @@ -2267,7 +2267,7 @@ static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) /* Check for MODE PARAMETERS CHANGED UA */ if ((cmd->dev->scsi_dev != NULL) && - (cmd->status == SAM_STAT_CHECK_CONDITION) && + (cmd->status == SAM_STAT_CHECK_CONDITION) && SCST_SENSE_VALID(cmd->sense) && scst_is_ua_sense(cmd->sense) && (cmd->sense[12] == 0x2a) && (cmd->sense[13] == 0x01)) { @@ -2310,7 +2310,7 @@ static int scst_mode_select_checks(struct scst_cmd *cmd) TRACE_ENTRY(); if (likely(scsi_status_is_good(cmd->status))) { - if (unlikely((cmd->cdb[0] == MODE_SELECT) || + if (unlikely((cmd->cdb[0] == MODE_SELECT) || (cmd->cdb[0] == MODE_SELECT_10) || (cmd->cdb[0] == LOG_SELECT))) { struct scst_device *dev = cmd->dev; @@ -2322,7 +2322,7 @@ static int scst_mode_select_checks(struct scst_cmd *cmd) } TRACE(TRACE_SCSI, "MODE/LOG SELECT succeeded, " - "setting the SELECT UA (lun=%Ld)", + "setting the SELECT UA (lun=%Ld)", (uint64_t)cmd->lun); spin_lock_bh(&dev->dev_lock); @@ -2344,7 +2344,7 @@ static int scst_mode_select_checks(struct scst_cmd *cmd) if (dev->scsi_dev != NULL) scst_obtain_device_parameters(dev); } - } else if ((cmd->status == SAM_STAT_CHECK_CONDITION) && + } else if ((cmd->status == SAM_STAT_CHECK_CONDITION) && SCST_SENSE_VALID(cmd->sense) && scst_is_ua_sense(cmd->sense) && (((cmd->sense[12] == 0x2a) && (cmd->sense[13] == 0x01)) || @@ -2389,7 +2389,7 @@ static int scst_dev_done(struct scst_cmd *cmd) TRACE_ENTRY(); state = SCST_CMD_STATE_PRE_XMIT_RESP; - if (likely(!scst_is_cmd_local(cmd)) && + if (likely(!scst_is_cmd_local(cmd)) && likely(cmd->dev->handler->dev_done != NULL)) { int rc; @@ -2429,11 +2429,11 @@ static int scst_dev_done(struct scst_cmd *cmd) default: if (state >= 0) { PRINT_ERROR("Dev handler %s dev_done() returned " - "invalid cmd state %d", + "invalid cmd state %d", cmd->dev->handler->name, state); } else { PRINT_ERROR("Dev handler %s dev_done() returned " - "error %d", cmd->dev->handler->name, + "error %d", cmd->dev->handler->name, state); } scst_set_cmd_error(cmd, @@ -2738,7 +2738,7 @@ static void scst_cmd_set_sn(struct scst_cmd *cmd) } cmd->sn_slot = tgt_dev->cur_sn_slot; cmd->sn = tgt_dev->curr_sn; - + tgt_dev->prev_cmd_ordered = 0; } else { TRACE(TRACE_MINOR, "***WARNING*** Not enough SN slots " @@ -2800,7 +2800,7 @@ ordered: TRACE_SN("cmd(%p)->sn: %ld (tgt_dev %p, *cur_sn_slot %d, " "num_free_sn_slots %d, prev_cmd_ordered %ld, " "cur_sn_slot %zd)", cmd, cmd->sn, tgt_dev, - atomic_read(tgt_dev->cur_sn_slot), + atomic_read(tgt_dev->cur_sn_slot), tgt_dev->num_free_sn_slots, tgt_dev->prev_cmd_ordered, tgt_dev->cur_sn_slot-tgt_dev->sn_slots); @@ -2844,7 +2844,7 @@ static int scst_translate_lun(struct scst_cmd *cmd) "visible remotely", (uint64_t)cmd->lun); break; } - + cmd->cmd_lists = tgt_dev->dev->p_cmd_lists; cmd->tgt_dev = tgt_dev; cmd->dev = tgt_dev->dev; @@ -3182,7 +3182,7 @@ void scst_process_active_cmd(struct scst_cmd *cmd, int context) case SCST_CMD_STATE_DEFAULT: case SCST_CMD_STATE_NEED_THREAD_CTX: PRINT_CRIT_ERROR("cmd %p is in state %d, not putting on " - "useful list (left on scst cmd list)", cmd, + "useful list (left on scst cmd list)", cmd, cmd->state); spin_unlock_irq(&cmd->cmd_lists->cmd_list_lock); sBUG(); @@ -3210,7 +3210,7 @@ static void scst_do_job_active(struct list_head *cmd_list, #ifdef EXTRACHECKS { int c = context & ~SCST_CONTEXT_PROCESSABLE; - sBUG_ON((c != SCST_CONTEXT_DIRECT_ATOMIC) && + sBUG_ON((c != SCST_CONTEXT_DIRECT_ATOMIC) && (c != SCST_CONTEXT_DIRECT)); } #endif @@ -3377,7 +3377,7 @@ void scst_done_cmd_mgmt(struct scst_cmd *cmd) cmd_mgmt_cmd_list_entry) { struct scst_mgmt_cmd *mcmd = mstb->mcmd; - TRACE_MGMT_DBG("mcmd %p, mcmd->cmd_done_wait_count %d", + TRACE_MGMT_DBG("mcmd %p, mcmd->cmd_done_wait_count %d", mcmd, mcmd->cmd_done_wait_count); mcmd->cmd_done_wait_count--; @@ -3425,7 +3425,7 @@ static void scst_finish_cmd_mgmt(struct scst_cmd *cmd) cmd_mgmt_cmd_list_entry) { struct scst_mgmt_cmd *mcmd = mstb->mcmd; - TRACE_MGMT_DBG("mcmd %p, mcmd->cmd_finish_wait_count %d", + TRACE_MGMT_DBG("mcmd %p, mcmd->cmd_finish_wait_count %d", mcmd, mcmd->cmd_finish_wait_count); list_del(&mstb->cmd_mgmt_cmd_list_entry); @@ -3495,7 +3495,7 @@ static inline int scst_is_strict_mgmt_fn(int mgmt_fn) } } -/* +/* * Might be called under sess_list_lock and IRQ off + BHs also off * Returns -1 if command is being executed (ABORT failed), 0 otherwise */ @@ -3528,12 +3528,12 @@ void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd, spin_unlock_irqrestore(&other_ini_lock, flags); - - /* + + /* * To sync with cmd->finished/done set in * scst_finish_cmd()/scst_pre_xmit_response() */ - smp_mb__after_set_bit(); + smp_mb__after_set_bit(); if (cmd->tgt_dev == NULL) { unsigned long flags; @@ -3708,10 +3708,10 @@ static void __scst_abort_task_set(struct scst_mgmt_cmd *mcmd, spin_lock_irq(&sess->sess_list_lock); TRACE_DBG("Searching in search cmd list (sess=%p)", sess); - list_for_each_entry(cmd, &sess->search_cmd_list, + list_for_each_entry(cmd, &sess->search_cmd_list, search_cmd_list_entry) { if ((cmd->tgt_dev == tgt_dev) || - ((cmd->tgt_dev == NULL) && + ((cmd->tgt_dev == NULL) && (cmd->lun == tgt_dev->lun))) { if (mcmd->cmd_sn_set) { sBUG_ON(!cmd->tgt_sn_set); @@ -3807,7 +3807,7 @@ static int scst_clear_task_set(struct scst_mgmt_cmd *mcmd) mutex_lock(&scst_mutex); - list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, + list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { struct scst_session *sess = tgt_dev->sess; struct scst_cmd *cmd; @@ -3819,10 +3819,10 @@ static int scst_clear_task_set(struct scst_mgmt_cmd *mcmd) spin_lock_irq(&sess->sess_list_lock); TRACE_DBG("Searching in search cmd list (sess=%p)", sess); - list_for_each_entry(cmd, &sess->search_cmd_list, + list_for_each_entry(cmd, &sess->search_cmd_list, search_cmd_list_entry) { if ((cmd->dev == dev) || - ((cmd->dev == NULL) && + ((cmd->dev == NULL) && scst_is_cmd_belongs_to_dev(cmd, dev))) { scst_abort_cmd(cmd, mcmd, 1, 0); aborted = 1; @@ -3857,7 +3857,7 @@ static int scst_clear_task_set(struct scst_mgmt_cmd *mcmd) return res; } -/* Returns 0 if the command processing should be continued, +/* Returns 0 if the command processing should be continued, * >0, if it should be requeued, <0 otherwise */ static int scst_mgmt_cmd_init(struct scst_mgmt_cmd *mcmd) { @@ -3894,7 +3894,7 @@ static int scst_mgmt_cmd_init(struct scst_mgmt_cmd *mcmd) "cmd LUN %Lx, cmd tag %Lu", mcmd->lun, cmd->lun, mcmd->tag); mcmd->status = SCST_MGMT_STATUS_REJECTED; - } else if (mcmd->cmd_sn_set && + } 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, " @@ -3979,7 +3979,7 @@ static int scst_target_reset(struct scst_mgmt_cmd *mcmd) dev_tgt_dev_list_entry) { cont = 1; rc = scst_call_dev_task_mgmt_fn(mcmd, tgt_dev, 0); - if (rc == SCST_DEV_TM_NOT_COMPLETED) + if (rc == SCST_DEV_TM_NOT_COMPLETED) c = 1; else if ((rc < 0) && (mcmd->status == SCST_MGMT_STATUS_SUCCESS)) @@ -3987,7 +3987,7 @@ static int scst_target_reset(struct scst_mgmt_cmd *mcmd) } if (cont && !c) continue; - + if (dev->scsi_dev == NULL) continue; @@ -4145,12 +4145,12 @@ static int scst_abort_all_nexus_loss_sess(struct scst_mgmt_cmd *mcmd, __scst_block_dev(dev); spin_unlock_bh(&dev->dev_lock); } - + __scst_abort_task_set(mcmd, tgt_dev, 0); - + rc = scst_call_dev_task_mgmt_fn(mcmd, tgt_dev, 0); if ((rc < 0) && (mcmd->status == SCST_MGMT_STATUS_SUCCESS)) - mcmd->status = rc; + mcmd->status = rc; } } @@ -4234,7 +4234,7 @@ static int scst_abort_all_nexus_loss_tgt(struct scst_mgmt_cmd *mcmd, if (nexus_loss) scst_nexus_loss(tgt_dev); - + rc = scst_call_dev_task_mgmt_fn(mcmd, tgt_dev, 0); if ((rc < 0) && (mcmd->status == SCST_MGMT_STATUS_SUCCESS)) @@ -4426,7 +4426,7 @@ static void scst_mgmt_cmd_send_done(struct scst_mgmt_cmd *mcmd) mutex_lock(&scst_mutex); for(i = 0; i < TGT_DEV_HASH_SIZE; i++) { - struct list_head *sess_tgt_dev_list_head = + struct list_head *sess_tgt_dev_list_head = &mcmd->sess->sess_tgt_dev_list_hash[i]; list_for_each_entry(tgt_dev, sess_tgt_dev_list_head, sess_tgt_dev_list_entry) { @@ -4554,7 +4554,7 @@ int scst_mgmt_cmd_thread(void *arg) !test_bit(SCST_FLAG_SUSPENDING, &scst_flags)) { TRACE_MGMT_DBG("Adding mgmt cmd %p to head " "of delayed mgmt cmd list", mcmd); - list_add(&mcmd->mgmt_cmd_list_entry, + list_add(&mcmd->mgmt_cmd_list_entry, &scst_delayed_mgmt_cmd_list); } else { TRACE_MGMT_DBG("Adding mgmt cmd %p to head " @@ -4635,7 +4635,7 @@ static int scst_post_rx_mgmt_cmd(struct scst_session *sess, case SCST_SESS_IPH_INITING: TRACE_DBG("Adding mcmd %p to init deferred mcmd list", mcmd); - list_add_tail(&mcmd->mgmt_cmd_list_entry, + list_add_tail(&mcmd->mgmt_cmd_list_entry, &sess->init_deferred_mcmd_list); goto out_unlock; case SCST_SESS_IPH_SUCCESS: @@ -4669,8 +4669,8 @@ out_unlock: goto out; } -/* - * Must not be called in parallel with scst_unregister_session_ex() for the +/* + * Must not be called in parallel with scst_unregister_session_ex() for the * same sess */ int scst_rx_mgmt_fn(struct scst_session *sess, @@ -4742,13 +4742,13 @@ static struct scst_acg *scst_find_acg(const char *initiator_name) struct scst_acn *n; TRACE_ENTRY(); - + list_for_each_entry(acg, &scst_acg_list, scst_acg_list_entry) { - list_for_each_entry(n, &acg->acn_list, - acn_list_entry) + list_for_each_entry(n, &acg->acn_list, + acn_list_entry) { if (strcmp(n->name, initiator_name) == 0) { - TRACE_DBG("Access control group %s found", + TRACE_DBG("Access control group %s found", acg->acg_name); res = acg; goto out; @@ -4756,7 +4756,7 @@ static struct scst_acg *scst_find_acg(const char *initiator_name) } } -out: +out: TRACE_EXIT_HRES(res); return res; } @@ -4767,17 +4767,17 @@ static struct scst_acg *scst_find_acg_by_name(const char *acg_name) struct scst_acg *acg, *res = NULL; TRACE_ENTRY(); - + list_for_each_entry(acg, &scst_acg_list, scst_acg_list_entry) { if (strcmp(acg->acg_name, acg_name) == 0) { - TRACE_DBG("Access control group %s found", + TRACE_DBG("Access control group %s found", acg->acg_name); res = acg; goto out; } } -out: +out: TRACE_EXIT_HRES(res); return res; } @@ -4916,8 +4916,8 @@ out_free: goto out; } -/* - * Must not be called in parallel with scst_rx_cmd() or +/* + * Must not be called in parallel with scst_rx_cmd() or * scst_rx_mgmt_fn_*() for the same sess */ void scst_unregister_session_ex(struct scst_session *sess, int wait, @@ -4992,7 +4992,7 @@ static void scst_pre_unreg_sess(struct scst_session *sess) TRACE_ENTRY(); tm_dbg_task_mgmt(NULL, "UNREGISTER SESSION", 1); - + mutex_lock(&scst_mutex); for(i = 0; i < TGT_DEV_HASH_SIZE; i++) { struct list_head *sess_tgt_dev_list_head = @@ -5133,7 +5133,7 @@ struct scst_cmd *__scst_find_cmd_by_tag(struct scst_session *sess, uint64_t tag) TRACE_DBG("%s (sess=%p, tag=%llu)", "Searching in search cmd list", sess, tag); - list_for_each_entry(cmd, &sess->search_cmd_list, + list_for_each_entry(cmd, &sess->search_cmd_list, search_cmd_list_entry) { if (cmd->tag == tag) goto out; @@ -5159,7 +5159,7 @@ struct scst_cmd *scst_find_cmd(struct scst_session *sess, void *data, spin_lock_irqsave(&sess->sess_list_lock, flags); TRACE_DBG("Searching in search cmd list (sess=%p)", sess); - list_for_each_entry(cmd, &sess->search_cmd_list, + list_for_each_entry(cmd, &sess->search_cmd_list, search_cmd_list_entry) { if (cmp_fn(cmd, data)) goto out_unlock; diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 2d288f9a1..239fa7b18 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -1144,13 +1144,13 @@ static int srpt_release_channel(struct srpt_rdma_ch *ch, int destroy_cmid) "%s: Release sess= %p sess_name= %s active_cmd= %d\n", __FUNCTION__, ch->scst_sess, ch->sess_name, ch->active_scmnd_cnt); - + list_for_each_entry_safe(ioctx, ioctx_tmp, &ch->active_scmnd_list, scmnd_list) { list_del(&ioctx->scmnd_list); ch->active_scmnd_cnt--; } - + scst_unregister_session(ch->scst_sess, 0, NULL); ch->scst_sess = NULL; } @@ -2245,7 +2245,7 @@ static void srpt_remove_one(struct ib_device *device) sdev = ib_get_client_data(device, &srpt_client); if (!sdev) return; - + wait_for_completion(&sdev->scst_released); ib_unregister_event_handler(&sdev->event_handler); diff --git a/usr/fileio/common.c b/usr/fileio/common.c index b74ebc2ae..c540df63f 100644 --- a/usr/fileio/common.c +++ b/usr/fileio/common.c @@ -1,13 +1,13 @@ /* * common.c - * + * * Copyright (C) 2007 Vladislav Bolkhovitin - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -266,10 +266,10 @@ static int do_exec(struct vdisk_cmd *vcmd) lba_start |= ((uint64_t)cdb[3]) << 16; lba_start |= ((uint64_t)cdb[4]) << 8; lba_start |= ((uint64_t)cdb[5]); - data_len = ((cdb[7] << (BYTE * 1)) + (cdb[8] << (BYTE * 0))) + data_len = ((cdb[7] << (BYTE * 1)) + (cdb[8] << (BYTE * 0))) << dev->block_shift; if (data_len == 0) - data_len = dev->file_size - + data_len = dev->file_size - ((loff_t)lba_start << dev->block_shift); break; case READ_16: @@ -932,7 +932,7 @@ static void exec_inquiry(struct vdisk_cmd *vcmd) if (cmd->cdb[1] & EVPD) { int dev_id_num; char dev_id_str[6]; - + for (dev_id_num = 0, i = 0; i < strlen(dev->name); i++) { dev_id_num += dev->name[i]; } @@ -1066,7 +1066,7 @@ out: return; } -/* +/* * <> * * ToDo: revise them @@ -1168,7 +1168,7 @@ static void exec_mode_sense(struct vdisk_cmd *vcmd) blocksize = dev->block_size; nblocks = dev->nblocks; - + type = dev->type; /* type dev */ dbd = cmd->cdb[1] & DBD; pcontrol = (cmd->cdb[2] & 0xc0) >> 6; @@ -1178,7 +1178,7 @@ static void exec_mode_sense(struct vdisk_cmd *vcmd) dev_spec = (dev->rd_only_flag ? WP : 0) | DPOFUA; memset(buf, 0, sizeof(buf)); - + if (0x3 == pcontrol) { TRACE_DBG("%s", "MODE SENSE: Saving values not supported"); set_cmd_error(vcmd, @@ -1403,7 +1403,7 @@ static void exec_read_capacity(struct vdisk_cmd *vcmd) buffer[5] = (blocksize >> (BYTE * 2)) & 0xFF; buffer[6] = (blocksize >> (BYTE * 1)) & 0xFF; buffer[7] = (blocksize >> (BYTE * 0)) & 0xFF; - + if (length > READ_CAP_LEN) length = READ_CAP_LEN; memcpy(address, buffer, length); @@ -1464,7 +1464,7 @@ static void exec_read_toc(struct vdisk_cmd *vcmd) int length = cmd->bufflen; uint8_t *address = (uint8_t*)(unsigned long)cmd->pbuf; uint32_t nblocks; - uint8_t buffer[4+8+8] = { 0x00, 0x0a, 0x01, 0x01, 0x00, 0x14, + uint8_t buffer[4+8+8] = { 0x00, 0x0a, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }; TRACE_ENTRY(); @@ -1541,7 +1541,7 @@ static void exec_prevent_allow_medium_removal(struct vdisk_cmd *vcmd) pthread_mutex_lock(&dev->dev_mutex); if (dev->type == TYPE_ROM) - dev->prevent_allow_medium_removal = + dev->prevent_allow_medium_removal = cmd->cdb[4] & 0x01 ? 1 : 0; else { PRINT_ERROR("%s", "Prevent allow medium removal for " @@ -1583,12 +1583,12 @@ static void exec_read(struct vdisk_cmd *vcmd, loff_t loff) loff_t err; TRACE_ENTRY(); - + TRACE_DBG("reading off %"PRId64", len %d", loff, length); if (dev->nullio) err = length; else { - /* SEEK */ + /* SEEK */ err = lseek64(fd, loff, 0/*SEEK_SET*/); if (err != loff) { PRINT_ERROR("lseek trouble %"PRId64" != %"PRId64 @@ -1664,7 +1664,7 @@ restart: } goto out; } else if (err < length) { - /* + /* * Probably that's wrong, but sometimes write() returns * value less, than requested. Let's restart. */ @@ -1699,7 +1699,7 @@ static void exec_verify(struct vdisk_cmd *vcmd, loff_t loff) if (exec_fsync(vcmd) != 0) goto out; - /* + /* * Until the cache is cleared prior the verifying, there is not * much point in this code. ToDo. * diff --git a/usr/fileio/common.h b/usr/fileio/common.h index 15d1362a0..c21abe9b9 100644 --- a/usr/fileio/common.h +++ b/usr/fileio/common.h @@ -1,13 +1,13 @@ /* * common.h - * + * * Copyright (C) 2007 Vladislav Bolkhovitin - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/usr/fileio/debug.c b/usr/fileio/debug.c index 2d4fd2664..20731a9c0 100644 --- a/usr/fileio/debug.c +++ b/usr/fileio/debug.c @@ -1,17 +1,17 @@ /* * debug.c - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar - * - * Contains helper functions for execution tracing and error reporting. + * + * Contains helper functions for execution tracing and error reporting. * Intended to be included in main .c file. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/usr/fileio/debug.h b/usr/fileio/debug.h index 73805bdb0..92ab4f77b 100644 --- a/usr/fileio/debug.h +++ b/usr/fileio/debug.h @@ -1,16 +1,16 @@ /* * debug.h - * + * * Copyright (C) 2004-2007 Vladislav Bolkhovitin * and Leonid Stoljar - * + * * Contains macroses for execution tracing and error reporting - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/usr/fileio/fileio.c b/usr/fileio/fileio.c index e2bff7615..a81ac4700 100644 --- a/usr/fileio/fileio.c +++ b/usr/fileio/fileio.c @@ -1,13 +1,13 @@ /* * fileio.c - * + * * Copyright (C) 2007 Vladislav Bolkhovitin - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -139,7 +139,7 @@ static int scst_calc_block_shift(int sector_size) if (block_shift < 9) { PRINT_ERROR("Wrong sector size %d", sector_size); block_shift = -1; - } + } out: TRACE_EXIT_RES(block_shift); @@ -366,7 +366,7 @@ int main(int argc, char **argv) PRINT_INFO("trace_flag %lx", trace_flag); #endif - dev.scst_usr_fd = open(DEV_USER_PATH DEV_USER_NAME, O_RDWR | + dev.scst_usr_fd = open(DEV_USER_PATH DEV_USER_NAME, O_RDWR | (dev.non_blocking ? O_NONBLOCK : 0)); if (dev.scst_usr_fd < 0) { res = -errno;