Update to work on 2.6.19. Mostly done by Ming Zhang.

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@60 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2006-12-14 18:10:39 +00:00
parent bf30ca2c93
commit 0e04ac351a
8 changed files with 123 additions and 9 deletions
+21 -5
View File
@@ -681,13 +681,29 @@ void
qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha)
{
struct Scsi_Host *host = ha->host;
int ret;
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,
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
+5
View File
@@ -24,6 +24,7 @@
#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>
@@ -2116,7 +2117,11 @@ struct isp_operations {
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 *);
+6
View File
@@ -213,9 +213,15 @@ qla2x00_stop_firmware(scsi_qla_host_t *);
/*
* 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 *);
+4
View File
@@ -104,7 +104,11 @@ static __inline__ void qla2x00_poll(scsi_qla_host_t *);
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 *);
+15
View File
@@ -32,8 +32,13 @@ static void qla24xx_ms_entry(scsi_qla_host_t *, struct ct_entry_24xx *);
*
* 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;
@@ -112,8 +117,13 @@ qla2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
*
* 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;
@@ -1571,8 +1581,13 @@ qla24xx_process_response_queue(struct scsi_qla_host *ha)
*
* 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;
+1 -1
View File
@@ -20,7 +20,7 @@
#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
+64 -3
View File
@@ -293,15 +293,20 @@ static int fileio_attach(struct scst_device *dev)
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());
@@ -1194,7 +1199,7 @@ static void fileio_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);
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 */
@@ -1928,6 +1933,48 @@ out:
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;
@@ -1988,7 +2035,12 @@ static void fileio_exec_read(struct scst_cmd *cmd, loff_t loff)
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);
@@ -2076,7 +2128,13 @@ restart:
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);
@@ -2778,14 +2836,17 @@ static int cdrom_fileio_change(char *p, char *name)
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());
+7
View File
@@ -1249,6 +1249,7 @@ static void __exit exit_scst(void)
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 "\
@@ -1256,6 +1257,12 @@ static void __exit exit_scst(void)
} \
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);