aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-08-29 14:06:23 -0400
committerJens Axboe <axboe@nelson.home.kernel.dk>2006-09-30 14:52:29 -0400
commit52a700c5675f399c07e6e57328291e57f13ef3bb (patch)
tree4ef1a3a7d66f589ad2e5f7d769da8c30f172a70e
parente322ff07fb2d0f05c02d85e7c6b30d23f308c20f (diff)
[PATCH] BLOCK: Move the Ext3 device ioctl compat stuff to the Ext3 driver [try #6]
Move the Ext3 device ioctl compat stuff from fs/compat_ioctl.c to the Ext3 driver so that the Ext3 header file doesn't need to be included. Signed-Off-By: David Howells <dhowells@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/compat_ioctl.c27
-rw-r--r--fs/ext3/dir.c3
-rw-r--r--fs/ext3/file.c3
-rw-r--r--fs/ext3/ioctl.c55
-rw-r--r--include/linux/ext3_fs.h6
5 files changed, 66 insertions, 28 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 3594668559af..e5eb0f10f05a 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -45,8 +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/ext3_jbd.h>
49#include <linux/ext3_fs.h>
50#include <linux/videodev.h> 48#include <linux/videodev.h>
51#include <linux/netdevice.h> 49#include <linux/netdevice.h>
52#include <linux/raw.h> 50#include <linux/raw.h>
@@ -158,22 +156,6 @@ static int rw_long(unsigned int fd, unsigned int cmd, unsigned long arg)
158 return err; 156 return err;
159} 157}
160 158
161static int do_ext3_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
162{
163 /* These are just misnamed, they actually get/put from/to user an int */
164 switch (cmd) {
165 case EXT3_IOC32_GETVERSION: cmd = EXT3_IOC_GETVERSION; break;
166 case EXT3_IOC32_SETVERSION: cmd = EXT3_IOC_SETVERSION; break;
167 case EXT3_IOC32_GETRSVSZ: cmd = EXT3_IOC_GETRSVSZ; break;
168 case EXT3_IOC32_SETRSVSZ: cmd = EXT3_IOC_SETRSVSZ; break;
169 case EXT3_IOC32_GROUP_EXTEND: cmd = EXT3_IOC_GROUP_EXTEND; break;
170#ifdef CONFIG_JBD_DEBUG
171 case EXT3_IOC32_WAIT_FOR_READONLY: cmd = EXT3_IOC_WAIT_FOR_READONLY; break;
172#endif
173 }
174 return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg));
175}
176
177struct compat_video_event { 159struct compat_video_event {
178 int32_t type; 160 int32_t type;
179 compat_time_t timestamp; 161 compat_time_t timestamp;
@@ -2712,15 +2694,6 @@ HANDLE_IOCTL(PIO_UNIMAP, do_unimap_ioctl)
2712HANDLE_IOCTL(GIO_UNIMAP, do_unimap_ioctl) 2694HANDLE_IOCTL(GIO_UNIMAP, do_unimap_ioctl)
2713HANDLE_IOCTL(KDFONTOP, do_kdfontop_ioctl) 2695HANDLE_IOCTL(KDFONTOP, do_kdfontop_ioctl)
2714#endif 2696#endif
2715HANDLE_IOCTL(EXT3_IOC32_GETVERSION, do_ext3_ioctl)
2716HANDLE_IOCTL(EXT3_IOC32_SETVERSION, do_ext3_ioctl)
2717HANDLE_IOCTL(EXT3_IOC32_GETRSVSZ, do_ext3_ioctl)
2718HANDLE_IOCTL(EXT3_IOC32_SETRSVSZ, do_ext3_ioctl)
2719HANDLE_IOCTL(EXT3_IOC32_GROUP_EXTEND, do_ext3_ioctl)
2720COMPATIBLE_IOCTL(EXT3_IOC_GROUP_ADD)
2721#ifdef CONFIG_JBD_DEBUG
2722HANDLE_IOCTL(EXT3_IOC32_WAIT_FOR_READONLY, do_ext3_ioctl)
2723#endif
2724/* One SMB ioctl needs translations. */ 2697/* One SMB ioctl needs translations. */
2725#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t) 2698#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
2726HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid) 2699HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid)
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c
index 429acbb4e064..d0b54f30b914 100644
--- a/fs/ext3/dir.c
+++ b/fs/ext3/dir.c
@@ -44,6 +44,9 @@ const struct file_operations ext3_dir_operations = {
44 .read = generic_read_dir, 44 .read = generic_read_dir,
45 .readdir = ext3_readdir, /* we take BKL. needed?*/ 45 .readdir = ext3_readdir, /* we take BKL. needed?*/
46 .ioctl = ext3_ioctl, /* BKL held */ 46 .ioctl = ext3_ioctl, /* BKL held */
47#ifdef CONFIG_COMPAT
48 .compat_ioctl = ext3_compat_ioctl,
49#endif
47 .fsync = ext3_sync_file, /* BKL held */ 50 .fsync = ext3_sync_file, /* BKL held */
48#ifdef CONFIG_EXT3_INDEX 51#ifdef CONFIG_EXT3_INDEX
49 .release = ext3_release_dir, 52 .release = ext3_release_dir,
diff --git a/fs/ext3/file.c b/fs/ext3/file.c
index 994efd189f4e..74ff20f9d09b 100644
--- a/fs/ext3/file.c
+++ b/fs/ext3/file.c
@@ -114,6 +114,9 @@ const struct file_operations ext3_file_operations = {
114 .readv = generic_file_readv, 114 .readv = generic_file_readv,
115 .writev = generic_file_writev, 115 .writev = generic_file_writev,
116 .ioctl = ext3_ioctl, 116 .ioctl = ext3_ioctl,
117#ifdef CONFIG_COMPAT
118 .compat_ioctl = ext3_compat_ioctl,
119#endif
117 .mmap = generic_file_mmap, 120 .mmap = generic_file_mmap,
118 .open = generic_file_open, 121 .open = generic_file_open,
119 .release = ext3_release_file, 122 .release = ext3_release_file,
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c
index 3a6b012d120c..12daa6869572 100644
--- a/fs/ext3/ioctl.c
+++ b/fs/ext3/ioctl.c
@@ -13,9 +13,10 @@
13#include <linux/ext3_fs.h> 13#include <linux/ext3_fs.h>
14#include <linux/ext3_jbd.h> 14#include <linux/ext3_jbd.h>
15#include <linux/time.h> 15#include <linux/time.h>
16#include <linux/compat.h>
17#include <linux/smp_lock.h>
16#include <asm/uaccess.h> 18#include <asm/uaccess.h>
17 19
18
19int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, 20int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
20 unsigned long arg) 21 unsigned long arg)
21{ 22{
@@ -252,3 +253,55 @@ flags_err:
252 return -ENOTTY; 253 return -ENOTTY;
253 } 254 }
254} 255}
256
257#ifdef CONFIG_COMPAT
258long ext3_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
259{
260 struct inode *inode = file->f_dentry->d_inode;
261 int ret;
262
263 /* These are just misnamed, they actually get/put from/to user an int */
264 switch (cmd) {
265 case EXT3_IOC32_GETFLAGS:
266 cmd = EXT3_IOC_GETFLAGS;
267 break;
268 case EXT3_IOC32_SETFLAGS:
269 cmd = EXT3_IOC_SETFLAGS;
270 break;
271 case EXT3_IOC32_GETVERSION:
272 cmd = EXT3_IOC_GETVERSION;
273 break;
274 case EXT3_IOC32_SETVERSION:
275 cmd = EXT3_IOC_SETVERSION;
276 break;
277 case EXT3_IOC32_GROUP_EXTEND:
278 cmd = EXT3_IOC_GROUP_EXTEND;
279 break;
280 case EXT3_IOC32_GETVERSION_OLD:
281 cmd = EXT3_IOC_GETVERSION_OLD;
282 break;
283 case EXT3_IOC32_SETVERSION_OLD:
284 cmd = EXT3_IOC_SETVERSION_OLD;
285 break;
286#ifdef CONFIG_JBD_DEBUG
287 case EXT3_IOC32_WAIT_FOR_READONLY:
288 cmd = EXT3_IOC_WAIT_FOR_READONLY;
289 break;
290#endif
291 case EXT3_IOC32_GETRSVSZ:
292 cmd = EXT3_IOC_GETRSVSZ;
293 break;
294 case EXT3_IOC32_SETRSVSZ:
295 cmd = EXT3_IOC_SETRSVSZ;
296 break;
297 case EXT3_IOC_GROUP_ADD:
298 break;
299 default:
300 return -ENOIOCTLCMD;
301 }
302 lock_kernel();
303 ret = ext3_ioctl(inode, file, cmd, (unsigned long) compat_ptr(arg));
304 unlock_kernel();
305 return ret;
306}
307#endif
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index a7a01ff44669..11cca1bdc0c7 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -233,6 +233,8 @@ struct ext3_new_group_data {
233/* 233/*
234 * ioctl commands in 32 bit emulation 234 * ioctl commands in 32 bit emulation
235 */ 235 */
236#define EXT3_IOC32_GETFLAGS FS_IOC32_GETFLAGS
237#define EXT3_IOC32_SETFLAGS FS_IOC32_SETFLAGS
236#define EXT3_IOC32_GETVERSION _IOR('f', 3, int) 238#define EXT3_IOC32_GETVERSION _IOR('f', 3, int)
237#define EXT3_IOC32_SETVERSION _IOW('f', 4, int) 239#define EXT3_IOC32_SETVERSION _IOW('f', 4, int)
238#define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int) 240#define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int)
@@ -241,6 +243,9 @@ struct ext3_new_group_data {
241#ifdef CONFIG_JBD_DEBUG 243#ifdef CONFIG_JBD_DEBUG
242#define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int) 244#define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
243#endif 245#endif
246#define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
247#define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
248
244 249
245/* 250/*
246 * Mount options 251 * Mount options
@@ -824,6 +829,7 @@ extern void ext3_set_aops(struct inode *inode);
824/* ioctl.c */ 829/* ioctl.c */
825extern int ext3_ioctl (struct inode *, struct file *, unsigned int, 830extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
826 unsigned long); 831 unsigned long);
832extern long ext3_compat_ioctl (struct file *, unsigned int, unsigned long);
827 833
828/* namei.c */ 834/* namei.c */
829extern int ext3_orphan_add(handle_t *, struct inode *); 835extern int ext3_orphan_add(handle_t *, struct inode *);