Patch from Alessandro Premoli fixes all the warnings of scst on 64-bit platforms
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Wed, 27 Jun 2007 16:19:38 +0000 (16:19 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Wed, 27 Jun 2007 16:19:38 +0000 (16:19 +0000)
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@138 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/README
scst/include/scst_debug.h
scst/src/dev_handlers/scst_dev_handler.h
scst/src/dev_handlers/scst_user.c
scst/src/scst.c
scst/src/scst_lib.c
scst/src/scst_mem.c
scst/src/scst_proc.c
scst/src/scst_targ.c

index 519e1b8..aa8f508 100644 (file)
@@ -621,4 +621,6 @@ Thanks to:
 
  * Michael G. Byrnes <michael.byrnes@hp.com> for fixes.
 
+ * Alessandro Premoli <a.premoli@andxor.it> for fixes
+
 Vladislav Bolkhovitin <vst@vlnb.net>, http://scst.sourceforge.net
index 1c9a369..c0fffd4 100644 (file)
@@ -21,6 +21,7 @@
 #define __SCST_DEBUG_H
 
 #include <linux/autoconf.h>    /* for CONFIG_* */
+#include <asm/bug.h>           /* for WARN_ON_ONCE */
 
 #if !defined(EXTRACHECKS) && defined(CONFIG_SCSI_TARGET_EXTRACHECKS)
 #define EXTRACHECKS
index edc921f..d74846b 100644 (file)
@@ -42,7 +42,7 @@ static int dev_handler_log_info_show(struct seq_file *seq, void *v)
        return res;
 }
 
-static int scst_dev_handler_proc_log_entry_write(struct file *file,
+static ssize_t scst_dev_handler_proc_log_entry_write(struct file *file,
        const char __user *buf, size_t length, loff_t *off)
 {
        int res = 0;
index 339a567..57315ae 100644 (file)
@@ -26,7 +26,7 @@
 #include "scst_user.h"
 #include "scst_dev_handler.h"
 
-#ifndef CONFIG_NOHIGHMEM
+#if !defined(CONFIG_NOHIGHMEM) && !defined(CONFIG_64BIT)
 #warning HIGHMEM kernel configurations are not supported. Consider \
        changing VMSPLIT option or using 64-bit configuration.
 #endif
@@ -2927,7 +2927,7 @@ static int __init init_scst_user(void)
 
        TRACE_ENTRY();
 
-#ifndef CONFIG_NOHIGHMEM
+#if !defined(CONFIG_NOHIGHMEM) && !defined(CONFIG_64BIT)
        PRINT_ERROR_PR("%s", "HIGHMEM kernel configurations are not supported. "
                "Consider changing VMSPLIT option or using 64-bit "
                "configuration.");
index 3c5f266..95ad6aa 100644 (file)
@@ -32,7 +32,7 @@
 #include "scst_priv.h"
 #include "scst_mem.h"
 
-#ifndef CONFIG_NOHIGHMEM
+#if !defined(CONFIG_NOHIGHMEM) && !defined(CONFIG_64BIT)
 #warning HIGHMEM kernel configurations are supported, but not recommended. \
        Consider changing VMSPLIT option or using 64-bit configuration instead.
 #endif
index eb86469..086f7d5 100644 (file)
@@ -1622,7 +1622,7 @@ int scst_get_cdb_info(const uint8_t *cdb_p, int dev_type,
 
        op = *cdb_p;    /* get clear opcode */
 
-       TRACE_DBG("opcode=%02x, cdblen=%d bytes, tblsize=%zd, "
+       TRACE_DBG("opcode=%02x, cdblen=%d bytes, tblsize=%d, "
                "dev_type=%d", op, SCST_GET_CDB_LEN(op), SCST_CDB_TBL_SIZE,
                dev_type);
 
@@ -1854,7 +1854,7 @@ int scst_sbc_generic_parse(struct scst_cmd *cmd,
                cmd->bufflen = info_cdb->transfer_len << get_block_shift(cmd);
        }
 
-       TRACE_DBG("res %d, bufflen %zd, data_len %zd, direct %d",
+       TRACE_DBG("res %d, bufflen %d, data_len %d, direct %d",
              res, cmd->bufflen, cmd->data_len, cmd->data_direction);
 
        TRACE_EXIT_RES(res);
@@ -1915,7 +1915,7 @@ int scst_cdrom_generic_parse(struct scst_cmd *cmd,
        if (info_cdb->flags & SCST_TRANSFER_LEN_TYPE_FIXED)
                cmd->bufflen = info_cdb->transfer_len << get_block_shift(cmd);
 
-       TRACE_DBG("res %d bufflen %zd direct %d",
+       TRACE_DBG("res %d bufflen %d direct %d",
              res, cmd->bufflen, cmd->data_direction);
 
        TRACE_EXIT();
@@ -1976,7 +1976,7 @@ int scst_modisk_generic_parse(struct scst_cmd *cmd,
        if (info_cdb->flags & SCST_TRANSFER_LEN_TYPE_FIXED)
                cmd->bufflen = info_cdb->transfer_len << get_block_shift(cmd);
 
-       TRACE_DBG("res %d bufflen %zd direct %d",
+       TRACE_DBG("res %d bufflen %d direct %d",
              res, cmd->bufflen, cmd->data_direction);
 
        TRACE_EXIT_RES(res);
@@ -2043,7 +2043,7 @@ static int scst_null_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb)
                break;
        }
 #endif
-       TRACE_DBG("res %d bufflen %zd direct %d",
+       TRACE_DBG("res %d bufflen %d direct %d",
              res, cmd->bufflen, cmd->data_direction);
 
        TRACE_EXIT();
index 947c2ec..f642518 100644 (file)
@@ -556,7 +556,7 @@ struct scatterlist *scst_alloc(int size, unsigned long gfp_mask,
 out:
        TRACE_MEM("Alloced sg %p (count %d)", res, *count);
 
-       TRACE_EXIT_HRES((int)res);
+       TRACE_EXIT_HRES(res);
        return res;
 
 out_free:
index 033e0fb..cb80a0b 100644 (file)
@@ -351,7 +351,7 @@ out:
        return res;
 }
 
-static int scst_proc_scsi_tgt_gen_write_log(struct file *file, const char __user *buf,
+static ssize_t scst_proc_scsi_tgt_gen_write_log(struct file *file, const char __user *buf,
                                        size_t length, loff_t *off)
 {
        int res;
@@ -736,7 +736,7 @@ void __exit scst_proc_cleanup_module(void)
        TRACE_EXIT();
 }
 
-static int scst_proc_threads_write(struct file *file, const char __user *buf,
+static ssize_t scst_proc_threads_write(struct file *file, const char __user *buf,
                                   size_t length, loff_t *off)
 {
        int res = length;
@@ -883,7 +883,7 @@ void scst_cleanup_proc_target_entries(struct scst_tgt *vtt)
        return;
 }
 
-static int scst_proc_scsi_tgt_write(struct file *file, const char __user *buf,
+static ssize_t scst_proc_scsi_tgt_write(struct file *file, const char __user *buf,
                                    size_t length, loff_t *off)
 {
        struct scst_tgt *vtt = (struct scst_tgt *)PDE(file->f_dentry->d_inode)->data;
@@ -1023,7 +1023,7 @@ void scst_cleanup_proc_dev_handler_dir_entries(struct scst_dev_type *dev_type)
        return;
 }
 
-static int scst_proc_scsi_dev_handler_write(struct file *file, const char __user *buf,
+static ssize_t scst_proc_scsi_dev_handler_write(struct file *file, const char __user *buf,
                                            size_t length, loff_t *off)
 {
        struct scst_dev_type *dev_type = (struct scst_dev_type *)PDE(file->f_dentry->d_inode)->data;
@@ -1083,7 +1083,7 @@ out:
        return res;
 }
 
-static int scst_proc_scsi_tgt_gen_write(struct file *file, const char __user *buf,
+static ssize_t scst_proc_scsi_tgt_gen_write(struct file *file, const char __user *buf,
                                        size_t length, loff_t *off)
 {
        int res = length, rc = 0, action;
@@ -1210,7 +1210,7 @@ static int scst_proc_assign_handler(char *buf)
 {
        int res = 0;
        char *p = buf, *e, *ee;
-       unsigned int host, channel = 0, id = 0, lun = 0;
+       unsigned long host, channel = 0, id = 0, lun = 0;
        struct scst_device *d, *dev = NULL;
        struct scst_dev_type *dt, *handler = NULL;
 
@@ -1247,7 +1247,7 @@ static int scst_proc_assign_handler(char *buf)
        }
        *ee = '\0';
 
-       TRACE_DBG("Dev %d:%d:%d:%d, handler %s", host, channel, id, lun, e);
+       TRACE_DBG("Dev %ld:%ld:%ld:%ld, handler %s", host, channel, id, lun, e);
 
        list_for_each_entry(d, &scst_dev_list, dev_list_entry) {
                if ((d->virt_id == 0) &&
@@ -1257,14 +1257,14 @@ static int scst_proc_assign_handler(char *buf)
                    d->scsi_dev->lun == lun)
                {
                        dev = d;
-                       TRACE_DBG("Dev %p (%d:%d:%d:%d) found",
+                       TRACE_DBG("Dev %p (%ld:%ld:%ld:%ld) found",
                                  dev, host, channel, id, lun);
                        break;
                }
        }
 
        if (dev == NULL) {
-               PRINT_ERROR_PR("Device %d:%d:%d:%d not found",
+               PRINT_ERROR_PR("Device %ld:%ld:%ld:%ld not found",
                               host, channel, id, lun);
                res = -EINVAL;
                goto out;
@@ -1305,7 +1305,7 @@ out_synt_err:
        goto out;
 }
 
-static int scst_proc_groups_devices_write(struct file *file, const char __user *buf,
+static ssize_t scst_proc_groups_devices_write(struct file *file, const char __user *buf,
                                          size_t length, loff_t *off)
 {
        int res = length, action, virt = 0, rc, read_only = 0;
@@ -1499,7 +1499,7 @@ out:
        return res;
 }
 
-static int scst_proc_groups_names_write(struct file *file, const char __user *buf,
+static ssize_t scst_proc_groups_names_write(struct file *file, const char __user *buf,
                                        size_t length, loff_t *off)
 {
        int res = length, action;
index 65fc048..eb449de 100644 (file)
@@ -402,7 +402,7 @@ call_parse:
        if (scst_cmd_is_expected_set(cmd)) {
                if (cmd->expected_transfer_len < cmd->bufflen) {
                        TRACE(TRACE_SCSI, "cmd->expected_transfer_len(%d) < "
-                               "cmd->bufflen(%zd), using expected_transfer_len "
+                               "cmd->bufflen(%d), using expected_transfer_len "
                                "instead", cmd->expected_transfer_len,
                                cmd->bufflen);
                        cmd->bufflen = cmd->expected_transfer_len;
@@ -433,7 +433,7 @@ call_parse:
        {
                PRINT_ERROR_PR("Dev handler %s parse() returned "
                               "invalid cmd data_direction %d, "
-                              "bufflen %zd or state %d (opcode 0x%x)",
+                              "bufflen %d or state %d (opcode 0x%x)",
                               dev->handler->name, 
                               cmd->data_direction, cmd->bufflen,
                               state, cmd->cdb[0]);
@@ -680,7 +680,7 @@ out:
 
 out_no_space:
        TRACE(TRACE_OUT_OF_MEM, "Unable to allocate or build requested buffer "
-               "(size %zd), sending BUSY or QUEUE FULL status", cmd->bufflen);
+               "(size %d), sending BUSY or QUEUE FULL status", cmd->bufflen);
        scst_low_cur_max_cmd_mem();
        scst_set_busy(cmd);
        cmd->state = SCST_CMD_STATE_DEV_DONE;
@@ -1765,7 +1765,7 @@ void scst_inc_expected_sn(struct scst_tgt_dev *tgt_dev, atomic_t *slot)
 
        /* Optimized for lockless fast path */
 
-       TRACE_SN("Slot %d, *cur_sn_slot %d", slot - tgt_dev->sn_slots,
+       TRACE_SN("Slot %zd, *cur_sn_slot %d", slot - tgt_dev->sn_slots,
                atomic_read(slot));
 
        if (!atomic_dec_and_test(slot))
@@ -2521,7 +2521,7 @@ ordered:
                                                ARRAY_SIZE(tgt_dev->sn_slots))
                                            tgt_dev->cur_sn_slot = tgt_dev->sn_slots;
                                } while(atomic_read(tgt_dev->cur_sn_slot) != 0);
-                               TRACE_SN("New cur SN slot %d",
+                               TRACE_SN("New cur SN slot %zd",
                                        tgt_dev->cur_sn_slot-tgt_dev->sn_slots);
                        } else
                                tgt_dev->num_free_sn_slots++;
@@ -2550,7 +2550,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 %d)", cmd, cmd->sn, tgt_dev,
+               "cur_sn_slot %zd)", cmd, cmd->sn, tgt_dev,
                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);