summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-04-06 19:01:53 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 08:31:18 -0700
commit8082d36aed26c4fb6ed43e4008303682eabf839e (patch)
treed51eff46a3ebe29e0a445597570599b5b7c4a037
parentdc498d09be28172846cacded35ca2378222a8c7b (diff)
downloadop-kernel-dev-8082d36aed26c4fb6ed43e4008303682eabf839e.zip
op-kernel-dev-8082d36aed26c4fb6ed43e4008303682eabf839e.tar.gz
nilfs2: remove compat ioctl code
This removes compat code from the nilfs ioctls and applies the same function for both .ioctl and .compat_ioctl file operations. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/nilfs2/dir.c2
-rw-r--r--fs/nilfs2/file.c2
-rw-r--r--fs/nilfs2/ioctl.c228
-rw-r--r--fs/nilfs2/nilfs.h1
-rw-r--r--include/linux/nilfs2_fs.h41
5 files changed, 2 insertions, 272 deletions
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index 1b7e6dd..393316c 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -704,7 +704,7 @@ struct file_operations nilfs_dir_operations = {
.readdir = nilfs_readdir,
.ioctl = nilfs_ioctl,
#ifdef CONFIG_COMPAT
- .compat_ioctl = nilfs_compat_ioctl,
+ .compat_ioctl = nilfs_ioctl,
#endif /* CONFIG_COMPAT */
.fsync = nilfs_sync_file,
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c
index cd38124..a2bd962 100644
--- a/fs/nilfs2/file.c
+++ b/fs/nilfs2/file.c
@@ -142,7 +142,7 @@ struct file_operations nilfs_file_operations = {
.aio_write = generic_file_aio_write,
.ioctl = nilfs_ioctl,
#ifdef CONFIG_COMPAT
- .compat_ioctl = nilfs_compat_ioctl,
+ .compat_ioctl = nilfs_ioctl,
#endif /* CONFIG_COMPAT */
.mmap = nilfs_file_mmap,
.open = generic_file_open,
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 7fbd9fe..33aff88 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -631,231 +631,3 @@ int nilfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
return -ENOTTY;
}
}
-
-/* compat_ioctl */
-#ifdef CONFIG_COMPAT
-#include <linux/compat.h>
-
-static int nilfs_compat_locked_ioctl(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- int ret;
-
- lock_kernel();
- ret = nilfs_ioctl(inode, filp, cmd, arg);
- unlock_kernel();
- return ret;
-}
-
-static int
-nilfs_compat_ioctl_uargv32_to_uargv(struct nilfs_argv32 __user *uargv32,
- struct nilfs_argv __user *uargv)
-{
- compat_uptr_t base;
- compat_size_t nmembs, size;
- compat_int_t index, flags;
-
- if (get_user(base, &uargv32->v_base) ||
- put_user(compat_ptr(base), &uargv->v_base) ||
- get_user(nmembs, &uargv32->v_nmembs) ||
- put_user(nmembs, &uargv->v_nmembs) ||
- get_user(size, &uargv32->v_size) ||
- put_user(size, &uargv->v_size) ||
- get_user(index, &uargv32->v_index) ||
- put_user(index, &uargv->v_index) ||
- get_user(flags, &uargv32->v_flags) ||
- put_user(flags, &uargv->v_flags))
- return -EFAULT;
- return 0;
-}
-
-static int
-nilfs_compat_ioctl_uargv_to_uargv32(struct nilfs_argv __user *uargv,
- struct nilfs_argv32 __user *uargv32)
-{
- size_t nmembs;
-
- if (get_user(nmembs, &uargv->v_nmembs) ||
- put_user(nmembs, &uargv32->v_nmembs))
- return -EFAULT;
- return 0;
-}
-
-static int
-nilfs_compat_ioctl_get_by_argv(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- struct nilfs_argv __user *uargv;
- struct nilfs_argv32 __user *uargv32;
- int ret;
-
- uargv = compat_alloc_user_space(sizeof(struct nilfs_argv));
- uargv32 = compat_ptr(arg);
- ret = nilfs_compat_ioctl_uargv32_to_uargv(uargv32, uargv);
- if (ret < 0)
- return ret;
-
- ret = nilfs_compat_locked_ioctl(inode, filp, cmd, (unsigned long)uargv);
- if (ret < 0)
- return ret;
-
- return nilfs_compat_ioctl_uargv_to_uargv32(uargv, uargv32);
-}
-
-static int
-nilfs_compat_ioctl_change_cpmode(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- struct nilfs_cpmode __user *ucpmode;
- struct nilfs_cpmode32 __user *ucpmode32;
- int mode;
-
- ucpmode = compat_alloc_user_space(sizeof(struct nilfs_cpmode));
- ucpmode32 = compat_ptr(arg);
- if (copy_in_user(&ucpmode->cm_cno, &ucpmode32->cm_cno,
- sizeof(__u64)) ||
- get_user(mode, &ucpmode32->cm_mode) ||
- put_user(mode, &ucpmode->cm_mode))
- return -EFAULT;
-
- return nilfs_compat_locked_ioctl(
- inode, filp, cmd, (unsigned long)ucpmode);
-}
-
-
-static inline int
-nilfs_compat_ioctl_delete_checkpoint(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- return nilfs_compat_locked_ioctl(inode, filp, cmd, arg);
-}
-
-static inline int
-nilfs_compat_ioctl_get_cpinfo(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- return nilfs_compat_ioctl_get_by_argv(inode, filp, cmd, arg);
-}
-
-static inline int
-nilfs_compat_ioctl_get_cpstat(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- return nilfs_compat_locked_ioctl(inode, filp, cmd, arg);
-}
-
-static inline int
-nilfs_compat_ioctl_get_suinfo(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- return nilfs_compat_ioctl_get_by_argv(inode, filp, cmd, arg);
-}
-
-static int
-nilfs_compat_ioctl_get_sustat(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- struct nilfs_sustat __user *usustat;
- struct nilfs_sustat32 __user *usustat32;
- time_t ctime, nongc_ctime;
- int ret;
-
- usustat = compat_alloc_user_space(sizeof(struct nilfs_sustat));
- ret = nilfs_compat_locked_ioctl(inode, filp, cmd,
- (unsigned long)usustat);
- if (ret < 0)
- return ret;
-
- usustat32 = compat_ptr(arg);
- if (copy_in_user(&usustat32->ss_nsegs, &usustat->ss_nsegs,
- sizeof(__u64)) ||
- copy_in_user(&usustat32->ss_ncleansegs, &usustat->ss_ncleansegs,
- sizeof(__u64)) ||
- copy_in_user(&usustat32->ss_ndirtysegs, &usustat->ss_ndirtysegs,
- sizeof(__u64)) ||
- get_user(ctime, &usustat->ss_ctime) ||
- put_user(ctime, &usustat32->ss_ctime) ||
- get_user(nongc_ctime, &usustat->ss_nongc_ctime) ||
- put_user(nongc_ctime, &usustat32->ss_nongc_ctime))
- return -EFAULT;
- return 0;
-}
-
-static inline int
-nilfs_compat_ioctl_get_vinfo(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- return nilfs_compat_ioctl_get_by_argv(inode, filp, cmd, arg);
-}
-
-static inline int
-nilfs_compat_ioctl_get_bdescs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- return nilfs_compat_ioctl_get_by_argv(inode, filp, cmd, arg);
-}
-
-static int
-nilfs_compat_ioctl_clean_segments(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- struct nilfs_argv __user *uargv;
- struct nilfs_argv32 __user *uargv32;
- int i, ret;
-
- uargv = compat_alloc_user_space(sizeof(struct nilfs_argv) * 5);
- uargv32 = compat_ptr(arg);
- for (i = 0; i < 5; i++) {
- ret = nilfs_compat_ioctl_uargv32_to_uargv(&uargv32[i],
- &uargv[i]);
- if (ret < 0)
- return ret;
- }
- return nilfs_compat_locked_ioctl(
- inode, filp, cmd, (unsigned long)uargv);
-}
-
-static int nilfs_compat_ioctl_sync(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- return nilfs_compat_locked_ioctl(inode, filp, cmd, arg);
-}
-
-long nilfs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
-{
- struct inode *inode = filp->f_dentry->d_inode;
-
- switch (cmd) {
- case NILFS_IOCTL32_CHANGE_CPMODE:
- return nilfs_compat_ioctl_change_cpmode(
- inode, filp, NILFS_IOCTL_CHANGE_CPMODE, arg);
- case NILFS_IOCTL_DELETE_CHECKPOINT:
- return nilfs_compat_ioctl_delete_checkpoint(
- inode, filp, cmd, arg);
- case NILFS_IOCTL32_GET_CPINFO:
- return nilfs_compat_ioctl_get_cpinfo(
- inode, filp, NILFS_IOCTL_GET_CPINFO, arg);
- case NILFS_IOCTL_GET_CPSTAT:
- return nilfs_compat_ioctl_get_cpstat(inode, filp, cmd, arg);
- case NILFS_IOCTL32_GET_SUINFO:
- return nilfs_compat_ioctl_get_suinfo(
- inode, filp, NILFS_IOCTL_GET_SUINFO, arg);
- case NILFS_IOCTL32_GET_SUSTAT:
- return nilfs_compat_ioctl_get_sustat(
- inode, filp, NILFS_IOCTL_GET_SUSTAT, arg);
- case NILFS_IOCTL32_GET_VINFO:
- return nilfs_compat_ioctl_get_vinfo(
- inode, filp, NILFS_IOCTL_GET_VINFO, arg);
- case NILFS_IOCTL32_GET_BDESCS:
- return nilfs_compat_ioctl_get_bdescs(
- inode, filp, NILFS_IOCTL_GET_BDESCS, arg);
- case NILFS_IOCTL32_CLEAN_SEGMENTS:
- return nilfs_compat_ioctl_clean_segments(
- inode, filp, NILFS_IOCTL_CLEAN_SEGMENTS, arg);
- case NILFS_IOCTL_SYNC:
- return nilfs_compat_ioctl_sync(inode, filp, cmd, arg);
- default:
- return -ENOIOCTLCMD;
- }
-}
-#endif
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
index 48c0706..f767644 100644
--- a/fs/nilfs2/nilfs.h
+++ b/fs/nilfs2/nilfs.h
@@ -243,7 +243,6 @@ extern int nilfs_sync_file(struct file *, struct dentry *, int);
/* ioctl.c */
int nilfs_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
-long nilfs_compat_ioctl(struct file *, unsigned int, unsigned long);
int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *, void __user *);
/* inode.c */
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 8fb64ce..306c446 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -793,45 +793,4 @@ struct nilfs_bdesc {
#define NILFS_IOCTL_RESIZE \
_IOW(NILFS_IOCTL_IDENT, 0x8B, __u64)
-/* compat_ioctl */
-#ifdef CONFIG_COMPAT
-#include <linux/compat.h>
-
-struct nilfs_cpmode32 {
- __u64 cm_cno;
- compat_int_t cm_mode;
-};
-
-struct nilfs_argv32 {
- compat_caddr_t v_base;
- compat_size_t v_nmembs;
- compat_size_t v_size;
- compat_int_t v_index;
- compat_int_t v_flags;
-};
-
-struct nilfs_sustat32 {
- __u64 ss_nsegs;
- __u64 ss_ncleansegs;
- __u64 ss_ndirtysegs;
- compat_time_t ss_ctime;
- compat_time_t ss_nongc_ctime;
-};
-
-#define NILFS_IOCTL32_CHANGE_CPMODE \
- _IOW(NILFS_IOCTL_IDENT, 0x80, struct nilfs_cpmode32)
-#define NILFS_IOCTL32_GET_CPINFO \
- _IOR(NILFS_IOCTL_IDENT, 0x82, struct nilfs_argv32)
-#define NILFS_IOCTL32_GET_SUINFO \
- _IOR(NILFS_IOCTL_IDENT, 0x84, struct nilfs_argv32)
-#define NILFS_IOCTL32_GET_SUSTAT \
- _IOR(NILFS_IOCTL_IDENT, 0x85, struct nilfs_sustat32)
-#define NILFS_IOCTL32_GET_VINFO \
- _IOWR(NILFS_IOCTL_IDENT, 0x86, struct nilfs_argv32)
-#define NILFS_IOCTL32_GET_BDESCS \
- _IOWR(NILFS_IOCTL_IDENT, 0x87, struct nilfs_argv32)
-#define NILFS_IOCTL32_CLEAN_SEGMENTS \
- _IOW(NILFS_IOCTL_IDENT, 0x88, struct nilfs_argv32[5])
-#endif /* CONFIG_COMPAT */
-
#endif /* _LINUX_NILFS_FS_H */
OpenPOWER on IntegriCloud