Patch from Bart Van Assche <bart.vanassche@gmail.com> with one change ("/* To do...
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Thu, 22 May 2008 16:13:36 +0000 (16:13 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Thu, 22 May 2008 16:13:36 +0000 (16:13 +0000)
The patch below fixes the following checkpatch complaints:
- ERROR: else should follow close brace '}'
- ERROR: need consistent spacing around '&' (ctx:VxW)
- ERROR: open brace '{' following enum go on the same line
- ERROR: open brace '{' following struct go on the same line
- ERROR: that open brace { should be on the previous line
- ERROR: trailing statements should be on next line
- ERROR: trailing whitespace
- WARNING: braces {} are not necessary for any arm of this statement

The patch below has been verified as follows:
- Verified the patch below by reading it.
- Checked that checkpatch does no longer complain about the above categories
  of messages on the generated patch.
- Checked that the generated kernel patch applies cleanly to the 2.6.25.4
  kernel.
- Checked that the patched 2.6.25.4 kernel compiles and installs cleanly,
  and that after reboot it was possible to load the iscsi-scst and ib_srpt
  kernel modules.

Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@386 d57e44dd-8a1f-0410-8b47-8ef2f437770f

27 files changed:
iscsi-scst/include/iscsi_scst.h
iscsi-scst/kernel/event.c
iscsi-scst/kernel/iscsi.c
iscsi-scst/kernel/nthread.c
scst/include/scst.h
scst/include/scst_const.h
scst/include/scst_debug.h
scst/include/scst_user.h
scst/src/dev_handlers/scst_cdrom.c
scst/src/dev_handlers/scst_changer.c
scst/src/dev_handlers/scst_dev_handler.h
scst/src/dev_handlers/scst_disk.c
scst/src/dev_handlers/scst_modisk.c
scst/src/dev_handlers/scst_processor.c
scst/src/dev_handlers/scst_raid.c
scst/src/dev_handlers/scst_tape.c
scst/src/dev_handlers/scst_user.c
scst/src/dev_handlers/scst_vdisk.c
scst/src/scst_cdbprobe.h
scst/src/scst_debug.c
scst/src/scst_lib.c
scst/src/scst_main.c
scst/src/scst_mem.c
scst/src/scst_mem.h
scst/src/scst_priv.h
scst/src/scst_proc.c
scst/src/scst_targ.c

index eec6f0c..242ad07 100644 (file)
@@ -141,8 +141,7 @@ struct iscsi_event {
 
 static inline int iscsi_is_key_declarative(int key)
 {
-       switch (key)
-       {
+       switch (key) {
        case key_max_xmit_data_length:
                return 1;
        default:
index 458a76e..4dbd6d4 100644 (file)
@@ -56,9 +56,9 @@ static void event_recv_skb(struct sk_buff *skb)
                rlen = NLMSG_ALIGN(nlh->nlmsg_len);
                if (rlen > skb->len)
                        rlen = skb->len;
-               if ((err = event_recv_msg(skb, nlh))) {
+               if ((err = event_recv_msg(skb, nlh)))
                        netlink_ack(skb, nlh, -err);
-               else if (nlh->nlmsg_flags & NLM_F_ACK)
+               else if (nlh->nlmsg_flags & NLM_F_ACK)
                        netlink_ack(skb, nlh, 0);
                skb_pull(skb, rlen);
        }
index 1b709db..14c6fb6 100644 (file)
@@ -24,9 +24,9 @@
 #include "digest.h"
 
 #ifndef NET_PAGE_CALLBACKS_DEFINED
-#warning Patch put_page_callback-<kernel-version>.patch not applied on your \
+#warning "Patch put_page_callback-<kernel-version>.patch not applied on your \
        kernel. ISCSI-SCST will run in the performance degraded mode. Refer \
-       README file for details.
+       README file for details."
 #endif
 
 #define ISCSI_INIT_WRITE_WAKE          0x1
@@ -668,7 +668,7 @@ static struct iscsi_cmnd *create_status_rsp(struct iscsi_cmnd *req, int status,
                sg = rsp->sg = scst_alloc(PAGE_SIZE, GFP_KERNEL|__GFP_NOFAIL,
                                        &rsp->sg_cnt);
                if (sg == NULL) {
-                       /* ToDo(); */
+                       /* ToDo */
                }
                rsp->own_sg = 1;
                sense = (struct iscsi_sense_data *)page_address(sg_page(&sg[0]));
@@ -731,7 +731,7 @@ static void iscsi_cmnd_reject(struct iscsi_cmnd *req, int reason)
        sg = rsp->sg = scst_alloc(PAGE_SIZE, GFP_KERNEL|__GFP_NOFAIL,
                                &rsp->sg_cnt);
        if (sg == NULL) {
-               /* ToDo(); */
+               /* ToDo */
        }
        rsp->own_sg = 1;
        addr = page_address(sg_page(&sg[0]));
@@ -940,7 +940,7 @@ static void cmnd_prepare_get_rejected_cmd_data(struct iscsi_cmnd *cmnd)
                sg = cmnd->sg = scst_alloc(PAGE_SIZE, GFP_KERNEL|__GFP_NOFAIL,
                                        &cmnd->sg_cnt);
                if (sg == NULL) {
-                       /* ToDo(); */
+                       /* ToDo */
                }
                cmnd->own_sg = 1;
                cmnd->bufflen = PAGE_SIZE;
@@ -1226,10 +1226,10 @@ static int noop_out_start(struct iscsi_cmnd *cmnd)
                        cmnd->sg = sg = scst_alloc(size,
                                GFP_KERNEL|__GFP_NOFAIL, &cmnd->sg_cnt);
                        if (sg == NULL) {
-                               /* ToDo(); */
+                               /* ToDo */
                        }
                        if (cmnd->sg_cnt > ISCSI_CONN_IOV_MAX) {
-                               /* ToDo(); */
+                               /* ToDo */
                        }
                        cmnd->own_sg = 1;
                        cmnd->bufflen = size;
@@ -2516,9 +2516,8 @@ static void iscsi_try_local_processing(struct iscsi_conn *conn,
                int rc = 1;
                while (test_write_ready(conn)) {
                        rc = iscsi_send(conn);
-                       if ((rc <= 0) || single_only) {
+                       if ((rc <= 0) || single_only)
                                break;
-                       }
                }
 
                spin_lock_bh(&iscsi_wr_lock);
@@ -2881,9 +2880,8 @@ static void iscsi_stop_threads(void)
        list_for_each_entry_safe(t, tmp, &iscsi_threads_list,
                                threads_list_entry) {
                int rc = kthread_stop(t->thr);
-               if (rc < 0) {
+               if (rc < 0)
                        TRACE_MGMT_DBG("kthread_stop() failed: %d", rc);
-               }
                list_del(&t->threads_list_entry);
                kfree(t);
        }
index c13c87e..d5df1ef 100644 (file)
@@ -253,18 +253,18 @@ static void close_conn(struct iscsi_conn *conn)
                if (!list_empty(&session->pending_list)) {
                        struct list_head *pending_list = &session->pending_list;
                        int req_freed;
-                       
+
                        TRACE_CONN_CLOSE_DBG("Disposing pending commands on "
                                             "connection %p (conn_ref_cnt=%d)", conn,
                                             atomic_read(&conn->conn_ref_cnt));
-                       
+
                        /*
                         * Such complicated approach currently isn't necessary,
                         * but it will be necessary for MC/S, if we won't want
                         * to reestablish the whole session on a connection
                         * failure.
                         */
-               
+
                        spin_lock(&session->sn_lock);
                        do {
                                req_freed = 0;
@@ -976,46 +976,51 @@ static int write_data(struct iscsi_conn *conn)
        iop = conn->write_iop;
        count = conn->write_iop_used;
 
-       if (iop) while (1) {
-               loff_t off = 0;
-               int rest;
-
-               sBUG_ON(count > sizeof(conn->write_iov)/sizeof(conn->write_iov[0]));
-retry:
-               oldfs = get_fs();
-               set_fs(KERNEL_DS);
-               res = vfs_writev(file, (struct iovec __user *)iop, count, &off);
-               set_fs(oldfs);
-               TRACE_WRITE("%#Lx:%u: %d(%ld)", conn->session->sid, conn->cid,
-                       res, (long)iop->iov_len);
-               if (unlikely(res <= 0)) {
-                       if (res == -EAGAIN) {
-                               conn->write_iop = iop;
-                               conn->write_iop_used = count;
-                               goto out_iov;
-                       } else if (res == -EINTR)
-                               goto retry;
-                       goto out_err;
-               }
+       if (iop) {
+               while (1) {
+                       loff_t off = 0;
+                       int rest;
+
+                       sBUG_ON(count > sizeof(conn->write_iov)
+                                       / sizeof(conn->write_iov[0]));
+ retry:
+                       oldfs = get_fs();
+                       set_fs(KERNEL_DS);
+                       res = vfs_writev(file, (struct iovec __user *)iop,
+                                        count, &off);
+                       set_fs(oldfs);
+                       TRACE_WRITE("%#Lx:%u: %d(%ld)", conn->session->sid,
+                                   conn->cid,
+                                   res, (long)iop->iov_len);
+                       if (unlikely(res <= 0)) {
+                               if (res == -EAGAIN) {
+                                       conn->write_iop = iop;
+                                       conn->write_iop_used = count;
+                                       goto out_iov;
+                               } else if (res == -EINTR)
+                                       goto retry;
+                               goto out_err;
+                       }
 
-               rest = res;
-               size -= res;
-               while (iop->iov_len <= rest && rest) {
-                       rest -= iop->iov_len;
-                       iop++;
-                       count--;
-               }
-               if (count == 0) {
-                       conn->write_iop = NULL;
-                       conn->write_iop_used = 0;
-                       if (size)
-                               break;
-                       goto out_iov;
+                       rest = res;
+                       size -= res;
+                       while (iop->iov_len <= rest && rest) {
+                               rest -= iop->iov_len;
+                               iop++;
+                               count--;
+                       }
+                       if (count == 0) {
+                               conn->write_iop = NULL;
+                               conn->write_iop_used = 0;
+                               if (size)
+                                       break;
+                               goto out_iov;
+                       }
+                       sBUG_ON(iop > conn->write_iov + sizeof(conn->write_iov)
+                                                 /sizeof(conn->write_iov[0]));
+                       iop->iov_base += rest;
+                       iop->iov_len -= rest;
                }
-               sBUG_ON(iop > conn->write_iov +
-                       sizeof(conn->write_iov)/sizeof(conn->write_iov[0]));
-               iop->iov_base += rest;
-               iop->iov_len -= rest;
        }
 
        sg = write_cmnd->sg;
index b95f73e..9d61efe 100644 (file)
@@ -411,8 +411,7 @@ typedef uint64_t lun_t;
 
 typedef enum dma_data_direction scst_data_direction;
 
-enum scst_cdb_flags
-{
+enum scst_cdb_flags {
        SCST_TRANSFER_LEN_TYPE_FIXED = 0x01, /* must be equviv 1 (FIXED_BIT in cdb) */
        SCST_SMALL_TIMEOUT = 0x02,
        SCST_LONG_TIMEOUT = 0x04,
@@ -438,8 +437,7 @@ enum scst_cdb_flags
  * SCST_TGT_RES_NEED_THREAD_CTX, and it will be recalled in the thread context,
  * where sleeping is allowed.
  */
-struct scst_tgt_template
-{
+struct scst_tgt_template {
        /* public: */
 
        /*
@@ -683,8 +681,7 @@ struct scst_tgt_template
        int proc_dev_num;
 };
 
-struct scst_dev_type
-{
+struct scst_dev_type {
        /* SCSI type of the supported device. MUST HAVE */
        int type;
 
@@ -843,8 +840,7 @@ struct scst_dev_type
        struct proc_dir_entry *proc_dev_type_root;
 };
 
-struct scst_tgt
-{
+struct scst_tgt {
        /* List of remote sessions per target, protected by scst_mutex */
        struct list_head sess_list;
 
@@ -889,8 +885,7 @@ struct scst_tgt
 #define        TGT_DEV_HASH_SIZE       (1<<TGT_DEV_HASH_SHIFT)
 #define        HASH_VAL(_val)          (_val & (TGT_DEV_HASH_SIZE - 1))
 
-struct scst_session
-{
+struct scst_session {
        /*
         * Initialization phase, one of SCST_SESS_IPH_* constants, protected by
         * sess_list_lock
@@ -975,16 +970,14 @@ struct scst_session
 #endif
 };
 
-struct scst_cmd_lists
-{
+struct scst_cmd_lists {
        spinlock_t cmd_list_lock;
        struct list_head active_cmd_list;
        wait_queue_head_t cmd_list_waitQ;
        struct list_head lists_list_entry;
 };
 
-struct scst_cmd
-{
+struct scst_cmd {
        /* List entry for below *_cmd_lists */
        struct list_head cmd_list_entry;
 
@@ -1246,8 +1239,7 @@ struct scst_cmd
 #endif
 };
 
-struct scst_rx_mgmt_params
-{
+struct scst_rx_mgmt_params {
        int fn;
        uint64_t tag;
        const uint8_t *lun;
@@ -1260,16 +1252,14 @@ struct scst_rx_mgmt_params
        unsigned char cmd_sn_set;
 };
 
-struct scst_mgmt_cmd_stub
-{
+struct scst_mgmt_cmd_stub {
        struct scst_mgmt_cmd *mcmd;
 
        /* List entry in cmd->mgmt_cmd_list */
        struct list_head cmd_mgmt_cmd_list_entry;
 };
 
-struct scst_mgmt_cmd
-{
+struct scst_mgmt_cmd {
        /* List entry for *_mgmt_cmd_list */
        struct list_head mgmt_cmd_list_entry;
 
@@ -1321,8 +1311,7 @@ struct scst_mgmt_cmd
        void *tgt_priv;
 };
 
-struct scst_device
-{
+struct scst_device {
        struct scst_dev_type *handler;  /* corresponding dev handler */
 
        /* Pointer to lists of commands with the lock */
@@ -1437,8 +1426,7 @@ struct scst_device
 /*
  * Used to store threads local tgt_dev specific data
  */
-struct scst_thr_data_hdr
-{
+struct scst_thr_data_hdr {
        /* List entry in tgt_dev->thr_data_list */
        struct list_head thr_data_list_entry;
        pid_t pid; /* PID of the owner thread */
@@ -1450,8 +1438,7 @@ struct scst_thr_data_hdr
 /*
  * Used to store per-session specific device information
  */
-struct scst_tgt_dev
-{
+struct scst_tgt_dev {
        /* List entry in sess->sess_tgt_dev_list_hash */
        struct list_head sess_tgt_dev_list_entry;
 
@@ -1518,8 +1505,7 @@ struct scst_tgt_dev
 /*
  * Used to store ACG-specific device information, like LUN
  */
-struct scst_acg_dev
-{
+struct scst_acg_dev {
        struct scst_device *dev; /* corresponding device */
        lun_t lun;              /* device's LUN in this acg */
        unsigned int rd_only_flag:1; /* if != 0, then read only */
@@ -1536,8 +1522,7 @@ struct scst_acg_dev
  * ACG - access control group. Used to store group related
  * control information.
  */
-struct scst_acg
-{
+struct scst_acg {
        /* List of acg_dev's in this acg, protected by scst_mutex */
        struct list_head acg_dev_list;
 
@@ -1561,8 +1546,7 @@ struct scst_acg
  * ACN - access control name. Used to store names, by which
  * incoming sessions will be assigned to appropriate ACG.
  */
-struct scst_acn
-{
+struct scst_acn {
        /* Initiator's name */
        const char *name;
        /* List entry in acg->acn_list */
@@ -1572,8 +1556,7 @@ struct scst_acn
 /*
  * Used to store per-session UNIT ATTENTIONs
  */
-struct scst_tgt_dev_UA
-{
+struct scst_tgt_dev_UA {
        /* List entry in tgt_dev->UA_list */
        struct list_head UA_list_entry;
        /* Unit Attention sense */
index efd584b..fa2182c 100644 (file)
@@ -92,8 +92,7 @@
 /*************************************************************
  ** SCSI task attribute queue types
  *************************************************************/
-enum scst_cmd_queue_type
-{
+enum scst_cmd_queue_type {
        SCST_CMD_QUEUE_UNTAGGED = 0,
        SCST_CMD_QUEUE_SIMPLE,
        SCST_CMD_QUEUE_ORDERED,
index 93b41eb..c04015c 100644 (file)
@@ -148,12 +148,10 @@ extern void debug_print_buffer(const char *log_level, const void *data,
 
 #define TRACE(trace, format, args...)                                    \
 do {                                                                     \
-       if (___unlikely(trace_flag & (trace)))                            \
-       {                                                                 \
+       if (___unlikely(trace_flag & (trace))) {                          \
                char *__tflag = LOG_FLAG;                                 \
                if (debug_print_prefix(trace_flag, __tflag, __LOG_PREFIX, \
-                               __FUNCTION__, __LINE__) > 0)      \
-               {                                                         \
+                                      __FUNCTION__, __LINE__) > 0) {     \
                        __tflag = NO_FLAG;                                \
                }                                                         \
                PRINT(NO_FLAG, "%s" format, __tflag, args);               \
@@ -168,12 +166,10 @@ do {                                                                \
 
 #define PRINT_BUFF_FLAG(flag, message, buff, len)                      \
 do {                                                                   \
-       if (___unlikely(trace_flag & (flag)))                           \
-       {                                                               \
+       if (___unlikely(trace_flag & (flag))) {                         \
                char *__tflag = INFO_FLAG;                              \
                if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__,\
-                               __LINE__) > 0)                  \
-               {                                                       \
+                                      __LINE__) > 0) {                 \
                        __tflag = NO_FLAG;                              \
                }                                                       \
                PRINT(NO_FLAG, "%s%s:", __tflag, message);              \
@@ -193,12 +189,10 @@ do {                                                                      \
 
 #define __TRACE(trace, format, args...)                                        \
 do {                                                                   \
-       if (trace_flag & (trace))                                       \
-       {                                                               \
+       if (trace_flag & (trace)) {                                             \
                char *__tflag = LOG_FLAG;                               \
                if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__,\
-                               __LINE__) > 0)                  \
-               {                                                       \
+                                      __LINE__) > 0) {                 \
                        __tflag = NO_FLAG;                              \
                }                                                       \
                PRINT(NO_FLAG, "%s" format, __tflag, args);             \
@@ -214,12 +208,10 @@ do {                                                                      \
 
 #define TRACE_BUFFER(message, buff, len)                               \
 do {                                                                   \
-       if (trace_flag & TRACE_BUFF)                                    \
-       {                                                               \
+       if (trace_flag & TRACE_BUFF) {                                  \
                char *__tflag = LOG_FLAG;                               \
                if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \
-                                __LINE__) > 0)                         \
-               {                                                       \
+                                      __LINE__) > 0) {                 \
                        __tflag = NO_FLAG;                              \
                }                                                       \
                PRINT(NO_FLAG, "%s%s:", __tflag, message);              \
@@ -229,12 +221,10 @@ do {                                                                      \
 
 #define TRACE_BUFF_FLAG(flag, message, buff, len)                      \
 do {                                                                   \
-       if (trace_flag & (flag))                                        \
-       {                                                               \
+       if (trace_flag & (flag)) {                                              \
                char *__tflag = LOG_FLAG;                               \
                if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \
-                               __LINE__) > 0)                          \
-               {                                                       \
+                                      __LINE__) > 0) {                 \
                        __tflag = NO_FLAG;                              \
                }                                                       \
                PRINT(NO_FLAG, "%s%s:", __tflag, message);              \
@@ -246,8 +236,7 @@ do {                                                                        \
 do {                                                                   \
        char *__tflag = log_flag;                                       \
        if (debug_print_prefix(trace_flag, __tflag, __LOG_PREFIX,       \
-                       __FUNCTION__, __LINE__) > 0)                    \
-       {                                                               \
+                              __FUNCTION__, __LINE__) > 0) {           \
                __tflag = NO_FLAG;                                      \
        }                                                               \
        PRINT(NO_FLAG, "%s" format, __tflag, args);                     \
@@ -255,8 +244,7 @@ do {                                                                        \
 
 #define PRINT_ERROR(format, args...)                                   \
 do {                                                                   \
-       if (strcmp(ERROR_FLAG, LOG_FLAG))                               \
-       {                                                               \
+       if (strcmp(ERROR_FLAG, LOG_FLAG)) {                             \
                PRINT_LOG_FLAG(LOG_FLAG, "***ERROR*** " format, args);  \
        }                                                               \
        PRINT_LOG_FLAG(ERROR_FLAG, "***ERROR*** " format, args);        \
@@ -273,8 +261,7 @@ do {                                                                        \
 
 #define PRINT_INFO(format, args...)                    \
 do {                                                   \
-       if (strcmp(INFO_FLAG, LOG_FLAG))                \
-       {                                               \
+       if (strcmp(INFO_FLAG, LOG_FLAG)) {              \
                PRINT_LOG_FLAG(LOG_FLAG, format, args); \
        }                                               \
        PRINT_LOG_FLAG(INFO_FLAG, format, args);        \
@@ -282,14 +269,12 @@ do {                                                      \
 
 #define TRACE_ENTRY()                                                  \
 do {                                                                   \
-       if (trace_flag & TRACE_ENTRYEXIT)                               \
-       {                                                               \
-               if (trace_flag & TRACE_PID)                             \
-               {                                                       \
+       if (trace_flag & TRACE_ENTRYEXIT) {                             \
+               if (trace_flag & TRACE_PID) {                           \
                        PRINT(LOG_FLAG, "[%d]: ENTRY %s", current->pid, \
                                __FUNCTION__);                          \
                }                                                       \
-               else                                                    \
+               else {                                                  \
                {                                                       \
                        PRINT(LOG_FLAG, "ENTRY %s", __FUNCTION__);      \
                }                                                       \
@@ -298,15 +283,12 @@ do {                                                                      \
 
 #define TRACE_EXIT()                                                   \
 do {                                                                   \
-       if (trace_flag & TRACE_ENTRYEXIT)                               \
-       {                                                               \
-               if (trace_flag & TRACE_PID)                             \
-               {                                                       \
+       if (trace_flag & TRACE_ENTRYEXIT) {                             \
+               if (trace_flag & TRACE_PID) {                           \
                        PRINT(LOG_FLAG, "[%d]: EXIT %s", current->pid,  \
                                __FUNCTION__);                          \
                }                                                       \
-               else                                                    \
-               {                                                       \
+               else {                                                  \
                        PRINT(LOG_FLAG, "EXIT %s", __FUNCTION__);       \
                }                                                       \
        }                                                               \
@@ -314,15 +296,12 @@ do {                                                                      \
 
 #define TRACE_EXIT_RES(res)                                            \
 do {                                                                   \
-       if (trace_flag & TRACE_ENTRYEXIT)                               \
-       {                                                               \
-               if (trace_flag & TRACE_PID)                             \
-               {                                                       \
+       if (trace_flag & TRACE_ENTRYEXIT) {                             \
+               if (trace_flag & TRACE_PID) {                           \
                        PRINT(LOG_FLAG, "[%d]: EXIT %s: %ld", current->pid, \
                                __FUNCTION__, (long)(res));             \
                }                                                       \
-               else                                                    \
-               {                                                       \
+               else {                                                  \
                        PRINT(LOG_FLAG, "EXIT %s: %ld", __FUNCTION__, (long)(res)); \
                }                                                       \
        }                                                               \
@@ -330,15 +309,12 @@ do {                                                                      \
 
 #define TRACE_EXIT_HRES(res)                                           \
 do {                                                                   \
-       if (trace_flag & TRACE_ENTRYEXIT)                               \
-       {                                                               \
-               if (trace_flag & TRACE_PID)                             \
-               {                                                       \
+       if (trace_flag & TRACE_ENTRYEXIT) {                             \
+               if (trace_flag & TRACE_PID) {                           \
                        PRINT(LOG_FLAG, "[%d]: EXIT %s: 0x%lx", current->pid, \
                                __FUNCTION__, (long)(res));             \
                }                                                       \
-               else                                                    \
-               {                                                       \
+               else {                                                  \
                        PRINT(LOG_FLAG, "EXIT %s: %lx", __FUNCTION__, (long)(res)); \
                }                                                       \
        }                                                               \
index 0f0ce6f..0e13524 100644 (file)
@@ -86,8 +86,7 @@
                                         UCMD_STATE_RECV_MASK | \
                                         UCMD_STATE_JAMMED_MASK)
 
-struct scst_user_opt
-{
+struct scst_user_opt {
        uint8_t parse_type;
        uint8_t on_free_cmd_type;
        uint8_t memory_reuse_type;
@@ -104,8 +103,7 @@ struct scst_user_opt
        uint8_t has_own_order_mgmt;
 };
 
-struct scst_user_dev_desc
-{
+struct scst_user_dev_desc {
        aligned_u64 version_str;
        uint8_t type;
        struct scst_user_opt opt;
@@ -113,8 +111,7 @@ struct scst_user_dev_desc
        char name[SCST_MAX_NAME];
 };
 
-struct scst_user_sess
-{
+struct scst_user_sess {
        aligned_u64 sess_h;
        aligned_u64 lun;
        uint16_t threads_num;
@@ -122,8 +119,7 @@ struct scst_user_sess
        char initiator_name[SCST_MAX_NAME];
 };
 
-struct scst_user_scsi_cmd_parse
-{
+struct scst_user_scsi_cmd_parse {
        aligned_u64 sess_h;
 
        uint8_t cdb[SCST_MAX_CDB_SIZE];
@@ -142,8 +138,7 @@ struct scst_user_scsi_cmd_parse
        uint32_t sn;
 };
 
-struct scst_user_scsi_cmd_alloc_mem
-{
+struct scst_user_scsi_cmd_alloc_mem {
        aligned_u64 sess_h;
 
        uint8_t cdb[SCST_MAX_CDB_SIZE];
@@ -157,8 +152,7 @@ struct scst_user_scsi_cmd_alloc_mem
        uint32_t sn;
 };
 
-struct scst_user_scsi_cmd_exec
-{
+struct scst_user_scsi_cmd_exec {
        aligned_u64 sess_h;
 
        uint8_t cdb[SCST_MAX_CDB_SIZE];
@@ -180,8 +174,7 @@ struct scst_user_scsi_cmd_exec
        uint32_t partial_offset;
 };
 
-struct scst_user_scsi_on_free_cmd
-{
+struct scst_user_scsi_on_free_cmd {
        aligned_u64 pbuf;
        int32_t resp_data_len;
        uint8_t buffer_cached;
@@ -190,13 +183,11 @@ struct scst_user_scsi_on_free_cmd
        uint8_t delivery_status;
 };
 
-struct scst_user_on_cached_mem_free
-{
+struct scst_user_on_cached_mem_free {
        aligned_u64 pbuf;
 };
 
-struct scst_user_tm
-{
+struct scst_user_tm {
        aligned_u64 sess_h;
        uint32_t fn;
        uint32_t cmd_h_to_abort;
@@ -204,8 +195,7 @@ struct scst_user_tm
        uint8_t cmd_sn_set;
 };
 
-struct scst_user_get_cmd
-{
+struct scst_user_get_cmd {
        aligned_u64 preply;
        uint32_t cmd_h;
        uint32_t subcode;
@@ -220,21 +210,18 @@ struct scst_user_get_cmd
        };
 };
 
-struct scst_user_scsi_cmd_reply_parse
-{
+struct scst_user_scsi_cmd_reply_parse {
        uint8_t queue_type;
        uint8_t data_direction;
        int32_t data_len;
        int32_t bufflen;
 };
 
-struct scst_user_scsi_cmd_reply_alloc_mem
-{
+struct scst_user_scsi_cmd_reply_alloc_mem {
        aligned_u64 pbuf;
 };
 
-struct scst_user_scsi_cmd_reply_exec
-{
+struct scst_user_scsi_cmd_reply_exec {
        int32_t resp_data_len;
        aligned_u64 pbuf;
 
@@ -247,8 +234,7 @@ struct scst_user_scsi_cmd_reply_exec
        aligned_u64 psense_buffer;
 };
 
-struct scst_user_reply_cmd
-{
+struct scst_user_reply_cmd {
        uint32_t cmd_h;
        uint32_t subcode;
        union {
index f69acf9..ca91989 100644 (file)
@@ -44,8 +44,7 @@
 
 #define CDROM_DEF_BLOCK_SHIFT  11
 
-struct cdrom_params
-{
+struct cdrom_params {
        int block_shift;
 };
 
index 08cbad9..d65c997 100644 (file)
@@ -76,8 +76,7 @@ int changer_attach(struct scst_device *dev)
         * If the device is offline, don't try to read capacity or any
         * of the other stuff
         */
-       if (dev->scsi_dev->sdev_state == SDEV_OFFLINE)
-       {
+       if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) {
                TRACE_DBG("%s", "Device is offline");
                res = -ENODEV;
                goto out;
@@ -150,11 +149,10 @@ int changer_parse(struct scst_cmd *cmd)
 
        cmd->retries = SCST_PASSTHROUGH_RETRIES;
 
-       if (cmd->op_flags & SCST_LONG_TIMEOUT) {
+       if (cmd->op_flags & SCST_LONG_TIMEOUT)
                cmd->timeout = CHANGER_LONG_TIMEOUT;
-       } else {
+       else
                cmd->timeout = CHANGER_TIMEOUT;
-       }
 
        return res;
 }
index 6c1b2b6..a704353 100644 (file)
@@ -96,9 +96,8 @@ static void scst_dev_handler_destroy_std_proc(struct scst_dev_type *dev_type)
        TRACE_ENTRY();
 
        root = scst_proc_get_dev_type_root(dev_type);
-       if (root) {
+       if (root)
                remove_proc_entry(DEV_HANDLER_LOG_ENTRY_NAME, root);
-       }
 
        TRACE_EXIT();
 #endif
index 0ff5611..1c759c0 100644 (file)
@@ -63,8 +63,7 @@
 
 #define DISK_DEF_BLOCK_SHIFT   9
 
-struct disk_params
-{
+struct disk_params {
        int block_shift;
 };
 
@@ -196,9 +195,7 @@ int disk_attach(struct scst_device *dev)
                TRACE_DBG("READ_CAPACITY done: %x", res);
 
                if (!res || (sbuff[12] != 0x28 && sbuff[12] != 0x29))
-               {
                        break;
-               }
                if (!--retries) {
                        PRINT_ERROR("UA not clear after %d retries",
                                SCST_DEV_UA_RETRIES);
index a244633..ea333fc 100644 (file)
@@ -63,8 +63,7 @@
 
 #define MODISK_DEF_BLOCK_SHIFT    10
 
-struct modisk_params
-{
+struct modisk_params {
        int block_shift;
 };
 
@@ -175,8 +174,7 @@ int modisk_attach(struct scst_device *dev)
         * If the device is offline, don't try to read capacity or any
         * of the other stuff
         */
-       if (dev->scsi_dev->sdev_state == SDEV_OFFLINE)
-       {
+       if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) {
                TRACE_DBG("%s", "Device is offline");
                res = -ENODEV;
                goto out_free_params;
index e81d0a3..fe48887 100644 (file)
@@ -76,8 +76,7 @@ int processor_attach(struct scst_device *dev)
         * If the device is offline, don't try to read capacity or any
         * of the other stuff
         */
-       if (dev->scsi_dev->sdev_state == SDEV_OFFLINE)
-       {
+       if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) {
                TRACE_DBG("%s", "Device is offline");
                res = -ENODEV;
                goto out;
@@ -150,11 +149,10 @@ int processor_parse(struct scst_cmd *cmd)
 
        cmd->retries = SCST_PASSTHROUGH_RETRIES;
 
-       if (cmd->op_flags & SCST_LONG_TIMEOUT) {
+       if (cmd->op_flags & SCST_LONG_TIMEOUT)
                cmd->timeout = PROCESSOR_LONG_TIMEOUT;
-       } else {
+       else
                cmd->timeout = PROCESSOR_TIMEOUT;
-       }
        return res;
 }
 
index 2f93cb4..83e41cb 100644 (file)
@@ -76,8 +76,7 @@ int raid_attach(struct scst_device *dev)
         * If the device is offline, don't try to read capacity or any
         * of the other stuff
         */
-       if (dev->scsi_dev->sdev_state == SDEV_OFFLINE)
-       {
+       if (dev->scsi_dev->sdev_state == SDEV_OFFLINE) {
                TRACE_DBG("%s", "Device is offline");
                res = -ENODEV;
                goto out;
@@ -150,11 +149,10 @@ int raid_parse(struct scst_cmd *cmd)
 
        cmd->retries = SCST_PASSTHROUGH_RETRIES;
 
-       if (cmd->op_flags & SCST_LONG_TIMEOUT) {
+       if (cmd->op_flags & SCST_LONG_TIMEOUT)
                cmd->timeout = RAID_LONG_TIMEOUT;
-       } else {
+       else
                cmd->timeout = RAID_TIMEOUT;
-       }
        return res;
 }
 
index 0fe5571..b954224 100644 (file)
@@ -68,8 +68,7 @@
 /* The fixed bit in READ/WRITE/VERIFY */
 #define SILI_BIT            2
 
-struct tape_params
-{
+struct tape_params {
        int block_size;
 };
 
@@ -342,19 +341,18 @@ int tape_done(struct scst_cmd *cmd)
 
        TRACE_ENTRY();
 
-       if ((status == SAM_STAT_GOOD) || (status == SAM_STAT_CONDITION_MET)) {
+       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");
                if (opcode == READ_6 && !(cmd->cdb[1] & SILI_BIT) &&
-                   (cmd->sense[2] & 0xe0)) {   /* EOF, EOM, or ILI */
+                   (cmd->sense[2] & 0xe0)) {
+                       /* EOF, EOM, or ILI */
                        int TransferLength, Residue = 0;
-                       if ((cmd->sense[2] & 0x0f) == BLANK_CHECK) {
+                       if ((cmd->sense[2] & 0x0f) == BLANK_CHECK)
                                cmd->sense[2] &= 0xcf;  /* No need for EOM in this case */
-                       }
                        TransferLength = ((cmd->cdb[2] << 16) |
                                          (cmd->cdb[3] << 8) | cmd->cdb[4]);
                        /* Compute the residual count */
index 1434b30..82891c9 100644 (file)
@@ -40,8 +40,7 @@
 #define DEV_USER_DETACH_TIMEOUT                (5*HZ)
 #define DEV_USER_PRE_UNREG_POLL_TIME   (HZ/10)
 
-struct scst_user_dev
-{
+struct scst_user_dev {
        struct rw_semaphore dev_rwsem;
 
        struct scst_cmd_lists cmd_lists;
@@ -101,8 +100,7 @@ struct scst_user_dev
        struct completion cleanup_cmpl;
 };
 
-struct scst_user_pre_unreg_sess_obj
-{
+struct scst_user_pre_unreg_sess_obj {
        struct scst_tgt_dev *tgt_dev;
        unsigned int active:1;
        unsigned int exit:1;
@@ -115,8 +113,7 @@ struct scst_user_pre_unreg_sess_obj
 };
 
 /* Most fields are unprotected, since only one thread at time can access them */
-struct scst_user_cmd
-{
+struct scst_user_cmd {
        struct scst_cmd *cmd;
        struct scst_user_dev *dev;
 
@@ -444,9 +441,9 @@ static inline int is_buff_cached(struct scst_user_cmd *ucmd)
            ((ucmd->cmd->data_direction == SCST_DATA_READ) &&
             (mem_reuse_type == SCST_USER_MEM_REUSE_READ)) ||
            ((ucmd->cmd->data_direction == SCST_DATA_WRITE) &&
-            (mem_reuse_type == SCST_USER_MEM_REUSE_WRITE))) {
+            (mem_reuse_type == SCST_USER_MEM_REUSE_WRITE)))
                return 1;
-       else
+       else
                return 0;
 }
 
@@ -3175,9 +3172,8 @@ static void __exit exit_scst_user(void)
        TRACE_ENTRY();
 
        rc = kthread_stop(cleanup_thread);
-       if (rc < 0) {
+       if (rc < 0)
                TRACE_MGMT_DBG("kthread_stop() failed: %d", rc);
-       }
 
        unregister_chrdev(DEV_USER_MAJOR, DEV_USER_NAME);
        class_device_destroy(dev_user_sysfs_class, MKDEV(DEV_USER_MAJOR, 0));
index e02e508..6fc0bdf 100644 (file)
@@ -1125,13 +1125,15 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd)
                len = scnprintf(dev_id_str, 6, "%d", dev_id_num);
                TRACE_DBG("num %d, str <%s>, len %d",
                           dev_id_num, dev_id_str, len);
-               if (0 == cmd->cdb[2]) { /* supported vital product data pages */
+               if (0 == cmd->cdb[2]) {
+                       /* supported vital product data pages */
                        buf[3] = 3;
                        buf[4] = 0x0; /* this page */
                        buf[5] = 0x80; /* unit serial number */
                        buf[6] = 0x83; /* device identification */
                        resp_len = buf[3] + 4;
-               } else if (0x80 == cmd->cdb[2]) { /* unit serial number */
+               } else if (0x80 == cmd->cdb[2]) {
+                       /* unit serial number */
                        buf[1] = 0x80;
                        if (virt_dev->usn == NULL) {
                                buf[3] = MAX_USN_LEN;
@@ -1147,7 +1149,8 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd)
                                strncpy(&buf[4], virt_dev->usn, usn_len);
                        }
                        resp_len = buf[3] + 4;
-               } else if (0x83 == cmd->cdb[2]) { /* device identification */
+               } else if (0x83 == cmd->cdb[2]) {
+                       /* device identification */
                        int num = 4;
 
                        buf[1] = 0x83;
@@ -1439,7 +1442,8 @@ static void vdisk_exec_mode_sense(struct scst_cmd *cmd)
                offset = 8;
        }
 
-       if (0 != subpcode) { /* TODO: Control Extension page */
+       if (0 != subpcode) {
+               /* TODO: Control Extension page */
                TRACE_DBG("%s", "MODE SENSE: Only subpage 0 is supported");
                scst_set_cmd_error(cmd,
                    SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb));
@@ -1583,11 +1587,10 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd)
                goto out_put;
        }
 
-       if (mselect_6) {
+       if (mselect_6)
                offset = 4;
-       } else {
+       else
                offset = 8;
-       }
 
        if (address[offset - 1] == 8) {
                offset += 8;
@@ -1606,7 +1609,8 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd)
                                scst_sense_invalid_field_in_parm_list));
                        goto out_put;
                }
-               if ((address[offset] & 0x3f) == 0x8) {  /* Caching page */
+               if ((address[offset] & 0x3f) == 0x8) {
+                       /* Caching page */
                        if (address[offset + 1] != 18) {
                                PRINT_ERROR("%s", "MODE SELECT: Invalid "
                                        "caching page request");
@@ -1625,7 +1629,8 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd)
        * It's too early to implement it, since we can't control the backstorage
        * device parameters. ToDo
        */
-               } else if ((address[offset] & 0x3f) == 0xA) {   /* Control page */
+               } else if ((address[offset] & 0x3f) == 0xA) {
+                       /* Control page */
                        if (address[offset + 1] != 0xA) {
                                PRINT_ERROR("%s", "MODE SELECT: Invalid "
                                        "control page request");
@@ -1742,7 +1747,7 @@ static void vdisk_exec_read_capacity16(struct scst_cmd *cmd)
        buffer[4] = (nblocks >> 24) & 0xFF;
        buffer[5] = (nblocks >> 16) & 0xFF;
        buffer[6] = (nblocks >> 8) & 0xFF;
-       buffer[7] = nblocks& 0xFF;
+       buffer[7] = nblocks & 0xFF;
 
        buffer[8] = (blocksize >> (BYTE * 3)) & 0xFF;
        buffer[9] = (blocksize >> (BYTE * 2)) & 0xFF;
@@ -1822,16 +1827,14 @@ static void vdisk_exec_read_toc(struct scst_cmd *cmd)
        buffer[2] = 0x01;    /* First Track/Session */
        buffer[3] = 0x01;    /* Last Track/Session */
        off = 4;
-       if (cmd->cdb[6] <= 1)
-       {
+       if (cmd->cdb[6] <= 1) {
                /* Fistr TOC Track Descriptor */
                buffer[off+1] = 0x14; /* ADDR    0x10 - Q Sub-channel encodes current position data
                                         CONTROL 0x04 - Data track, recoreded uninterrupted */
                buffer[off+2] = 0x01; /* Track Number */
                off += 8;
        }
-       if (!(cmd->cdb[2] & 0x01))
-       {
+       if (!(cmd->cdb[2] & 0x01)) {
                /* Lead-out area TOC Track Descriptor */
                buffer[off+1] = 0x14;
                buffer[off+2] = 0xAA;     /* Track Number */
@@ -2021,11 +2024,10 @@ static void vdisk_exec_read(struct scst_cmd *cmd,
                err = full_len;
        else {
                /* SEEK */
-               if (fd->f_op->llseek) {
+               if (fd->f_op->llseek)
                        err = fd->f_op->llseek(fd, loff, 0/*SEEK_SET*/);
-               } else {
+               else
                        err = default_llseek(fd, loff, 0/*SEEK_SET*/);
-               }
                if (err != loff) {
                        PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err,
                                (uint64_t)loff);
@@ -2112,11 +2114,10 @@ restart:
                err = full_len;
        else {
                /* SEEK */
-               if (fd->f_op->llseek) {
+               if (fd->f_op->llseek)
                        err = fd->f_op->llseek(fd, loff, 0 /*SEEK_SET */);
-               } else {
+               else
                        err = default_llseek(fd, loff, 0 /*SEEK_SET */);
-               }
                if (err != loff) {
                        PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err,
                                (uint64_t)loff);
@@ -2404,11 +2405,10 @@ static void vdisk_exec_verify(struct scst_cmd *cmd,
        set_fs(get_ds());
 
        if (!virt_dev->nullio) {
-               if (fd->f_op->llseek) {
+               if (fd->f_op->llseek)
                        err = fd->f_op->llseek(fd, loff, 0/*SEEK_SET*/);
-               } else {
+               else
                        err = default_llseek(fd, loff, 0/*SEEK_SET*/);
-               }
                if (err != loff) {
                        PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err,
                                (uint64_t)loff);
@@ -2658,9 +2658,8 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset,
        }
 
        p = buffer;
-       if (p[strlen(p) - 1] == '\n') {
+       if (p[strlen(p) - 1] == '\n')
                p[strlen(p) - 1] = '\0';
-       }
        if (!strncmp("close ", p, 6)) {
                p += 6;
                action = 0;
@@ -2690,7 +2689,8 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset,
                goto out_up;
        }
 
-       if (action) {                      /* open */
+       if (action) {
+               /* open */
                virt_dev = NULL;
                list_for_each_entry(vv, &vdisk_dev_list,
                                        vdisk_dev_list_entry)
@@ -3089,11 +3089,10 @@ static int vcdrom_change(char *p, char *name)
                /* seek to end */
                old_fs = get_fs();
                set_fs(get_ds());
-               if (fd->f_op->llseek) {
+               if (fd->f_op->llseek)
                        err = fd->f_op->llseek(fd, 0, 2/*SEEK_END*/);
-               } else {
+               else
                        err = default_llseek(fd, 0, 2/*SEEK_END*/);
-               }
                set_fs(old_fs);
                filp_close(fd, NULL);
                if (err < 0) {
@@ -3207,9 +3206,8 @@ static int vcdrom_write_proc(char *buffer, char **start, off_t offset,
        }
 
        p = buffer;
-       if (p[strlen(p) - 1] == '\n') {
+       if (p[strlen(p) - 1] == '\n')
                p[strlen(p) - 1] = '\0';
-       }
        if (!strncmp("close ", p, 6)) {
                p += 6;
                action = 0;
@@ -3242,15 +3240,18 @@ static int vcdrom_write_proc(char *buffer, char **start, off_t offset,
                goto out_up;
        }
 
-       if (action == 2) {                      /* open */
+       if (action == 2) {
+               /* open */
                res = vcdrom_open(p, name);
                if (res != 0)
                        goto out_up;
-       } else if (action == 1) {          /* change */
+       } else if (action == 1) {
+               /* change */
                res = vcdrom_change(p, name);
                if (res != 0)
                        goto out_up;
-       } else {                           /* close */
+       } else {
+               /* close */
                res = vcdrom_close(name);
                if (res != 0)
                        goto out_up;
index d9dc266..5f0237a 100644 (file)
@@ -54,8 +54,7 @@ static int get_trans_len_read_pos(struct scst_cmd *cmd, uint8_t off);
 #define SCST_CDB_RESERVED   'R'        /* reserved  */
 #define SCST_CDB_NOTSUPP    ' '        /* don't use */
 
-struct scst_sdbops
-{
+struct scst_sdbops {
        uint8_t ops;            /* SCSI-2 op codes */
        uint8_t devkey[16];     /* Key for every device type M,O,V,R
                                 * type_disk      devkey[0]
index 2c0c449..d76ac56 100644 (file)
@@ -109,11 +109,10 @@ void debug_print_buffer(const char *log_level, const void *data, int len)
                        trace_buf[i++] = '.';
        }
        trace_buf[i] = '\0';
-       if (f) {
-               PRINT(log_level, "%s", trace_buf)
-       } else {
+       if (f)
+               PRINT(log_level, "%s", trace_buf);
+       else
                PRINT(NO_FLAG, "%s", trace_buf);
-       }
 
        spin_unlock_irqrestore(&trace_buf_lock, flags);
        return;
index f561324..5925c30 100644 (file)
@@ -438,9 +438,8 @@ 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) &&
-           !sess->tgt->tgtt->no_clustering) {
+           !sess->tgt->tgtt->no_clustering)
                scst_sgv_pool_use_norm_clust(tgt_dev);
-       }
 
        if (sess->tgt->tgtt->unchecked_isa_dma || ini_unchecked_isa_dma) {
                scst_sgv_pool_use_dma(tgt_dev);
@@ -455,8 +454,7 @@ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess,
                      "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 {
+       } else {
                TRACE_MGMT_DBG("Virtual device %s on SCST lun=%Ld",
                        dev->virt_name, (uint64_t)tgt_dev->lun);
        }
@@ -834,9 +832,8 @@ int scst_acg_add_name(struct scst_acg *acg, const char *name)
        list_add_tail(&n->acn_list_entry, &acg->acn_list);
 
 out:
-       if (res == 0) {
+       if (res == 0)
                PRINT_INFO("Added name %s to group %s", name, acg->acg_name);
-       }
 
        TRACE_EXIT_RES(res);
        return res;
@@ -1424,8 +1421,7 @@ void scst_check_retries(struct scst_tgt *tgt)
         */
        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;
 
@@ -2729,9 +2725,8 @@ restart:
                        list_del(&cmd->sn_cmd_list_entry);
                        spin_unlock_irq(&tgt_dev->sn_lock);
                        if (test_and_set_bit(SCST_CMD_CAN_BE_DESTROYED,
-                                       &cmd->cmd_flags)) {
+                                            &cmd->cmd_flags))
                                scst_destroy_put_cmd(cmd);
-                       }
                        scst_inc_expected_sn(tgt_dev, slot);
                        expected_sn = tgt_dev->expected_sn;
                        spin_lock_irq(&tgt_dev->sn_lock);
@@ -3163,7 +3158,8 @@ unsigned long scst_random(void)
        hi = rv / 127773;
        lo = rv % 127773;
        rv = 16807 * lo - 2836 * hi;
-       if (rv <= 0) rv += 2147483647;
+       if (rv <= 0)
+               rv += 2147483647;
        RandomValue = rv;
        spin_unlock_irqrestore(&lock, flags);
        return rv;
@@ -3182,8 +3178,7 @@ static void tm_dbg_timer_fn(unsigned long arg);
 
 static spinlock_t scst_tm_dbg_lock = SPIN_LOCK_UNLOCKED;
 /* All serialized by scst_tm_dbg_lock */
-struct
-{
+struct {
        unsigned int tm_dbg_release:1;
        unsigned int tm_dbg_blocked:1;
 } tm_dbg_flags;
index fee41c1..a98d940 100644 (file)
@@ -147,8 +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",
 };
 
@@ -542,8 +541,7 @@ out_up:
                    "scsi%d, channel %d, id %d, lun %d, type %d",
                    scsidp->host->host_no, scsidp->channel, scsidp->id,
                    scsidp->lun, scsidp->type);
-       }
-       else {
+       } 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,
@@ -696,8 +694,7 @@ out:
        if (res > 0) {
                PRINT_INFO("Attached SCSI target mid-level to virtual "
                    "device %s (id %d)", dev_name, dev->virt_id);
-       }
-       else {
+       } else {
                PRINT_INFO("Failed to attach SCSI target mid-level to "
                    "virtual device %s", dev_name);
        }
@@ -807,9 +804,8 @@ int __scst_register_dev_driver(struct scst_dev_type *dev_type,
                goto out_up;
 
        res = scst_build_proc_dev_handler_dir_entries(dev_type);
-       if (res < 0) {
+       if (res < 0)
                goto out_up;
-       }
 
        list_add_tail(&dev_type->dev_type_list_entry, &scst_dev_type_list);
 
@@ -1033,9 +1029,8 @@ void scst_del_dev_threads(struct scst_device *dev, int num)
        list_for_each_entry_safe(ct, tmp, &dev->threads_list,
                                thread_list_entry) {
                int rc = kthread_stop(ct->cmd_thread);
-               if (rc < 0) {
+               if (rc < 0)
                        TRACE_MGMT_DBG("kthread_stop() failed: %d", rc);
-               }
                list_del(&ct->thread_list_entry);
                kfree(ct);
                if ((num > 0) && (++i >= num))
@@ -1204,9 +1199,8 @@ void __scst_del_cmd_threads(int num)
                int res;
 
                res = kthread_stop(ct->cmd_thread);
-               if (res < 0) {
+               if (res < 0)
                        TRACE_MGMT_DBG("kthread_stop() failed: %d", res);
-               }
                list_del(&ct->thread_list_entry);
                kfree(ct);
                scst_threads_info.nr_cmd_threads--;
@@ -1553,7 +1547,10 @@ static int __init init_scst(void)
                p = KMEM_CACHE(s, SCST_SLAB_FLAGS);                     \
                TRACE_MEM("Slab create: %s at %p size %zd", #s, p,      \
                          sizeof(struct s));                            \
-               if (p == NULL) { res = -ENOMEM; goto o; }               \
+               if (p == NULL) {                                        \
+                       res = -ENOMEM;                                  \
+                       goto o;                                         \
+               }                                                       \
        } while (0)
 
        INIT_CACHEP(scst_mgmt_cachep, scst_mgmt_cmd, out);
index be82181..0da1727 100644 (file)
@@ -809,9 +809,8 @@ void scst_free(struct scatterlist *sg, int count)
 static void sgv_pool_cached_init(struct sgv_pool *pool)
 {
        int i;
-       for (i = 0; i < SGV_POOL_ELEMENTS; i++) {
+       for (i = 0; i < SGV_POOL_ELEMENTS; i++)
                INIT_LIST_HEAD(&pool->recycling_lists[i]);
-       }
 }
 
 int sgv_pool_init(struct sgv_pool *pool, const char *name, int clustered)
index 8294dd8..308384f 100644 (file)
@@ -30,8 +30,7 @@ struct trans_tbl_ent {
        unsigned short pg_count;
 };
 
-struct sgv_pool_obj
-{
+struct sgv_pool_obj {
        int order;
 
        struct {
@@ -50,30 +49,26 @@ struct sgv_pool_obj
        struct scatterlist sg_entries_data[0];
 };
 
-struct sgv_pool_acc
-{
+struct sgv_pool_acc {
        u32 cached_pages, cached_entries;
        atomic_t big_alloc, other_alloc;
        atomic_t big_pages, other_pages;
        atomic_t big_merged, other_merged;
 };
 
-struct sgv_pool_cache_acc
-{
+struct sgv_pool_cache_acc {
        atomic_t total_alloc, hit_alloc;
        atomic_t merged;
 };
 
-struct sgv_pool_alloc_fns
-{
+struct sgv_pool_alloc_fns {
        struct page *(*alloc_pages_fn)(struct scatterlist *sg, gfp_t gfp_mask,
                void *priv);
        void (*free_pages_fn)(struct scatterlist *sg, int sg_count,
                void *priv);
 };
 
-struct sgv_pool
-{
+struct sgv_pool {
        unsigned int clustered;
        struct sgv_pool_alloc_fns alloc_fns;
        /* 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 */
@@ -89,8 +84,7 @@ struct sgv_pool
        struct list_head sgv_pool_list_entry;
 };
 
-struct scst_sgv_pools_manager
-{
+struct scst_sgv_pools_manager {
        struct {
                struct sgv_pool norm_clust, norm;
                struct sgv_pool dma;
index 78247ab..253e825 100644 (file)
@@ -181,8 +181,7 @@ extern struct list_head scst_active_mgmt_cmd_list;
 extern struct list_head scst_delayed_mgmt_cmd_list;
 extern wait_queue_head_t scst_mgmt_cmd_list_waitQ;
 
-struct scst_tasklet
-{
+struct scst_tasklet {
        spinlock_t tasklet_lock;
        struct list_head tasklet_cmd_list;
        struct tasklet_struct tasklet;
index fb8143f..e66c408 100644 (file)
@@ -268,9 +268,8 @@ int scst_proc_log_entry_write(struct file *file, const char *buf,
                p += 6;
                action = SCST_PROC_ACTION_VALUE;
        } else {
-               if (p[strlen(p) - 1] == '\n') {
+               if (p[strlen(p) - 1] == '\n')
                        p[strlen(p) - 1] = '\0';
-               }
                PRINT_ERROR("Unknown action \"%s\"", p);
                res = -EINVAL;
                goto out_free;
@@ -289,13 +288,11 @@ int scst_proc_log_entry_write(struct file *file, const char *buf,
        case SCST_PROC_ACTION_SET:
        case SCST_PROC_ACTION_ADD:
        case SCST_PROC_ACTION_DEL:
-               while (isspace(*p) && *p != '\0') {
+               while (isspace(*p) && *p != '\0')
                        p++;
-               }
                e = p;
-               while (!isspace(*e) && *e != '\0') {
+               while (!isspace(*e) && *e != '\0')
                        e++;
-               }
                *e = 0;
                if (tbl) {
                        t = tbl;
@@ -324,9 +321,8 @@ int scst_proc_log_entry_write(struct file *file, const char *buf,
                }
                break;
        case SCST_PROC_ACTION_VALUE:
-               while (isspace(*p) && *p != '\0') {
+               while (isspace(*p) && *p != '\0')
                        p++;
-               }
                level = simple_strtoul(p, NULL, 0);
                break;
        }
@@ -802,17 +798,14 @@ int __init scst_proc_init_module(void)
                goto out_remove4;
        }
 
-       if (scst_proc_init_module_log() < 0) {
+       if (scst_proc_init_module_log() < 0)
                goto out_remove5;
-       }
 
-       if (scst_proc_init_groups() < 0) {
+       if (scst_proc_init_groups() < 0)
                goto out_remove6;
-       }
 
-       if (scst_proc_init_sgv() < 0) {
+       if (scst_proc_init_sgv() < 0)
                goto out_remove7;
-       }
 
 out:
        TRACE_EXIT_RES(res);
@@ -1251,9 +1244,8 @@ static ssize_t scst_proc_scsi_tgt_gen_write(struct file *file, const char __user
         *   or   echo "assign H:C:I:L HANDLER_NAME" >/proc/scsi_tgt/scsi_tgt
         */
        p = buffer;
-       if (p[strlen(p) - 1] == '\n') {
+       if (p[strlen(p) - 1] == '\n')
                p[strlen(p) - 1] = '\0';
-       }
        if (!strncasecmp("assign ", p, 7)) {
                p += 7;
                action = SCST_PROC_ACTION_ASSIGN;
@@ -1345,9 +1337,8 @@ static int scst_proc_assign_handler(char *buf)
 
        TRACE_ENTRY();
 
-       while (isspace(*p) && *p != '\0') {
+       while (isspace(*p) && *p != '\0')
                p++;
-       }
 
        host = simple_strtoul(p, &p, 0);
        if ((host == ULONG_MAX) || (*p != ':'))
@@ -1367,13 +1358,11 @@ static int scst_proc_assign_handler(char *buf)
 
        e = p;
        e++;
-       while (isspace(*e) && *e != '\0') {
+       while (isspace(*e) && *e != '\0')
                e++;
-       }
        ee = e;
-       while (!isspace(*ee) && *ee != '\0') {
+       while (!isspace(*ee) && *ee != '\0')
                ee++;
-       }
        *ee = '\0';
 
        TRACE_DBG("Dev %ld:%ld:%ld:%ld, handler %s", host, channel, id, lun, e);
@@ -1383,8 +1372,7 @@ static int scst_proc_assign_handler(char *buf)
                    d->scsi_dev->host->host_no == host &&
                    d->scsi_dev->channel == channel &&
                    d->scsi_dev->id == id &&
-                   d->scsi_dev->lun == lun)
-               {
+                   d->scsi_dev->lun == lun) {
                        dev = d;
                        TRACE_DBG("Dev %p (%ld:%ld:%ld:%ld) found",
                                  dev, host, channel, id, lun);
@@ -1476,9 +1464,8 @@ static ssize_t scst_proc_groups_devices_write(struct file *file, const char __us
         *   or   echo "clear" >/proc/scsi_tgt/groups/GROUP/devices
         */
        p = buffer;
-       if (p[strlen(p) - 1] == '\n') {
+       if (p[strlen(p) - 1] == '\n')
                p[strlen(p) - 1] = '\0';
-       }
        if (!strncasecmp("clear", p, 5)) {
                action = SCST_PROC_ACTION_CLEAR;
        } else if (!strncasecmp("add ", p, 4)) {
@@ -1503,9 +1490,8 @@ static ssize_t scst_proc_groups_devices_write(struct file *file, const char __us
        switch (action) {
        case SCST_PROC_ACTION_ADD:
        case SCST_PROC_ACTION_DEL:
-               while (isspace(*p) && *p != '\0') {
+               while (isspace(*p) && *p != '\0')
                        p++;
-               }
                e = p; /* save p */
                host = simple_strtoul(p, &p, 0);
                if (*p == ':') {
@@ -1516,9 +1502,8 @@ static ssize_t scst_proc_groups_devices_write(struct file *file, const char __us
                } else {
                        virt++;
                        p = e; /* restore p */
-                       while (!isspace(*e) && *e != '\0') {
+                       while (!isspace(*e) && *e != '\0')
                                e++;
-                       }
                        *e = 0;
                }
 
@@ -1561,17 +1546,14 @@ static ssize_t scst_proc_groups_devices_write(struct file *file, const char __us
        switch (action) {
        case SCST_PROC_ACTION_ADD:
                e++;
-               while (isspace(*e) && *e != '\0') {
+               while (isspace(*e) && *e != '\0')
                        e++;
-               }
                virt_lun = simple_strtoul(e, &e, 0);
 
-               while (isspace(*e) && *e != '\0') {
+               while (isspace(*e) && *e != '\0')
                        e++;
-               }
-               if (!strncasecmp("READ_ONLY", e, 9)) {
+               if (!strncasecmp("READ_ONLY", e, 9))
                        read_only = 1;
-               }
 
                list_for_each_entry(acg_dev_tmp, &acg->acg_dev_list,
                                    acg_dev_list_entry) {
@@ -1667,9 +1649,8 @@ static ssize_t scst_proc_groups_names_write(struct file *file, const char __user
         *   or   echo "clear" >/proc/scsi_tgt/groups/GROUP/names
         */
        p = buffer;
-       if (p[strlen(p) - 1] == '\n') {
+       if (p[strlen(p) - 1] == '\n')
                p[strlen(p) - 1] = '\0';
-       }
        if (!strncasecmp("clear", p, 5)) {
                action = SCST_PROC_ACTION_CLEAR;
        } else if (!strncasecmp("add ", p, 4)) {
@@ -1687,13 +1668,11 @@ static ssize_t scst_proc_groups_names_write(struct file *file, const char __user
        switch (action) {
        case SCST_PROC_ACTION_ADD:
        case SCST_PROC_ACTION_DEL:
-               while (isspace(*p) && *p != '\0') {
+               while (isspace(*p) && *p != '\0')
                        p++;
-               }
                e = p;
-               while (!isspace(*e) && *e != '\0') {
+               while (!isspace(*e) && *e != '\0')
                        e++;
-               }
                *e = 0;
                break;
        }
@@ -1976,9 +1955,8 @@ int scst_proc_log_entry_read(struct seq_file *seq, unsigned long log_level,
 
        scst_proc_read_tlb(scst_proc_trace_tbl, seq, log_level, &first);
 
-       if (tbl) {
+       if (tbl)
                scst_proc_read_tlb(tbl, seq, log_level, &first);
-       }
 
        seq_printf(seq, "%s\n", first ? "none" : "");
 
index 67ddc2a..186dbf0 100644 (file)
@@ -201,8 +201,7 @@ void scst_cmd_init_done(struct scst_cmd *cmd, int pref_context)
 
 #ifdef EXTRACHECKS
        if (unlikely(in_irq()) && ((pref_context == SCST_CONTEXT_DIRECT) ||
-                        (pref_context == SCST_CONTEXT_DIRECT_ATOMIC)))
-       {
+                        (pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) {
                PRINT_ERROR("Wrong context %d in IRQ from target %s, use "
                        "SCST_CONTEXT_TASKLET instead\n", pref_context,
                        cmd->tgtt->name);
@@ -962,8 +961,7 @@ void scst_rx_data(struct scst_cmd *cmd, int status, int pref_context)
 
 #ifdef EXTRACHECKS
        if (in_irq() && ((pref_context == SCST_CONTEXT_DIRECT) ||
-                        (pref_context == SCST_CONTEXT_DIRECT_ATOMIC)))
-       {
+                        (pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) {
                PRINT_ERROR("Wrong context %d in IRQ from target %s, use "
                        "SCST_CONTEXT_TASKLET instead\n", pref_context,
                        cmd->tgtt->name);
@@ -1228,8 +1226,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]);
                scst_set_cmd_error(cmd,
@@ -2390,8 +2387,7 @@ static int scst_dev_done(struct scst_cmd *cmd)
 
        state = SCST_CMD_STATE_PRE_XMIT_RESP;
        if (likely(!scst_is_cmd_local(cmd)) &&
-           likely(cmd->dev->handler->dev_done != NULL))
-       {
+           likely(cmd->dev->handler->dev_done != NULL)) {
                int rc;
                TRACE_DBG("Calling dev handler %s dev_done(%p)",
                      cmd->dev->handler->name, cmd);