]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging:lustre: call libcfs_ioctl directly
authorParinay Kondekar <parinay.kondekar@seagate.com>
Tue, 22 Mar 2016 23:04:07 +0000 (19:04 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
No reason to go through the cfs_psdev_ops abstract
to call libcfs_ioctl. Just call libcfs_ioctl directly.

Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/include/linux/libcfs/libcfs.h
drivers/staging/lustre/lnet/libcfs/linux/linux-module.c
drivers/staging/lustre/lnet/libcfs/module.c

index 5d228e5b438ecaceb6565b2db28443bdfc7deefc..592ad31fbfac1c98ac0ff310ee8c05da5eab68ae 100644 (file)
@@ -75,7 +75,6 @@ struct cfs_psdev_file {
 struct cfs_psdev_ops {
        int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
        int (*p_write)(struct cfs_psdev_file *, char *, unsigned long);
-       int (*p_ioctl)(struct cfs_psdev_file *, unsigned long, void __user *);
 };
 
 /*
@@ -131,6 +130,8 @@ struct libcfs_ioctl_handler {
 int libcfs_register_ioctl(struct libcfs_ioctl_handler *hand);
 int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand);
 
+int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg);
+
 /* container_of depends on "likely" which is defined in libcfs_private.h */
 static inline void *__container_of(void *ptr, unsigned long shift)
 {
index 633d76bec63c15a7b22afe2f5e6bcd0c1dd4b1ad..6f35a80e20a144e20650118a01fb8c2a103b87fd 100644 (file)
@@ -95,11 +95,10 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp,
        return err;
 }
 
-static long libcfs_ioctl(struct file *file,
-                        unsigned int cmd, unsigned long arg)
+static long
+libcfs_psdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        struct cfs_psdev_file    pfile;
-       int    rc = 0;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EACCES;
@@ -112,16 +111,12 @@ static long libcfs_ioctl(struct file *file,
                return -EINVAL;
        }
 
-       if (libcfs_psdev_ops.p_ioctl)
-               rc = libcfs_psdev_ops.p_ioctl(&pfile, cmd, (void __user *)arg);
-       else
-               rc = -EPERM;
-       return rc;
+       return libcfs_ioctl(&pfile, cmd, (void __user *)arg);
 }
 
 static const struct file_operations libcfs_fops = {
        .owner          = THIS_MODULE,
-       .unlocked_ioctl = libcfs_ioctl,
+       .unlocked_ioctl = libcfs_psdev_ioctl,
 };
 
 struct miscdevice libcfs_dev = {
index 4d38aafb0b18fcc98e095876d384cc7cd4808050..4af455733a3bf5b54010c35f98257fac0d2c5211 100644 (file)
@@ -98,8 +98,8 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand)
 }
 EXPORT_SYMBOL(libcfs_deregister_ioctl);
 
-static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd,
-                       void __user *uparam)
+int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd,
+                void __user *uparam)
 {
        struct libcfs_ioctl_data *data = NULL;
        struct libcfs_ioctl_hdr *hdr;
@@ -168,7 +168,6 @@ out:
 struct cfs_psdev_ops libcfs_psdev_ops = {
        NULL,
        NULL,
-       libcfs_ioctl
 };
 
 int lprocfs_call_handler(void *data, int write, loff_t *ppos,