Patch for kernel 4.14

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Patch for kernel 4.14

tsightler
Had a need to use MHVTL on a system with a 4.14 kernel and found that the module wouldn't compile due to the removal of the generic DRIVER_ATTR macro from this kernel version in favor of permission specific macros (DRIVER_ATTR_RO/RW/WO).  Below is my patch to make the module compile against 4.14 kernel.  I ran my normal load test after this and everything seemed to work as expected.

--- mhvtl.c.orig        2016-02-16 04:17:32.000000000 -0500
+++ mhvtl.c     2017-11-26 11:43:11.688314821 -0500
@@ -1077,12 +1077,12 @@
        return vtl_parm_info;
 }

-static ssize_t vtl_opts_show(struct device_driver *ddp, char *buf)
+static ssize_t opts_show(struct device_driver *ddp, char *buf)
 {
        return scnprintf(buf, PAGE_SIZE, "0x%x\n", vtl_opts);
 }

-static ssize_t vtl_opts_store(struct device_driver *ddp,
+static ssize_t opts_store(struct device_driver *ddp,
                                 const char *buf, size_t count)
 {
        int opts;
@@ -1107,15 +1107,15 @@
        vtl_cmnd_count = 0;
        return count;
 }
-static DRIVER_ATTR(opts, S_IRUGO|S_IWUSR, vtl_opts_show, vtl_opts_store);
+static DRIVER_ATTR_RW(opts);

-static ssize_t vtl_major_show(struct device_driver *ddp, char *buf)
+static ssize_t major_show(struct device_driver *ddp, char *buf)
 {
        return scnprintf(buf, PAGE_SIZE, "%d\n", vtl_major);
 }
-static DRIVER_ATTR(major, S_IRUGO, vtl_major_show, NULL);
+static DRIVER_ATTR_RO(major);

-static ssize_t vtl_add_lu_action(struct device_driver *ddp,
+static ssize_t add_lu_store(struct device_driver *ddp,
                                        const char *buf, size_t count)
 {
        int retval;
@@ -1140,7 +1140,7 @@

        return count;
 }
-static DRIVER_ATTR(add_lu, S_IWUSR|S_IWGRP, NULL, vtl_add_lu_action);
+static DRIVER_ATTR_WO(add_lu);

 static int do_create_driverfs_files(void)
 {
Reply | Threaded
Open this post in threaded view
|

Re: Patch for kernel 4.14

Mark Harvey
Administrator
Many thanks for the information.

Even more thanks for a patch :)

I'll get it rolled in ASAP.
Regards from Australia
Mark Harvey