diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-02-03 07:26:17 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-03-08 00:58:30 -0500 |
commit | 828b1c50ae11e6dda68f8dfefe43b74c7182b157 (patch) | |
tree | 9c258f65382865edb71e06bf11007071fb058806 /fs/nilfs2/ioctl.c | |
parent | cde98f0f84ccff78e87235cb7b551747d6ad00de (diff) |
nilfs2: add compat ioctl
The current FS_IOC_GETFLAGS/SETFLAGS/GETVERSION will fail if
application is 32 bit and kernel is 64 bit.
This issue is avoidable by adding compat_ioctl method.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/ioctl.c')
-rw-r--r-- | fs/nilfs2/ioctl.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 3aad6413aba4..d89173edd7fe 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/capability.h> /* capable() */ | 26 | #include <linux/capability.h> /* capable() */ |
27 | #include <linux/uaccess.h> /* copy_from_user(), copy_to_user() */ | 27 | #include <linux/uaccess.h> /* copy_from_user(), copy_to_user() */ |
28 | #include <linux/vmalloc.h> | 28 | #include <linux/vmalloc.h> |
29 | #include <linux/compat.h> /* compat_ptr() */ | ||
29 | #include <linux/mount.h> /* mnt_want_write(), mnt_drop_write() */ | 30 | #include <linux/mount.h> /* mnt_want_write(), mnt_drop_write() */ |
30 | #include <linux/nilfs2_fs.h> | 31 | #include <linux/nilfs2_fs.h> |
31 | #include "nilfs.h" | 32 | #include "nilfs.h" |
@@ -766,3 +767,23 @@ long nilfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
766 | return -ENOTTY; | 767 | return -ENOTTY; |
767 | } | 768 | } |
768 | } | 769 | } |
770 | |||
771 | #ifdef CONFIG_COMPAT | ||
772 | long nilfs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | ||
773 | { | ||
774 | switch (cmd) { | ||
775 | case FS_IOC32_GETFLAGS: | ||
776 | cmd = FS_IOC_GETFLAGS; | ||
777 | break; | ||
778 | case FS_IOC32_SETFLAGS: | ||
779 | cmd = FS_IOC_SETFLAGS; | ||
780 | break; | ||
781 | case FS_IOC32_GETVERSION: | ||
782 | cmd = FS_IOC_GETVERSION; | ||
783 | break; | ||
784 | default: | ||
785 | return -ENOIOCTLCMD; | ||
786 | } | ||
787 | return nilfs_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); | ||
788 | } | ||
789 | #endif | ||