diff options
author | Namjae Jeon <namjae.jeon@samsung.com> | 2013-02-04 09:41:41 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-02-11 17:15:02 -0500 |
commit | e9750824114ff939d9da299e73651add6aa65456 (patch) | |
tree | fbaa154683ec00dc49e0a19e3a2069abb90d953f /fs/f2fs | |
parent | b7250d2d845822466356f7f22a650bf807090d7e (diff) |
f2fs: add compat_ioctl to provide backward compatability
adding compat_ioctl to provide support for backward comptability - 32bit binary
execution on 64bit kernel.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/f2fs.h | 15 | ||||
-rw-r--r-- | fs/f2fs/file.c | 21 |
2 files changed, 36 insertions, 0 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e7e7a29767d6..c3462b69917e 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -104,6 +104,20 @@ static inline int update_sits_in_cursum(struct f2fs_summary_block *rs, int i) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | /* | 106 | /* |
107 | * ioctl commands | ||
108 | */ | ||
109 | #define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS | ||
110 | #define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS | ||
111 | |||
112 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) | ||
113 | /* | ||
114 | * ioctl commands in 32 bit emulation | ||
115 | */ | ||
116 | #define F2FS_IOC32_GETFLAGS FS_IOC32_GETFLAGS | ||
117 | #define F2FS_IOC32_SETFLAGS FS_IOC32_SETFLAGS | ||
118 | #endif | ||
119 | |||
120 | /* | ||
107 | * For INODE and NODE manager | 121 | * For INODE and NODE manager |
108 | */ | 122 | */ |
109 | #define XATTR_NODE_OFFSET (-1) /* | 123 | #define XATTR_NODE_OFFSET (-1) /* |
@@ -850,6 +864,7 @@ void f2fs_truncate(struct inode *); | |||
850 | int f2fs_setattr(struct dentry *, struct iattr *); | 864 | int f2fs_setattr(struct dentry *, struct iattr *); |
851 | int truncate_hole(struct inode *, pgoff_t, pgoff_t); | 865 | int truncate_hole(struct inode *, pgoff_t, pgoff_t); |
852 | long f2fs_ioctl(struct file *, unsigned int, unsigned long); | 866 | long f2fs_ioctl(struct file *, unsigned int, unsigned long); |
867 | long f2fs_compat_ioctl(struct file *, unsigned int, unsigned long); | ||
853 | 868 | ||
854 | /* | 869 | /* |
855 | * inode.c | 870 | * inode.c |
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 33d1736ee5f9..b7a053d4c6d3 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/writeback.h> | 15 | #include <linux/writeback.h> |
16 | #include <linux/falloc.h> | 16 | #include <linux/falloc.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/compat.h> | ||
18 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
19 | #include <linux/mount.h> | 20 | #include <linux/mount.h> |
20 | 21 | ||
@@ -634,6 +635,23 @@ out: | |||
634 | } | 635 | } |
635 | } | 636 | } |
636 | 637 | ||
638 | #ifdef CONFIG_COMPAT | ||
639 | long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
640 | { | ||
641 | switch (cmd) { | ||
642 | case F2FS_IOC32_GETFLAGS: | ||
643 | cmd = F2FS_IOC_GETFLAGS; | ||
644 | break; | ||
645 | case F2FS_IOC32_SETFLAGS: | ||
646 | cmd = F2FS_IOC_SETFLAGS; | ||
647 | break; | ||
648 | default: | ||
649 | return -ENOIOCTLCMD; | ||
650 | } | ||
651 | return f2fs_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); | ||
652 | } | ||
653 | #endif | ||
654 | |||
637 | const struct file_operations f2fs_file_operations = { | 655 | const struct file_operations f2fs_file_operations = { |
638 | .llseek = generic_file_llseek, | 656 | .llseek = generic_file_llseek, |
639 | .read = do_sync_read, | 657 | .read = do_sync_read, |
@@ -645,6 +663,9 @@ const struct file_operations f2fs_file_operations = { | |||
645 | .fsync = f2fs_sync_file, | 663 | .fsync = f2fs_sync_file, |
646 | .fallocate = f2fs_fallocate, | 664 | .fallocate = f2fs_fallocate, |
647 | .unlocked_ioctl = f2fs_ioctl, | 665 | .unlocked_ioctl = f2fs_ioctl, |
666 | #ifdef CONFIG_COMPAT | ||
667 | .compat_ioctl = f2fs_compat_ioctl, | ||
668 | #endif | ||
648 | .splice_read = generic_file_splice_read, | 669 | .splice_read = generic_file_splice_read, |
649 | .splice_write = generic_file_splice_write, | 670 | .splice_write = generic_file_splice_write, |
650 | }; | 671 | }; |