aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/compat_ioctl.c17
-rw-r--r--fs/ext2/dir.c3
-rw-r--r--fs/ext2/ext2.h1
-rw-r--r--fs/ext2/file.c6
-rw-r--r--fs/ext2/ioctl.c32
5 files changed, 42 insertions, 17 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 0346f2ab57c4..3594668559af 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -45,7 +45,6 @@
45#include <linux/tty.h> 45#include <linux/tty.h>
46#include <linux/vt_kern.h> 46#include <linux/vt_kern.h>
47#include <linux/fb.h> 47#include <linux/fb.h>
48#include <linux/ext2_fs.h>
49#include <linux/ext3_jbd.h> 48#include <linux/ext3_jbd.h>
50#include <linux/ext3_fs.h> 49#include <linux/ext3_fs.h>
51#include <linux/videodev.h> 50#include <linux/videodev.h>
@@ -159,18 +158,6 @@ static int rw_long(unsigned int fd, unsigned int cmd, unsigned long arg)
159 return err; 158 return err;
160} 159}
161 160
162static int do_ext2_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
163{
164 /* These are just misnamed, they actually get/put from/to user an int */
165 switch (cmd) {
166 case EXT2_IOC32_GETFLAGS: cmd = EXT2_IOC_GETFLAGS; break;
167 case EXT2_IOC32_SETFLAGS: cmd = EXT2_IOC_SETFLAGS; break;
168 case EXT2_IOC32_GETVERSION: cmd = EXT2_IOC_GETVERSION; break;
169 case EXT2_IOC32_SETVERSION: cmd = EXT2_IOC_SETVERSION; break;
170 }
171 return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg));
172}
173
174static int do_ext3_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) 161static int do_ext3_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
175{ 162{
176 /* These are just misnamed, they actually get/put from/to user an int */ 163 /* These are just misnamed, they actually get/put from/to user an int */
@@ -2725,10 +2712,6 @@ HANDLE_IOCTL(PIO_UNIMAP, do_unimap_ioctl)
2725HANDLE_IOCTL(GIO_UNIMAP, do_unimap_ioctl) 2712HANDLE_IOCTL(GIO_UNIMAP, do_unimap_ioctl)
2726HANDLE_IOCTL(KDFONTOP, do_kdfontop_ioctl) 2713HANDLE_IOCTL(KDFONTOP, do_kdfontop_ioctl)
2727#endif 2714#endif
2728HANDLE_IOCTL(EXT2_IOC32_GETFLAGS, do_ext2_ioctl)
2729HANDLE_IOCTL(EXT2_IOC32_SETFLAGS, do_ext2_ioctl)
2730HANDLE_IOCTL(EXT2_IOC32_GETVERSION, do_ext2_ioctl)
2731HANDLE_IOCTL(EXT2_IOC32_SETVERSION, do_ext2_ioctl)
2732HANDLE_IOCTL(EXT3_IOC32_GETVERSION, do_ext3_ioctl) 2715HANDLE_IOCTL(EXT3_IOC32_GETVERSION, do_ext3_ioctl)
2733HANDLE_IOCTL(EXT3_IOC32_SETVERSION, do_ext3_ioctl) 2716HANDLE_IOCTL(EXT3_IOC32_SETVERSION, do_ext3_ioctl)
2734HANDLE_IOCTL(EXT3_IOC32_GETRSVSZ, do_ext3_ioctl) 2717HANDLE_IOCTL(EXT3_IOC32_GETRSVSZ, do_ext3_ioctl)
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 92ea8265d7d5..3e7a84a1e509 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -661,5 +661,8 @@ const struct file_operations ext2_dir_operations = {
661 .read = generic_read_dir, 661 .read = generic_read_dir,
662 .readdir = ext2_readdir, 662 .readdir = ext2_readdir,
663 .ioctl = ext2_ioctl, 663 .ioctl = ext2_ioctl,
664#ifdef CONFIG_COMPAT
665 .compat_ioctl = ext2_compat_ioctl,
666#endif
664 .fsync = ext2_sync_file, 667 .fsync = ext2_sync_file,
665}; 668};
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index e65a019fc7a5..c19ac153f56b 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -137,6 +137,7 @@ extern void ext2_set_inode_flags(struct inode *inode);
137/* ioctl.c */ 137/* ioctl.c */
138extern int ext2_ioctl (struct inode *, struct file *, unsigned int, 138extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
139 unsigned long); 139 unsigned long);
140extern long ext2_compat_ioctl(struct file *, unsigned int, unsigned long);
140 141
141/* namei.c */ 142/* namei.c */
142struct dentry *ext2_get_parent(struct dentry *child); 143struct dentry *ext2_get_parent(struct dentry *child);
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 23e2c7ccec1d..e8bbed9dd268 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -46,6 +46,9 @@ const struct file_operations ext2_file_operations = {
46 .aio_read = generic_file_aio_read, 46 .aio_read = generic_file_aio_read,
47 .aio_write = generic_file_aio_write, 47 .aio_write = generic_file_aio_write,
48 .ioctl = ext2_ioctl, 48 .ioctl = ext2_ioctl,
49#ifdef CONFIG_COMPAT
50 .compat_ioctl = ext2_compat_ioctl,
51#endif
49 .mmap = generic_file_mmap, 52 .mmap = generic_file_mmap,
50 .open = generic_file_open, 53 .open = generic_file_open,
51 .release = ext2_release_file, 54 .release = ext2_release_file,
@@ -63,6 +66,9 @@ const struct file_operations ext2_xip_file_operations = {
63 .read = xip_file_read, 66 .read = xip_file_read,
64 .write = xip_file_write, 67 .write = xip_file_write,
65 .ioctl = ext2_ioctl, 68 .ioctl = ext2_ioctl,
69#ifdef CONFIG_COMPAT
70 .compat_ioctl = ext2_compat_ioctl,
71#endif
66 .mmap = xip_file_mmap, 72 .mmap = xip_file_mmap,
67 .open = generic_file_open, 73 .open = generic_file_open,
68 .release = ext2_release_file, 74 .release = ext2_release_file,
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index 3ca9afdf713d..1dfba77eab10 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -11,6 +11,8 @@
11#include <linux/capability.h> 11#include <linux/capability.h>
12#include <linux/time.h> 12#include <linux/time.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/compat.h>
15#include <linux/smp_lock.h>
14#include <asm/current.h> 16#include <asm/current.h>
15#include <asm/uaccess.h> 17#include <asm/uaccess.h>
16 18
@@ -80,3 +82,33 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
80 return -ENOTTY; 82 return -ENOTTY;
81 } 83 }
82} 84}
85
86#ifdef CONFIG_COMPAT
87long ext2_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
88{
89 struct inode *inode = file->f_dentry->d_inode;
90 int ret;
91
92 /* These are just misnamed, they actually get/put from/to user an int */
93 switch (cmd) {
94 case EXT2_IOC32_GETFLAGS:
95 cmd = EXT2_IOC_GETFLAGS;
96 break;
97 case EXT2_IOC32_SETFLAGS:
98 cmd = EXT2_IOC_SETFLAGS;
99 break;
100 case EXT2_IOC32_GETVERSION:
101 cmd = EXT2_IOC_GETVERSION;
102 break;
103 case EXT2_IOC32_SETVERSION:
104 cmd = EXT2_IOC_SETVERSION;
105 break;
106 default:
107 return -ENOIOCTLCMD;
108 }
109 lock_kernel();
110 ret = ext2_ioctl(inode, file, cmd, (unsigned long) compat_ptr(arg));
111 unlock_kernel();
112 return ret;
113}
114#endif