From 22482a34969ead83c1ead01cff483998ef5960d4 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Tue, 17 Aug 2010 20:37:06 +0200 Subject: Add compat_ioctl infrastructure --- cryptodev_main.c | 5 +---- ncr-int.h | 2 ++ ncr.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cryptodev_main.c b/cryptodev_main.c index 0a20888..9c484f5 100644 --- a/cryptodev_main.c +++ b/cryptodev_main.c @@ -150,10 +150,7 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (unlikely(!ncr)) BUG(); - switch (cmd) { - default: - return -EINVAL; - } + return ncr_compat_ioctl(ncr, cmd, arg); } #endif /* CONFIG_COMPAT */ diff --git a/ncr-int.h b/ncr-int.h index 53df9df..b7c6ed4 100644 --- a/ncr-int.h +++ b/ncr-int.h @@ -105,6 +105,8 @@ void* ncr_init_lists(void); void ncr_deinit_lists(struct ncr_lists *lst); int ncr_ioctl(struct ncr_lists *lst, unsigned int cmd, unsigned long arg); +long ncr_compat_ioctl(struct ncr_lists *lst, unsigned int cmd, + unsigned long arg); /* key derivation */ int ncr_key_derive(struct ncr_lists *lst, void __user* arg); diff --git a/ncr.c b/ncr.c index 99d2786..9549b93 100644 --- a/ncr.c +++ b/ncr.c @@ -22,6 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include #include #include @@ -163,3 +164,17 @@ ncr_ioctl(struct ncr_lists *lst, unsigned int cmd, unsigned long arg_) return -EINVAL; } } + +#ifdef CONFIG_COMPAT +long +ncr_compat_ioctl(struct ncr_lists *lst, unsigned int cmd, unsigned long arg_) +{ + if (unlikely(!lst)) + BUG(); + + switch (cmd) { + default: + return -EINVAL; + } +} +#endif -- cgit