From: Jan RÄ™korajski Date: Tue, 9 May 2017 19:44:34 +0000 (+0200) Subject: - started update to 3.0.18 X-Git-Tag: auto/th/lin_tape-3.0.18-1~2 X-Git-Url: https://git.pld-linux.org/?p=packages%2Flin_tape.git;a=commitdiff_plain;h=300a759 - started update to 3.0.18 --- diff --git a/clean-ifdefs.patch b/clean-ifdefs.patch index 118296a..1a4f8fd 100644 --- a/clean-ifdefs.patch +++ b/clean-ifdefs.patch @@ -1,26 +1,26 @@ -diff -ur lin_tape-3.0.8/Makefile lin_tape-3.0.8-norh/Makefile ---- lin_tape-3.0.8/Makefile 2016-06-19 09:57:15.497134019 +0200 -+++ lin_tape-3.0.8-norh/Makefile 2016-06-19 09:53:34.317661494 +0200 -@@ -18,15 +18,6 @@ +diff -ur lin_tape-3.0.18/Makefile lin_tape-3.0.18-ifdefs/Makefile +--- lin_tape-3.0.18/Makefile 2017-05-09 21:11:32.977092391 +0200 ++++ lin_tape-3.0.18-ifdefs/Makefile 2017-05-09 21:05:59.610307494 +0200 +@@ -20,15 +20,6 @@ lin_tape-objs := join.o lin_tape_scsi_config.o lin_tape_scsi_tape.o lin_tape_scsi_trace.o \ lin_tape_ioctl_tape.o lin_tape_ioctl_changer.o lin_tape_extra_ioctl.o -RHELRELEASE := $(shell [ -f "/etc/redhat-release" ] && echo 1 || echo 0) -ifeq ($(RHELRELEASE), 1) -KERNELDIR ?= /lib/modules/$(shell uname -r)/build --KERNELVER = $(shell cd ${KERNELDIR}; make kernelversion 2>/dev/null|sed "s/[\.-]/_/g"|sed "s/\([0-9]*_[0-9]*_[0-9]*_[0-9]*\).*/\1/") +-KERNELVER = $(shell uname -r 2>/dev/null|sed "s/[\.-]/_/g"|sed "s/\([0-9]*_[0-9]*_[0-9]*_[0-9]*\).*/\1/") -EXTRA_CFLAGS += -DKERNELVERSION_${KERNELVER} -else -EXTRA_CFLAGS += -DSLESVERSION -endif -- - PROC := $(shell uname -m) - - ifeq ($(PROC), ppc64) -diff -ur lin_tape-3.0.8/pfo.h lin_tape-3.0.8-norh/pfo.h ---- lin_tape-3.0.8/pfo.h 2016-03-17 03:37:58.000000000 +0100 -+++ lin_tape-3.0.8-norh/pfo.h 2016-06-19 09:53:34.000000000 +0200 -@@ -26,82 +26,6 @@ +- + ifeq ($(SFMP), 1) + EXTRA_CFLAGS += -DSFMPENABLED + endif +diff -ur lin_tape-3.0.18/pfo.h lin_tape-3.0.18-ifdefs/pfo.h +--- lin_tape-3.0.18/pfo.h 2017-02-23 19:14:41.000000000 +0100 ++++ lin_tape-3.0.18-ifdefs/pfo.h 2017-05-09 21:06:34.117699008 +0200 +@@ -26,97 +26,6 @@ * will build for various releases of Linux. This is how * we track different versions using ifdef in the source. */ @@ -32,6 +32,7 @@ diff -ur lin_tape-3.0.8/pfo.h lin_tape-3.0.8-norh/pfo.h -#define BEFORE_RH_67 1 -#define BEFORE_RH_70 1 -#define BEFORE_RH_71 1 +-#define BEFORE_RH_72 1 -#endif -#ifdef KERNELVERSION_2_6_32_279 -#define AFTER_RH_62 1 @@ -41,6 +42,7 @@ diff -ur lin_tape-3.0.8/pfo.h lin_tape-3.0.8-norh/pfo.h -#define BEFORE_RH_67 1 -#define BEFORE_RH_70 1 -#define BEFORE_RH_71 1 +-#define BEFORE_RH_72 1 -#endif -#ifdef KERNELVERSION_2_6_32_358 -#define AFTER_RH_62 1 @@ -49,7 +51,7 @@ diff -ur lin_tape-3.0.8/pfo.h lin_tape-3.0.8-norh/pfo.h -#define BEFORE_RH_66 1 -#define BEFORE_RH_67 1 -#define BEFORE_RH_70 1 --#define BEFORE_RH_71 1 +-#define BEFORE_RH_72 1 -#endif -#ifdef KERNELVERSION_2_6_32_431 -#define AFTER_RH_62 1 @@ -59,6 +61,7 @@ diff -ur lin_tape-3.0.8/pfo.h lin_tape-3.0.8-norh/pfo.h -#define BEFORE_RH_67 1 -#define BEFORE_RH_70 1 -#define BEFORE_RH_71 1 +-#define BEFORE_RH_72 1 -#endif -#ifdef KERNELVERSION_2_6_32_504 -#define AFTER_RH_62 1 @@ -68,6 +71,7 @@ diff -ur lin_tape-3.0.8/pfo.h lin_tape-3.0.8-norh/pfo.h -#define BEFORE_RH_67 1 -#define BEFORE_RH_70 1 -#define BEFORE_RH_71 1 +-#define BEFORE_RH_72 1 -#endif -#ifdef KERNELVERSION_2_6_32_573 -#define AFTER_RH_62 1 @@ -77,6 +81,17 @@ diff -ur lin_tape-3.0.8/pfo.h lin_tape-3.0.8-norh/pfo.h -#define AFTER_RH_66 1 -#define BEFORE_RH_70 1 -#define BEFORE_RH_71 1 +-#define BEFORE_RH_72 1 +-#endif +-#ifdef KERNELVERSION_2_6_32_642 +-#define AFTER_RH_62 1 +-#define AFTER_RH_63 1 +-#define AFTER_RH_64 1 +-#define AFTER_RH_65 1 +-#define AFTER_RH_66 1 +-#define BEFORE_RH_70 1 +-#define BEFORE_RH_71 1 +-#define BEFORE_RH_72 1 -#endif -#ifdef KERNELVERSION_3_10_0_123 -#define AFTER_RH_62 1 @@ -103,18 +118,18 @@ diff -ur lin_tape-3.0.8/pfo.h lin_tape-3.0.8-norh/pfo.h #define AFTER_RH_62 1 #define AFTER_RH_63 1 #define AFTER_RH_64 1 -@@ -111,7 +35,6 @@ +@@ -126,7 +35,6 @@ #define AFTER_RH_6x 1 #define AFTER_RH_70 1 - #define AFTER_RH_72 1 + #define AFTER_RH_71 1 -#endif /* Misc defines needed so source is same for all versions of Linux */ #ifndef SDEV_TRANSPORT_OFFLINE -diff -ur lin_tape-3.0.8/sgmp.c lin_tape-3.0.8-norh/sgmp.c ---- lin_tape-3.0.8/sgmp.c 2016-03-17 04:44:07.000000000 +0100 -+++ lin_tape-3.0.8-norh/sgmp.c 2016-06-19 09:55:40.075920922 +0200 -@@ -262,31 +262,11 @@ +diff -ur lin_tape-3.0.18/sgmp.c lin_tape-3.0.18-ifdefs/sgmp.c +--- lin_tape-3.0.18/sgmp.c 2017-02-23 19:14:41.000000000 +0100 ++++ lin_tape-3.0.18-ifdefs/sgmp.c 2017-05-09 21:10:20.295643954 +0200 +@@ -262,27 +262,12 @@ { struct sg_fd *sfp = (struct sg_fd *)filp->private_data; @@ -127,77 +142,96 @@ diff -ur lin_tape-3.0.8/sgmp.c lin_tape-3.0.8-norh/sgmp.c - struct request_queue *q = sfp->parentdp->device->request_queue; -#endif -#endif -- + if (sfp->parentdp->device->type == TYPE_SCANNER) return 0; --#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) && (!defined(SLESVERSION)) -- /* RHEL 7.0 and beyond */ -- return blk_verify_command(q, cmd, filp->f_mode & FMODE_WRITE); +-#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) || defined(SLESVERSION) + return blk_verify_command(cmd, filp->f_mode & FMODE_WRITE); -#else --#ifdef AFTER_RH_63 -- /* RHEL 6.4+ */ +- /* RHEL 6.4 and beyond */ - return blk_verify_command(q, cmd, filp->f_mode & FMODE_WRITE); --#else -- /* RHEL6.3- or SLES11SP3 */ - return blk_verify_command(cmd, filp->f_mode & FMODE_WRITE); --#endif -#endif +-//6.3 blk_verify_command(cmd, filp->f_mode & FMODE_WRITE); +- } #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32) -diff -ur lin_tape-3.0.8/upper.c lin_tape-3.0.8-norh/upper.c ---- lin_tape-3.0.8/upper.c 2016-02-23 20:19:55.000000000 +0100 -+++ lin_tape-3.0.8-norh/upper.c 2016-06-19 09:56:18.759745753 +0200 -@@ -266,20 +266,7 @@ - { - if (copy_from_user(pfo_cmd->scsi_cmd, hdr->cmdp, hdr->cmd_len)) - return -EFAULT; --#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) && (!defined(SLESVERSION)) -- /* RHEL 7.0 and beyond */ -- if (blk_verify_command(q, pfo_cmd->scsi_cmd, mode & FMODE_WRITE)) --#else --#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) --#ifdef AFTER_RH_63 -- /* RHEL 6.4+ */ -- if (blk_verify_command(q, pfo_cmd->scsi_cmd, mode & FMODE_WRITE)) --#else -- /* RHEL 6.3- or SLES11SP3 */ - if (blk_verify_command(pfo_cmd->scsi_cmd, mode & FMODE_WRITE)) --#endif --#endif --#endif - return -EPERM; - - /* ---- lin_tape-3.0.8/sgmp.c~ 2016-06-19 13:18:16.000000000 +0200 -+++ lin_tape-3.0.8/sgmp.c 2016-06-19 13:21:28.375961483 +0200 -@@ -1544,7 +1544,7 @@ +@@ -419,7 +404,7 @@ + #endif + sdp->sgdebug = 0; + q = sdp->device->request_queue; +-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) && (defined(SLESVERSION)) ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) + sdp->sg_tablesize = min(queue_max_hw_segments(q), + queue_max_phys_segments(q)); + #else +@@ -1546,7 +1531,7 @@ if ((sdp->sgdebug > 0) && ((CHECK_CONDITION == srp->header.masked_status) || (COMMAND_TERMINATED == srp->header.masked_status))) --#ifdef AFTER_RH_72 +-#ifdef AFTER_RH_71 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) __scsi_print_sense(sdp->device, "sg_cmd_done", sense, SCSI_SENSE_BUFFERSIZE); #else ---- lin_tape-3.0.8/stmp.c~ 2016-06-19 13:18:16.000000000 +0200 -+++ lin_tape-3.0.8/stmp.c 2016-06-19 13:21:10.882407139 +0200 -@@ -467,7 +467,7 @@ +@@ -1677,7 +1662,7 @@ + INIT_LIST_HEAD(&sdp->sfds); + init_waitqueue_head(&sdp->o_excl_wait); + +-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) && (defined(SLESVERSION)) ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) + sdp->sg_tablesize = min(queue_max_hw_segments(q), + queue_max_phys_segments(q)); + #else +@@ -3069,7 +3054,7 @@ + scsidp->id, scsidp->lun, (int) scsidp->type, + 1, + (int) scsidp->queue_depth, +-#ifdef AFTER_RH_71 ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) + (int) atomic_read(&scsidp->device_busy), + #else + (int) scsidp->device_busy, +diff -ur lin_tape-3.0.18/stmp.c lin_tape-3.0.18-ifdefs/stmp.c +--- lin_tape-3.0.18/stmp.c 2017-02-23 19:14:41.000000000 +0100 ++++ lin_tape-3.0.18-ifdefs/stmp.c 2017-05-09 21:11:01.113125428 +0200 +@@ -454,7 +454,7 @@ SRpnt->cmd[0], SRpnt->cmd[1], SRpnt->cmd[2], SRpnt->cmd[3], SRpnt->cmd[4], SRpnt->cmd[5]); if (cmdstatp->have_sense) --#ifdef AFTER_RH_72 +-#ifdef AFTER_RH_70 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) __scsi_print_sense(STp->device, name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE); #else -@@ -488,7 +488,7 @@ +@@ -475,7 +475,7 @@ scode != VOLUME_OVERFLOW && SRpnt->cmd[0] != MODE_SENSE && SRpnt->cmd[0] != TEST_UNIT_READY) { --#ifdef AFTER_RH_72 +-#ifdef AFTER_RH_71 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) __scsi_print_sense(STp->device, name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE); #else +diff -ur lin_tape-3.0.18/upper.c lin_tape-3.0.18-ifdefs/upper.c +--- lin_tape-3.0.18/upper.c 2017-02-23 19:14:41.000000000 +0100 ++++ lin_tape-3.0.18-ifdefs/upper.c 2017-05-09 21:09:37.868126006 +0200 +@@ -267,7 +267,7 @@ + if (copy_from_user(pfo_cmd->scsi_cmd, hdr->cmdp, hdr->cmd_len)) + return -EFAULT; + +-#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) || defined(SLESVERSION) ++#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) + if (blk_verify_command(pfo_cmd->scsi_cmd, mode & FMODE_WRITE)) + #else + /* RHEL 6.4 and beyond */ +@@ -608,7 +608,7 @@ + if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len)) + goto error; + +-#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) || defined(SLESVERSION) ++#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) + err = blk_verify_command(scsi_cmd, mode & FMODE_WRITE); + #else + /* RHEL 6.4 and beyond */ diff --git a/insecure-perms.patch b/insecure-perms.patch deleted file mode 100644 index 98e574c..0000000 --- a/insecure-perms.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- lin_tape-2.9.1/lin_tape_scsi_config.c~ 2014-11-09 16:31:44.000000000 +0100 -+++ lin_tape-2.9.1/lin_tape_scsi_config.c 2014-11-09 16:33:25.734671175 +0100 -@@ -111,7 +111,7 @@ - - } /* lin_tape_debug_store() */ - --DRIVER_ATTR(lin_tape_debug, 0666, lin_tape_debug_show, lin_tape_debug_store); -+DRIVER_ATTR(lin_tape_debug, 0664, lin_tape_debug_show, lin_tape_debug_store); - - /******************************************************************************* - * * -@@ -166,7 +166,7 @@ - - } /* auto_logging_store() */ - --DRIVER_ATTR(auto_logging, 0666, auto_logging_show, auto_logging_store); -+DRIVER_ATTR(auto_logging, 0664, auto_logging_show, auto_logging_store); - - /******************************************************************************* - * * -@@ -220,7 +220,7 @@ - - } /* petro_store() */ - --DRIVER_ATTR(petro, 0666, petro_show, petro_store); -+DRIVER_ATTR(petro, 0664, petro_show, petro_store); - - /******************************************************************************* - * * -@@ -275,7 +275,7 @@ - - } /* support_dio_store() */ - --DRIVER_ATTR(support_dio, 0666, support_dio_show, support_dio_store); -+DRIVER_ATTR(support_dio, 0664, support_dio_show, support_dio_store); - - /******************************************************************************* - * * -@@ -356,7 +356,7 @@ - return count; - } /* changer_open_reserve_show() */ - --DRIVER_ATTR(changer_open_reserve, 0666, changer_open_reserve_show, -+DRIVER_ATTR(changer_open_reserve, 0664, changer_open_reserve_show, - changer_open_reserve_store); - - /******************************************************************************* -@@ -527,7 +527,7 @@ - - } /* disable_density_on_open_store() */ - --DRIVER_ATTR(disable_density_on_open, 0666, disable_density_on_open_show, -+DRIVER_ATTR(disable_density_on_open, 0664, disable_density_on_open_show, - disable_density_on_open_store); - - /******************************************************************************* -@@ -583,7 +583,7 @@ - - } /* dynamic_attributes_store() */ - --DRIVER_ATTR(dynamic_attributes, 0666, dynamic_attributes_show, -+DRIVER_ATTR(dynamic_attributes, 0664, dynamic_attributes_show, - dynamic_attributes_store); - - /******************************************************************************* -@@ -639,7 +639,7 @@ - - } /* lin_tape_as_sfmp_store() */ - --DRIVER_ATTR(lin_tape_as_sfmp, 0666, lin_tape_as_sfmp_show, lin_tape_as_sfmp_store); -+DRIVER_ATTR(lin_tape_as_sfmp, 0664, lin_tape_as_sfmp_show, lin_tape_as_sfmp_store); - /******************************************************************************* - * * - * NAME: disable_auto_drive_dump_show * -@@ -693,7 +693,7 @@ - - } /* disable_auto_drive_dump_store() */ - --DRIVER_ATTR(disable_auto_drive_dump, 0666, disable_auto_drive_dump_show, disable_auto_drive_dump_store); -+DRIVER_ATTR(disable_auto_drive_dump, 0664, disable_auto_drive_dump_show, disable_auto_drive_dump_store); - - /******************************************************************************* - * * -@@ -748,7 +748,7 @@ - - } /* busy_retry_store() */ - --DRIVER_ATTR(busy_retry, 0666, busy_retry_show, busy_retry_store); -+DRIVER_ATTR(busy_retry, 0664, busy_retry_show, busy_retry_store); - /******************************************************************************* - * * - * CLASS DEVICE ATTRIBUTES * -@@ -699,7 +699,7 @@ - #else - static DEVICE_ATTR(sys_encryption_proxy, - #endif -- 0666, -+ 0664, - lin_tape_class_device_encryption_proxy_show, - lin_tape_class_device_encryption_proxy_set); - -@@ -813,7 +813,7 @@ - #else - static DEVICE_ATTR(sys_encryption_write, - #endif -- 0666, -+ 0664, - lin_tape_class_device_encryption_write_show, - lin_tape_class_device_encryption_write_set); - diff --git a/lin_tape.spec b/lin_tape.spec index 50289a2..8d63ee7 100644 --- a/lin_tape.spec +++ b/lin_tape.spec @@ -5,27 +5,22 @@ # nothing to be placed to debuginfo package %define _enable_debug_packages 0 -%define rel 3 +%define rel 0.1 %define pname lin_tape Summary: IBM Tape SCSI Device Driver for Linux Name: %{pname}%{_alt_kernel} -Version: 3.0.8 +Version: 3.0.18 Release: %{rel}%{?_pld_builder:@%{_kernel_ver_str}} License: GPL v2/LGPL Group: Base/Kernel Source0: %{pname}-%{version}.tgz -# Source0-md5: 11a219f7b32496d9c334bbcd534da349 +# Source0-md5: c82336b8402f1eeadf440e7173895f17 Source1: %{pname}.fixlist Patch0: use-module-dir.patch Patch1: clean-ifdefs.patch -Patch2: insecure-perms.patch -Patch3: linux-3.13.patch -Patch4: linux-3.19.patch -Patch5: linux-4.0.patch -Patch6: linux-4.6.patch -Patch7: no-uname.patch -Patch8: linux-4.9.patch -Patch9: linux-4.10.patch +Patch2: linux-4.9.patch +Patch3: linux-4.10.patch +Patch4: linux-4.11.patch # System Storage, Tape systems, Tape drivers and software, Tape device drivers (Linux) URL: http://www.ibm.com/support/fixcentral/ BuildRequires: rpmbuild(macros) >= 1.701 @@ -78,11 +73,6 @@ compatible platforms.\ %patch2 -p1 %patch3 -p1 %patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 install -p %{SOURCE1} . diff --git a/linux-3.13.patch b/linux-3.13.patch deleted file mode 100644 index 090c015..0000000 --- a/linux-3.13.patch +++ /dev/null @@ -1,264 +0,0 @@ -diff -ur lin_tape-3.0.8.orig/stmp.c lin_tape-3.0.8/stmp.c ---- lin_tape-3.0.8.orig/stmp.c 2016-03-17 03:52:34.000000000 +0100 -+++ lin_tape-3.0.8/stmp.c 2016-06-19 13:10:40.664509607 +0200 -@@ -121,7 +121,12 @@ - - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32) - static struct class st_sysfs_class; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+static const struct attribute_group *st_dev_groups[]; -+static const struct attribute_group *st_drv_groups[]; -+#else - static struct device_attribute st_dev_attrs[]; -+#endif - /* Paths are protected by st_index_lock */ - static struct device *old_active_path; - static struct device *new_active_path; -@@ -245,8 +250,10 @@ - static int st_probe(struct device *); - static int st_remove(struct device *); - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) - static int do_create_sysfs_files(void); - static void do_remove_sysfs_files(void); -+#endif - #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) - static int do_create_class_files(struct scsi_tape *, int, int); - #endif -@@ -255,6 +262,9 @@ - .owner = THIS_MODULE, - .gendrv = { - .name = "st", -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0) -+ .groups = st_drv_groups, -+#endif - .probe = st_probe, - .remove = st_remove, - }, -@@ -4806,7 +4816,11 @@ - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32) - static struct class st_sysfs_class = { - .name = "scsi_tape", -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+ .dev_groups = st_dev_groups, -+#else - .dev_attrs = st_dev_attrs, -+#endif - }; - #endif - -@@ -4845,9 +4859,11 @@ - if (err) - goto err_chrdev; - -+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,13,0) - err = do_create_sysfs_files(); - if (err) - goto err_scsidrv; -+#endif - - return 0; - -@@ -4867,7 +4883,9 @@ - - static void __exit exit_st(void) - { -+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,13,0) - do_remove_sysfs_files(); -+#endif - pfo_unregister_st(&st_template.gendrv); - unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0), - ST_MAX_TAPE_ENTRIES); -@@ -4884,6 +4902,7 @@ - module_exit(exit_st); - - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) - /* The sysfs driver interface. Read-only at the moment */ - static ssize_t st_try_direct_io_show(struct device_driver *ddp, char *buf) - { -@@ -4947,10 +4966,48 @@ - driver_remove_file(sysfs, &driver_attr_fixed_buffer_size); - driver_remove_file(sysfs, &driver_attr_try_direct_io); - } -+#else -+/* The sysfs driver interface. Read-only at the moment */ -+static ssize_t try_direct_io_show(struct device_driver *ddp, char *buf) -+{ -+ return scnprintf(buf, PAGE_SIZE, "%d\n", try_direct_io); -+} -+static DRIVER_ATTR_RO(try_direct_io); - -+static ssize_t fixed_buffer_size_show(struct device_driver *ddp, char *buf) -+{ -+ return scnprintf(buf, PAGE_SIZE, "%d\n", st_fixed_buffer_size); -+} -+static DRIVER_ATTR_RO(fixed_buffer_size); -+ -+static ssize_t max_sg_segs_show(struct device_driver *ddp, char *buf) -+{ -+ return scnprintf(buf, PAGE_SIZE, "%d\n", st_max_sg_segs); -+} -+static DRIVER_ATTR_RO(max_sg_segs); -+ -+static ssize_t version_show(struct device_driver *ddd, char *buf) -+{ -+ return scnprintf(buf, PAGE_SIZE, "[%s]\n", verstr); -+} -+static DRIVER_ATTR_RO(version); -+ -+static struct attribute *st_drv_attrs[] = { -+ &driver_attr_try_direct_io.attr, -+ &driver_attr_fixed_buffer_size.attr, -+ &driver_attr_max_sg_segs.attr, -+ &driver_attr_version.attr, -+ NULL, -+}; -+ATTRIBUTE_GROUPS(st_drv); -+#endif - - /* The sysfs simple class interface */ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+static ssize_t lasterror_show(struct device *dev, -+#else - static ssize_t st_lasterror_show(struct device *dev, -+#endif - struct device_attribute *attr, char *buf) - { - struct st_modedef *STm = dev_get_drvdata(dev); -@@ -4981,12 +5038,19 @@ - STp->last_checkcondition[2]); - return l; - } -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+static DEVICE_ATTR_RO(lasterror); -+#endif - #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) - DEVICE_ATTR(lasterror, S_IRUGO, st_lasterror_show, NULL); - #endif - - static ssize_t -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+defined_show(struct device *dev, struct device_attribute *attr, char *buf) -+#else - st_defined_show(struct device *dev, struct device_attribute *attr, char *buf) -+#endif - { - struct st_modedef *STm = dev_get_drvdata(dev); - ssize_t l = 0; -@@ -4994,13 +5058,20 @@ - l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined); - return l; - } -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+static DEVICE_ATTR_RO(defined); -+#endif - - #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) - DEVICE_ATTR(defined, S_IRUGO, st_defined_show, NULL); - #endif - - static ssize_t -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+default_blksize_show(struct device *dev, struct device_attribute *attr, char *buf) -+#else - st_defblk_show(struct device *dev, struct device_attribute *attr, char *buf) -+#endif - { - struct st_modedef *STm = dev_get_drvdata(dev); - ssize_t l = 0; -@@ -5008,13 +5079,20 @@ - l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize); - return l; - } -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+static DEVICE_ATTR_RO(default_blksize); -+#endif - - #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) - DEVICE_ATTR(default_blksize, S_IRUGO, st_defblk_show, NULL); - #endif - - static ssize_t -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+default_density_show(struct device *dev, struct device_attribute *attr, char *buf) -+#else - st_defdensity_show(struct device *dev, struct device_attribute *attr, char *buf) -+#endif - { - struct st_modedef *STm = dev_get_drvdata(dev); - ssize_t l = 0; -@@ -5024,13 +5102,20 @@ - l = snprintf(buf, PAGE_SIZE, fmt, STm->default_density); - return l; - } -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+static DEVICE_ATTR_RO(default_density); -+#endif - - #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) - DEVICE_ATTR(default_density, S_IRUGO, st_defdensity_show, NULL); - #endif - - static ssize_t -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+default_compression_show(struct device *dev, struct device_attribute *attr, -+#else - st_defcompression_show(struct device *dev, struct device_attribute *attr, -+#endif - char *buf) - { - struct st_modedef *STm = dev_get_drvdata(dev); -@@ -5039,13 +5124,20 @@ - l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1); - return l; - } -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+static DEVICE_ATTR_RO(default_compression); -+#endif - - #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) - DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL); - #endif - - static ssize_t -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+options_show(struct device *dev, struct device_attribute *attr, char *buf) -+#else - st_options_show(struct device *dev, struct device_attribute *attr, char *buf) -+#endif - { - struct st_modedef *STm = dev_get_drvdata(dev); - int options; -@@ -5090,7 +5182,30 @@ - l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options); - return l; - } --#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32) -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+static DEVICE_ATTR_RO(options); -+#endif -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0) -+static struct attribute *st_dev_attrs[] = { -+ &dev_attr_defined.attr, -+ &dev_attr_default_blksize.attr, -+ &dev_attr_default_density.attr, -+ &dev_attr_default_compression.attr, -+ &dev_attr_options.attr, -+ &dev_attr_lasterror.attr, -+ NULL, -+}; -+ -+static struct attribute_group st_group = { -+ .attrs = st_dev_attrs, -+}; -+ -+static const struct attribute_group *st_dev_groups[] = { -+ &st_group, -+ NULL, -+}; -+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32) - static struct device_attribute st_dev_attrs[] = { - __ATTR_RO(st_defined), - __ATTR_RO(st_defblk), diff --git a/linux-3.19.patch b/linux-3.19.patch deleted file mode 100644 index a983356..0000000 --- a/linux-3.19.patch +++ /dev/null @@ -1,154 +0,0 @@ -diff -ur lin_tape-3.0.8.orig/lin_tape_scsi_config.c lin_tape-3.0.8/lin_tape_scsi_config.c ---- lin_tape-3.0.8.orig/lin_tape_scsi_config.c 2016-06-19 13:11:34.000000000 +0200 -+++ lin_tape-3.0.8/lin_tape_scsi_config.c 2016-06-19 13:12:01.245509373 +0200 -@@ -7191,9 +7191,13 @@ - { - int rc = -EIO; - int minor = -1; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) -+ struct inode* inode = filp->f_path.dentry->d_inode; -+#else - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) - struct inode* inode = filp->f_dentry->d_inode; - #endif -+#endif - - minor = iminor(inode); - -@@ -7459,7 +7463,11 @@ - int dev_index = 0; - boolean des_locked = False, drv_locked = False; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) -+ minor = iminor(file->f_path.dentry->d_inode); -+#else - minor = iminor(file->f_dentry->d_inode); -+#endif - DbgPrint(("lin_tape_read entry: minor %d\n", minor)); - - if(minor >= LinTapeChangerOffset) { -@@ -7566,7 +7574,11 @@ - int dev_index = 0; - boolean des_locked = False, drv_locked = False; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) -+ minor = iminor(file->f_path.dentry->d_inode); -+#else - minor = iminor(file->f_dentry->d_inode); -+#endif - DbgPrint(("lin_tape_write entry: minor %d\n", minor)); - - if(minor >= LinTapeChangerOffset) { -diff -ur lin_tape-3.0.8.orig/lin_tape_scsi_config.h lin_tape-3.0.8/lin_tape_scsi_config.h ---- lin_tape-3.0.8.orig/lin_tape_scsi_config.h 2016-03-07 20:19:02.000000000 +0100 -+++ lin_tape-3.0.8/lin_tape_scsi_config.h 2016-06-19 13:13:48.613514050 +0200 -@@ -315,9 +315,14 @@ - static int lin_tape_probe(struct device *dev); - static int lin_tape_remove(struct device *dev); - static struct scsi_driver lin_tape_driver = { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) - .owner = THIS_MODULE, -+#endif - .gendrv = { - .name = "lin_tape", -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) -+ .owner = THIS_MODULE, -+#endif - .probe = lin_tape_probe, - .remove = lin_tape_remove, - }, -diff -ur lin_tape-3.0.8.orig/sgmp.c lin_tape-3.0.8/sgmp.c ---- lin_tape-3.0.8.orig/sgmp.c 2016-06-19 13:11:34.000000000 +0200 -+++ lin_tape-3.0.8/sgmp.c 2016-06-19 13:12:08.182262293 +0200 -@@ -1223,6 +1223,7 @@ - if (sdp->detached) - return -ENODEV; - return put_user(sdp->device->host->hostt->emulated, ip); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) - case SG_SCSI_RESET: - if (sdp->detached) - return -ENODEV; -@@ -1256,6 +1257,7 @@ - return -EACCES; - return (scsi_reset_provider(sdp->device, val) == - SUCCESS) ? 0 : -EIO; -+#endif - case SCSI_IOCTL_SEND_COMMAND: - if (sdp->detached) - return -ENODEV; -@@ -1281,9 +1283,16 @@ - case SCSI_IOCTL_GET_BUS_NUMBER: - case SCSI_IOCTL_PROBE_HOST: - case SG_GET_TRANSFORM: -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) -+ case SG_SCSI_RESET: -+#endif - if (sdp->detached) - return -ENODEV; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) - return pfo_scsi_ioctl(sdp->device, cmd_in, p); -+#else -+ break; -+#endif - case BLKSECTGET: - return put_user(queue_max_sectors(sdp->device->request_queue) * 512, - ip); -@@ -1302,8 +1311,19 @@ - default: - if (read_only) - return -EPERM; /* don't know so take safe approach */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) - return pfo_scsi_ioctl(sdp->device, cmd_in, p); -+#else -+ break; -+#endif - } -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) -+ result = scsi_ioctl_block_when_processing_errors(sdp->device, -+ cmd_in, filp->f_flags & O_NDELAY); -+ if (result) -+ return result; -+ return pfo_scsi_ioctl(sdp->device, cmd_in, p); -+#endif - } - - #ifdef CONFIG_COMPAT -diff -ur lin_tape-3.0.8.orig/stmp.c lin_tape-3.0.8/stmp.c ---- lin_tape-3.0.8.orig/stmp.c 2016-06-19 13:11:34.000000000 +0200 -+++ lin_tape-3.0.8/stmp.c 2016-06-19 13:12:36.339279356 +0200 -@@ -259,9 +259,14 @@ - #endif - - static struct scsi_driver st_template = { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) - .owner = THIS_MODULE, -+#endif - .gendrv = { - .name = "st", -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) -+ .owner = THIS_MODULE, -+#endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0) - .groups = st_drv_groups, - #endif -@@ -3514,6 +3519,7 @@ - STm = &(STp->modes[STp->current_mode]); - STps = &(STp->ps[STp->partition]); - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) - /* - * If we are in the middle of error recovery, don't let anyone - * else try and use this device. Also, if error recovery fails, it -@@ -3525,6 +3531,12 @@ - if (!scsi_block_when_processing_errors(STp->device) || retval != -ENODEV) - goto out; - retval = 0; -+#else -+ retval = scsi_ioctl_block_when_processing_errors(STp->device, cmd_in, -+ file->f_flags & O_NDELAY); -+ if (retval) -+ goto out; -+#endif - - cmd_type = _IOC_TYPE(cmd_in); - cmd_nr = _IOC_NR(cmd_in); diff --git a/linux-4.0.patch b/linux-4.0.patch deleted file mode 100644 index 6ea101d..0000000 --- a/linux-4.0.patch +++ /dev/null @@ -1,79 +0,0 @@ -diff -ur lin_tape-3.0.8.orig/lower.c lin_tape-3.0.8/lower.c ---- lin_tape-3.0.8.orig/lower.c 2016-03-15 23:39:12.000000000 +0100 -+++ lin_tape-3.0.8/lower.c 2016-06-19 13:16:12.828653141 +0200 -@@ -471,6 +471,21 @@ - } else if (pfo_cmd->source == PFO_SOURCE_SG || - pfo_cmd->source == PFO_SOURCE_IOCTL) { - if (pfo_cmd->iov_count) { -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,19,0) -+ struct iovec *iov = NULL; -+ struct iov_iter i; -+ err = import_iovec(write, pfo_cmd->buffer, pfo_cmd->iov_count, 0, &iov, &i); -+ if (err < 0) -+ return err; -+ iov_iter_truncate(&i, pfo_cmd->bufflen); -+ -+ err = blk_rq_map_user_iov(sdev->request_queue, -+ rq, -+ pfo_cmd->mdata, -+ &i, -+ GFP_ATOMIC); -+ kfree(iov); -+#else - err = blk_rq_map_user_iov(sdev->request_queue, - rq, - pfo_cmd->mdata, -@@ -478,6 +493,7 @@ - pfo_cmd->iov_count, - pfo_cmd->bufflen, - GFP_KERNEL); -+#endif - } else { - err = blk_rq_map_user(sdev->request_queue, - rq, -diff -ur lin_tape-3.0.8.orig/sgmp.c lin_tape-3.0.8/sgmp.c ---- lin_tape-3.0.8.orig/sgmp.c 2016-06-19 13:15:52.000000000 +0200 -+++ lin_tape-3.0.8/sgmp.c 2016-06-19 13:16:12.828653141 +0200 -@@ -77,6 +77,7 @@ - #else - #include - #endif -+#include - - #include "scsi.h" - #include -@@ -2029,7 +2029,12 @@ - } - - if (iov_count) { -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,19,0) -+ int size = sizeof(struct iovec) * iov_count; -+ struct iov_iter i; -+#else - int len, size = sizeof(struct sg_iovec) * iov_count; -+#endif - struct iovec *iov; - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32) - iov = memdup_user(hp->dxferp, size); -@@ -2046,6 +2051,13 @@ - } - #endif - -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,19,0) -+ iov_iter_init(&i, rw, iov, iov_count, -+ min_t(size_t, hp->dxfer_len, -+ iov_length(iov, iov_count))); -+ -+ res = blk_rq_map_user_iov(q, rq, md, &i, GFP_ATOMIC); -+#else - len = iov_length(iov, iov_count); - if (hp->dxfer_len < len) { - iov_count = iov_shorten(iov, iov_count, hp->dxfer_len); -@@ -2055,6 +2067,7 @@ - res = blk_rq_map_user_iov(q, rq, md, (struct sg_iovec *)iov, - iov_count, - len, GFP_ATOMIC); -+#endif - kfree(iov); - } else - res = blk_rq_map_user(q, rq, md, hp->dxferp, diff --git a/linux-4.11.patch b/linux-4.11.patch new file mode 100644 index 0000000..16119fb --- /dev/null +++ b/linux-4.11.patch @@ -0,0 +1,72 @@ +--- lin_tape-3.0.18/lin_tape_tape.h~ 2017-05-09 21:24:21.100249196 +0200 ++++ lin_tape-3.0.18/lin_tape_tape.h 2017-05-09 21:22:43.130950272 +0200 +@@ -85,7 +85,11 @@ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) + #define KOBJ_CT(kobj) ((kobj) ? atomic_read(&(kobj)->refcount) : 0) + #else ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) + #define KOBJ_CT(kobj) ((kobj) ? atomic_read(&(kobj)->kref.refcount) : 0) ++#else ++#define KOBJ_CT(kobj) ((kobj) ? kref_read(&(kobj)->kref) : 0) ++#endif + #endif + + /* global definitions */ +--- lin_tape-3.0.18/lin_tape_ioctl_tape.c~ 2017-05-09 21:30:01.000000000 +0200 ++++ lin_tape-3.0.18/lin_tape_ioctl_tape.c 2017-05-09 21:36:05.393963455 +0200 +@@ -6464,7 +6464,11 @@ + } /* if */ + + tmp_rq = (void*)sdev->request_queue; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) ++ scsi_req_init(req); ++#else + req->cmd_type = REQ_TYPE_BLOCK_PC; ++#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) + req->cmd_flags |= REQ_QUIET; + #else +@@ -6540,17 +6540,29 @@ + bio = req->bio; + } /* if */ + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) ++ scsi_req(req)->cmd_len = COMMAND_SIZE(cdb[0]); ++ memset(scsi_req(req)->cmd, '\0', MAX_CDB_SIZE); ++ memcpy(scsi_req(req)->cmd, cdb, scsi_req(req)->cmd_len); ++ scsi_req(req)->sense = sense_data; ++ scsi_req(req)->sense_len = 0; ++#else + req->cmd_len = COMMAND_SIZE(cdb[0]); + memset(req->cmd, '\0', MAX_CDB_SIZE); + memcpy(req->cmd, cdb, req->cmd_len); + req->sense = sense_data; + req->sense_len = 0; ++#endif + req->timeout = timeout; + req->retries = 0; + + blk_execute_rq(req->q, NULL, req, 1); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) ++ *resid = scsi_req(req)->resid_len; ++#else + *resid = req->resid_len; ++#endif + status_code = req->errors; + + if(buf_len && !use_sg) { +--- lin_tape-3.0.18/stmp.c~ 2017-05-09 21:30:01.000000000 +0200 ++++ lin_tape-3.0.18/stmp.c 2017-05-09 21:35:48.826918381 +0200 +@@ -611,7 +611,11 @@ + if (!req) + return DRIVER_ERROR << 24; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) ++ scsi_req_init(req); ++#else + req->cmd_type = REQ_TYPE_BLOCK_PC; ++#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) + req->cmd_flags |= REQ_QUIET; + #else diff --git a/linux-4.6.patch b/linux-4.6.patch deleted file mode 100644 index 9716831..0000000 --- a/linux-4.6.patch +++ /dev/null @@ -1,94 +0,0 @@ -diff -ur lin_tape-3.0.8.orig/lin_tape_scsi_tape.c lin_tape-3.0.8/lin_tape_scsi_tape.c ---- lin_tape-3.0.8.orig/lin_tape_scsi_tape.c 2016-02-23 22:16:42.000000000 +0100 -+++ lin_tape-3.0.8/lin_tape_scsi_tape.c 2016-06-19 13:17:29.632951394 +0200 -@@ -11480,10 +11480,14 @@ - - memset(pages, '\0', drv->supported_sg_tablesize * sizeof(struct page*)); - -+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) -+ mapped_pages = get_user_pages_unlocked((ulong)user_location, number_pages, rw, 0, pages); -+#else - down_read(¤t->mm->mmap_sem); - mapped_pages = get_user_pages(current, current->mm, - (ulong)user_location, number_pages, rw, 0, pages, NULL); - up_read(¤t->mm->mmap_sem); -+#endif - - if(mapped_pages < number_pages) { - rc = -EFAULT; -@@ -11532,7 +11536,11 @@ - EXIT_LABEL: - - if(rc < STATUS_SUCCESS) -+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) -+ for(i = 0; i < mapped_pages; i++) put_page(pages[i]); -+#else - for(i = 0; i < mapped_pages; i++) page_cache_release(pages[i]); -+#endif - if(pages_allocd) kfree(pages); - return rc; - } /* lin_tape_get_user_pages() */ -@@ -11567,7 +11575,11 @@ - &drv->sg_list->gather[i]))) { - SetPageDirty(sg_page(&drv->sg_list->gather[i])); - } /* if */ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) -+ put_page(sg_page(&drv->sg_list->gather[i])); -+#else - page_cache_release(sg_page(&drv->sg_list->gather[i])); -+#endif - } /* if */ - } /* for */ - -diff -ur lin_tape-3.0.8.orig/stmp.c lin_tape-3.0.8/stmp.c ---- lin_tape-3.0.8.orig/stmp.c 2016-06-19 13:17:14.000000000 +0200 -+++ lin_tape-3.0.8/stmp.c 2016-06-19 13:17:29.632951394 +0200 -@@ -5329,7 +5329,14 @@ - - if ((pages = kmalloc(max_pages * sizeof(*pages), GFP_KERNEL)) == NULL) - return -ENOMEM; -- -+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) -+ res = get_user_pages_unlocked( -+ uaddr, -+ nr_pages, -+ rw == READ, -+ 0, /* don't force */ -+ pages); -+#else - /* Try to fault in all of the necessary pages */ - down_read(¤t->mm->mmap_sem); - /* rw==READ means read from drive, write into memory area */ -@@ -5343,6 +5350,7 @@ - pages, - NULL); - up_read(¤t->mm->mmap_sem); -+#endif - - /* Errors and no page mapped should return here */ - if (res < nr_pages) -@@ -5362,7 +5370,11 @@ - out_unmap: - if (res > 0) { - for (j=0; j < res; j++) -+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) -+ put_page(pages[j]); -+#else - page_cache_release(pages[j]); -+#endif - res = 0; - } - kfree(pages); -@@ -5384,7 +5396,11 @@ - /* FIXME: cache flush missing for rw==READ - * FIXME: call the correct reference counting function - */ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) -+ put_page(page); -+#else - page_cache_release(page); -+#endif - } - kfree(STbp->mapped_pages); - STbp->mapped_pages = NULL; -Only in lin_tape-3.0.8: stmp.c.orig diff --git a/linux-4.9.patch b/linux-4.9.patch index 22da2ce..4fb0e43 100644 --- a/linux-4.9.patch +++ b/linux-4.9.patch @@ -1,30 +1,32 @@ ---- lin_tape-3.0.8/lin_tape_scsi_tape.c~ 2017-01-21 20:53:26.000000000 +0100 -+++ lin_tape-3.0.8/lin_tape_scsi_tape.c 2017-01-21 20:58:23.919843647 +0100 -@@ -11480,7 +11480,9 @@ +--- lin_tape-3.0.18/lin_tape_scsi_tape.c~ 2017-02-23 19:14:41.000000000 +0100 ++++ lin_tape-3.0.18/lin_tape_scsi_tape.c 2017-05-09 21:28:19.916320963 +0200 +@@ -11838,7 +11838,10 @@ - memset(pages, '\0', drv->supported_sg_tablesize * sizeof(struct page*)); + down_read(¤t->mm->mmap_sem); --#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0) -+ mapped_pages = get_user_pages_unlocked((ulong)user_location, number_pages, pages, rw ? FOLL_WRITE : 0); -+#elif LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) - mapped_pages = get_user_pages_unlocked((ulong)user_location, number_pages, rw, 0, pages); ++ mapped_pages = get_user_pages((ulong)user_location, number_pages, ++ rw ? FOLL_WRITE : 0, pages, NULL); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) + mapped_pages = get_user_pages((ulong)user_location, number_pages, + rw, 0, pages, NULL); #else +--- lin_tape-3.0.18/stmp.c~ 2017-05-09 21:25:12.000000000 +0200 ++++ lin_tape-3.0.18/stmp.c 2017-05-09 21:29:19.121101188 +0200 +@@ -5205,7 +5205,14 @@ + /* Try to fault in all of the necessary pages */ down_read(¤t->mm->mmap_sem); ---- lin_tape-3.0.8/stmp.c~ 2017-01-21 20:59:35.000000000 +0100 -+++ lin_tape-3.0.8/stmp.c 2017-01-21 21:01:53.144286074 +0100 -@@ -5329,7 +5329,13 @@ - - if ((pages = kmalloc(max_pages * sizeof(*pages), GFP_KERNEL)) == NULL) - return -ENOMEM; --#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) + /* rw==READ means read from drive, write into memory area */ +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0) -+ res = get_user_pages_unlocked( ++ res = get_user_pages( + uaddr, + nr_pages, ++ rw == READ ? FOLL_WRITE : 0, + pages, -+ rw == READ ? FOLL_WRITE : 0); -+#elif LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) - res = get_user_pages_unlocked( ++ NULL); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) + res = get_user_pages( uaddr, nr_pages, diff --git a/no-uname.patch b/no-uname.patch deleted file mode 100644 index c3d28b6..0000000 --- a/no-uname.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- lin_tape-3.0.8/Makefile.orig 2016-06-19 15:38:24.000000000 +0000 -+++ lin_tape-3.0.8/Makefile 2016-06-19 15:39:28.228067758 +0000 -@@ -18,25 +18,6 @@ - lin_tape-objs := join.o lin_tape_scsi_config.o lin_tape_scsi_tape.o lin_tape_scsi_trace.o \ - lin_tape_ioctl_tape.o lin_tape_ioctl_changer.o lin_tape_extra_ioctl.o - --PROC := $(shell uname -m) -- --ifeq ($(PROC), ppc64) --EXTRA_CFLAGS += -m64 --endif -- --ifeq ($(PROC), powerpc64) --EXTRA_CFLAGS += -m64 --endif -- --ifeq ($(PROC), powerpc) --EXTRA_CFLAGS += -m64 -msoft-float --LDFLAGS += -melf64ppc --endif -- --ifeq ($(PROC), x86_64) --EXTRA_CFLAGS += -mcmodel=kernel --endif -- - VERSION := $(word 1,$(VERSIONRELEASE)) - RELEASE := $(word 2,$(VERSIONRELEASE)) - ifeq ($(RELEASE),)