qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha)
{
struct Scsi_Host *host = ha->host;
-
- sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
- sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
- sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr);
- sysfs_create_bin_file(&host->shost_gendev.kobj,
+ int ret;
+
+ ret = sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
+ if (ret)
+ qla_printk(KERN_INFO, ha, "sysfs_create_bin_file() failed: "
+ "%d\n", ret);
+ ret = sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
+ if (ret)
+ qla_printk(KERN_INFO, ha, "sysfs_create_bin_file() failed: "
+ "%d\n", ret);
+ ret = sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr);
+ if (ret)
+ qla_printk(KERN_INFO, ha, "sysfs_create_bin_file() failed: "
+ "%d\n", ret);
+ ret = sysfs_create_bin_file(&host->shost_gendev.kobj,
&sysfs_optrom_ctl_attr);
- sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_vpd_attr);
+ if (ret)
+ qla_printk(KERN_INFO, ha, "sysfs_create_bin_file() failed: "
+ "%d\n", ret);
+ ret = sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_vpd_attr);
+ if (ret)
+ qla_printk(KERN_INFO, ha, "sysfs_create_bin_file() failed: "
+ "%d\n", ret);
}
void
#include <linux/workqueue.h>
#include <linux/firmware.h>
#include <asm/semaphore.h>
+#include <linux/version.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
char * (*pci_info_str) (struct scsi_qla_host *, char *);
char * (*fw_version_str) (struct scsi_qla_host *, char *);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
irqreturn_t (*intr_handler) (int, void *, struct pt_regs *);
+#else
+ irq_handler_t intr_handler;
+#endif
void (*enable_intrs) (struct scsi_qla_host *);
void (*disable_intrs) (struct scsi_qla_host *);
/*
* Global Function Prototypes in qla_isr.c source file.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
extern irqreturn_t qla2100_intr_handler(int, void *, struct pt_regs *);
extern irqreturn_t qla2300_intr_handler(int, void *, struct pt_regs *);
extern irqreturn_t qla24xx_intr_handler(int, void *, struct pt_regs *);
+#else
+extern irqreturn_t qla2100_intr_handler(int, void *);
+extern irqreturn_t qla2300_intr_handler(int, void *);
+extern irqreturn_t qla24xx_intr_handler(int, void *);
+#endif
extern void qla2x00_process_response_queue(struct scsi_qla_host *);
extern void qla24xx_process_response_queue(struct scsi_qla_host *);
static inline void
qla2x00_poll(scsi_qla_host_t *ha)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
ha->isp_ops.intr_handler(0, ha, NULL);
+#else
+ ha->isp_ops.intr_handler(0, ha);
+#endif
}
static __inline__ void qla2x00_check_fabric_devices(scsi_qla_host_t *);
*
* Returns handled flag.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
irqreturn_t
qla2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
+#else
+irqreturn_t
+qla2100_intr_handler(int irq, void *dev_id)
+#endif
{
scsi_qla_host_t *ha;
struct device_reg_2xxx __iomem *reg;
*
* Returns handled flag.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
irqreturn_t
qla2300_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
+#else
+irqreturn_t
+qla2300_intr_handler(int irq, void *dev_id)
+#endif
{
scsi_qla_host_t *ha;
struct device_reg_2xxx __iomem *reg;
*
* Returns handled flag.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
irqreturn_t
qla24xx_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
+#else
+irqreturn_t
+qla24xx_intr_handler(int irq, void *dev_id)
+#endif
{
scsi_qla_host_t *ha;
struct device_reg_24xx __iomem *reg;
#ifndef __SCST_DEBUG_H
#define __SCST_DEBUG_H
-#include <linux/config.h> /* for CONFIG_* */
+#include <linux/autoconf.h> /* for CONFIG_* */
#if !defined(EXTRACHECKS) && defined(CONFIG_SCSI_TARGET_EXTRACHECKS)
#define EXTRACHECKS
goto out;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
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) ||
+ (fd->f_op->aio_write == NULL))
+#endif
{
PRINT_ERROR_PR("%s", "Wrong f_op or FS doesn't have "
"required capabilities");
res = -EINVAL;
goto out_close_file;
}
-
+
/* seek to end */
old_fs = get_fs();
set_fs(get_ds());
}
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);
+ dev_id_num, dev_id_str, len);
if (0 == cmd->cdb[2]) { /* supported vital product data pages */
buf[3] = 3;
buf[4] = 0x0; /* this page */
return ftgt_dev->iv;
}
+/*
+ * copied from <ksrc>/fs/read_write.*
+ */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+static void wait_on_retry_sync_kiocb(struct kiocb *iocb)
+{
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ if (!kiocbIsKicked(iocb))
+ schedule();
+ else
+ kiocbClearKicked(iocb);
+ __set_current_state(TASK_RUNNING);
+}
+
+typedef ssize_t (*iov_fn_t)(struct kiocb *, const struct iovec *,
+ unsigned long, loff_t);
+
+ssize_t do_sync_readv_writev(struct file *filp, const struct iovec *iov,
+ unsigned long nr_segs, size_t len, loff_t *ppos, iov_fn_t fn)
+{
+ struct kiocb kiocb;
+ ssize_t ret;
+
+ init_sync_kiocb(&kiocb, filp);
+ kiocb.ki_pos = *ppos;
+ kiocb.ki_left = len;
+ kiocb.ki_nbytes = len;
+
+ for (;;) {
+ ret = fn(&kiocb, iov, nr_segs, kiocb.ki_pos);
+ if (ret != -EIOCBRETRY)
+ break;
+ wait_on_retry_sync_kiocb(&kiocb);
+ }
+
+ if (ret == -EIOCBQUEUED)
+ ret = wait_on_sync_kiocb(&kiocb);
+ *ppos = kiocb.ki_pos;
+ return ret;
+}
+#endif
+
static void fileio_exec_read(struct scst_cmd *cmd, loff_t loff)
{
mm_segment_t old_fs;
if (virt_dev->nullio)
err = full_len;
else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
err = fd->f_op->readv(fd, iv, iv_count, &fd->f_pos);
+#else
+ err = do_sync_readv_writev(fd, iv, iv_count, full_len, &fd->f_pos, fd->f_op->aio_read);
+#endif
+
if ((err < 0) || (err < full_len)) {
PRINT_ERROR_PR("readv() returned %Ld from %zd", (uint64_t)err,
full_len);
if (virt_dev->nullio)
err = full_len;
else
+#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,
+ fd->f_op->aio_write);
+#endif
+
if (err < 0) {
PRINT_ERROR_PR("write() returned %Ld from %zd",
(uint64_t)err, full_len);
virt_dev->file_name, res);
goto out_free;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if ((fd->f_op == NULL) || (fd->f_op->readv == NULL)) {
+#else
+ if ((fd->f_op == NULL) || (fd->f_op->aio_read == NULL)) {
+#endif
PRINT_ERROR_PR("%s", "Wrong f_op or FS doesn't "
"have required capabilities");
res = -EINVAL;
filp_close(fd, NULL);
goto out_free;
}
-
/* seek to end */
old_fs = get_fs();
set_fs(get_ds());
scst_sgv_pools_deinit(&scst_sgv);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#define DEINIT_CACHEP(p, s) do { \
if (kmem_cache_destroy(p)) { \
PRINT_INFO_PR("kmem_cache_destroy of %s returned an "\
} \
p = NULL; \
} while (0)
+#else
+#define DEINIT_CACHEP(p, s) do { \
+ kmem_cache_destroy(p); \
+ p = NULL; \
+ } while (0)
+#endif
mempool_destroy(scst_mgmt_mempool);
mempool_destroy(scst_ua_mempool);