Commit ae272a48 authored by Parinay Kondekar's avatar Parinay Kondekar Committed by Greg Kroah-Hartman

staging:lustre: call libcfs_ioctl directly

No reason to go through the cfs_psdev_ops abstract
to call libcfs_ioctl. Just call libcfs_ioctl directly.
Signed-off-by: default avatarParinay Kondekar <parinay.kondekar@seagate.com>
Signed-off-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4678d183
...@@ -75,7 +75,6 @@ struct cfs_psdev_file { ...@@ -75,7 +75,6 @@ struct cfs_psdev_file {
struct cfs_psdev_ops { struct cfs_psdev_ops {
int (*p_read)(struct cfs_psdev_file *, char *, unsigned long); int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
int (*p_write)(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 { ...@@ -131,6 +130,8 @@ struct libcfs_ioctl_handler {
int libcfs_register_ioctl(struct libcfs_ioctl_handler *hand); int libcfs_register_ioctl(struct libcfs_ioctl_handler *hand);
int libcfs_deregister_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 */ /* container_of depends on "likely" which is defined in libcfs_private.h */
static inline void *__container_of(void *ptr, unsigned long shift) static inline void *__container_of(void *ptr, unsigned long shift)
{ {
......
...@@ -95,11 +95,10 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, ...@@ -95,11 +95,10 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp,
return err; return err;
} }
static long libcfs_ioctl(struct file *file, static long
unsigned int cmd, unsigned long arg) libcfs_psdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
struct cfs_psdev_file pfile; struct cfs_psdev_file pfile;
int rc = 0;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
...@@ -112,16 +111,12 @@ static long libcfs_ioctl(struct file *file, ...@@ -112,16 +111,12 @@ static long libcfs_ioctl(struct file *file,
return -EINVAL; return -EINVAL;
} }
if (libcfs_psdev_ops.p_ioctl) return libcfs_ioctl(&pfile, cmd, (void __user *)arg);
rc = libcfs_psdev_ops.p_ioctl(&pfile, cmd, (void __user *)arg);
else
rc = -EPERM;
return rc;
} }
static const struct file_operations libcfs_fops = { static const struct file_operations libcfs_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.unlocked_ioctl = libcfs_ioctl, .unlocked_ioctl = libcfs_psdev_ioctl,
}; };
struct miscdevice libcfs_dev = { struct miscdevice libcfs_dev = {
......
...@@ -98,7 +98,7 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand) ...@@ -98,7 +98,7 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand)
} }
EXPORT_SYMBOL(libcfs_deregister_ioctl); EXPORT_SYMBOL(libcfs_deregister_ioctl);
static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd,
void __user *uparam) void __user *uparam)
{ {
struct libcfs_ioctl_data *data = NULL; struct libcfs_ioctl_data *data = NULL;
...@@ -168,7 +168,6 @@ static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, ...@@ -168,7 +168,6 @@ static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd,
struct cfs_psdev_ops libcfs_psdev_ops = { struct cfs_psdev_ops libcfs_psdev_ops = {
NULL, NULL,
NULL, NULL,
libcfs_ioctl
}; };
int lprocfs_call_handler(void *data, int write, loff_t *ppos, int lprocfs_call_handler(void *data, int write, loff_t *ppos,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment