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 *);
};
/*
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)
{
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;
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 = {
}
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;
struct cfs_psdev_ops libcfs_psdev_ops = {
NULL,
NULL,
- libcfs_ioctl
};
int lprocfs_call_handler(void *data, int write, loff_t *ppos,