From: <vl...@us...> - 2006-12-14 18:10:46
|
Revision: 60 http://svn.sourceforge.net/scst/?rev=60&view=rev Author: vlnb Date: 2006-12-14 10:10:39 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Update to work on 2.6.19. Mostly done by Ming Zhang. Modified Paths: -------------- trunk/qla2x00t/qla_attr.c trunk/qla2x00t/qla_def.h trunk/qla2x00t/qla_gbl.h trunk/qla2x00t/qla_inline.h trunk/qla2x00t/qla_isr.c trunk/scst/include/scst_debug.h trunk/scst/src/dev_handlers/scst_fileio.c trunk/scst/src/scst.c Modified: trunk/qla2x00t/qla_attr.c =================================================================== --- trunk/qla2x00t/qla_attr.c 2006-12-14 17:53:01 UTC (rev 59) +++ trunk/qla2x00t/qla_attr.c 2006-12-14 18:10:39 UTC (rev 60) @@ -681,13 +681,29 @@ 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 Modified: trunk/qla2x00t/qla_def.h =================================================================== --- trunk/qla2x00t/qla_def.h 2006-12-14 17:53:01 UTC (rev 59) +++ trunk/qla2x00t/qla_def.h 2006-12-14 18:10:39 UTC (rev 60) @@ -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 @@ 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 *); Modified: trunk/qla2x00t/qla_gbl.h =================================================================== --- trunk/qla2x00t/qla_gbl.h 2006-12-14 17:53:01 UTC (rev 59) +++ trunk/qla2x00t/qla_gbl.h 2006-12-14 18:10:39 UTC (rev 60) @@ -213,9 +213,15 @@ /* * 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 *); Modified: trunk/qla2x00t/qla_inline.h =================================================================== --- trunk/qla2x00t/qla_inline.h 2006-12-14 17:53:01 UTC (rev 59) +++ trunk/qla2x00t/qla_inline.h 2006-12-14 18:10:39 UTC (rev 60) @@ -104,7 +104,11 @@ 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 *); Modified: trunk/qla2x00t/qla_isr.c =================================================================== --- trunk/qla2x00t/qla_isr.c 2006-12-14 17:53:01 UTC (rev 59) +++ trunk/qla2x00t/qla_isr.c 2006-12-14 18:10:39 UTC (rev 60) @@ -32,8 +32,13 @@ * * 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 @@ * * 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 @@ * * 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; Modified: trunk/scst/include/scst_debug.h =================================================================== --- trunk/scst/include/scst_debug.h 2006-12-14 17:53:01 UTC (rev 59) +++ trunk/scst/include/scst_debug.h 2006-12-14 18:10:39 UTC (rev 60) @@ -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 Modified: trunk/scst/src/dev_handlers/scst_fileio.c =================================================================== --- trunk/scst/src/dev_handlers/scst_fileio.c 2006-12-14 17:53:01 UTC (rev 59) +++ trunk/scst/src/dev_handlers/scst_fileio.c 2006-12-14 18:10:39 UTC (rev 60) @@ -293,15 +293,20 @@ 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 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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()); Modified: trunk/scst/src/scst.c =================================================================== --- trunk/scst/src/scst.c 2006-12-14 17:53:01 UTC (rev 59) +++ trunk/scst/src/scst.c 2006-12-14 18:10:39 UTC (rev 60) @@ -1249,6 +1249,7 @@ 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 @@ } \ 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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |