diff options
author | David Howells <dhowells@redhat.com> | 2006-08-29 14:06:14 -0400 |
---|---|---|
committer | Jens Axboe <axboe@nelson.home.kernel.dk> | 2006-09-30 14:52:27 -0400 |
commit | 863d5b822c02d0e7215fb84ca79e9f8c3e35f04e (patch) | |
tree | 86e2fd2507a78a1adc6a7126f26c38ebf2ee4d1d /fs | |
parent | b71e8a4ce03b3098c7801ee5e6e08d1a39a226c2 (diff) |
[PATCH] BLOCK: Move the loop device ioctl compat stuff to the loop driver [try #6]
Move the loop device ioctl compat stuff from fs/compat_ioctl.c to the loop
driver so that the loop header file doesn't need to be included.
Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/compat_ioctl.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index ab74c9bd55fe..3b0cf7fbd95a 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <linux/if_pppox.h> | 40 | #include <linux/if_pppox.h> |
41 | #include <linux/mtio.h> | 41 | #include <linux/mtio.h> |
42 | #include <linux/cdrom.h> | 42 | #include <linux/cdrom.h> |
43 | #include <linux/loop.h> | ||
44 | #include <linux/auto_fs.h> | 43 | #include <linux/auto_fs.h> |
45 | #include <linux/auto_fs4.h> | 44 | #include <linux/auto_fs4.h> |
46 | #include <linux/tty.h> | 45 | #include <linux/tty.h> |
@@ -1214,71 +1213,6 @@ static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar | |||
1214 | return err; | 1213 | return err; |
1215 | } | 1214 | } |
1216 | 1215 | ||
1217 | struct loop_info32 { | ||
1218 | compat_int_t lo_number; /* ioctl r/o */ | ||
1219 | compat_dev_t lo_device; /* ioctl r/o */ | ||
1220 | compat_ulong_t lo_inode; /* ioctl r/o */ | ||
1221 | compat_dev_t lo_rdevice; /* ioctl r/o */ | ||
1222 | compat_int_t lo_offset; | ||
1223 | compat_int_t lo_encrypt_type; | ||
1224 | compat_int_t lo_encrypt_key_size; /* ioctl w/o */ | ||
1225 | compat_int_t lo_flags; /* ioctl r/o */ | ||
1226 | char lo_name[LO_NAME_SIZE]; | ||
1227 | unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ | ||
1228 | compat_ulong_t lo_init[2]; | ||
1229 | char reserved[4]; | ||
1230 | }; | ||
1231 | |||
1232 | static int loop_status(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1233 | { | ||
1234 | mm_segment_t old_fs = get_fs(); | ||
1235 | struct loop_info l; | ||
1236 | struct loop_info32 __user *ul; | ||
1237 | int err = -EINVAL; | ||
1238 | |||
1239 | ul = compat_ptr(arg); | ||
1240 | switch(cmd) { | ||
1241 | case LOOP_SET_STATUS: | ||
1242 | err = get_user(l.lo_number, &ul->lo_number); | ||
1243 | err |= __get_user(l.lo_device, &ul->lo_device); | ||
1244 | err |= __get_user(l.lo_inode, &ul->lo_inode); | ||
1245 | err |= __get_user(l.lo_rdevice, &ul->lo_rdevice); | ||
1246 | err |= __copy_from_user(&l.lo_offset, &ul->lo_offset, | ||
1247 | 8 + (unsigned long)l.lo_init - (unsigned long)&l.lo_offset); | ||
1248 | if (err) { | ||
1249 | err = -EFAULT; | ||
1250 | } else { | ||
1251 | set_fs (KERNEL_DS); | ||
1252 | err = sys_ioctl (fd, cmd, (unsigned long)&l); | ||
1253 | set_fs (old_fs); | ||
1254 | } | ||
1255 | break; | ||
1256 | case LOOP_GET_STATUS: | ||
1257 | set_fs (KERNEL_DS); | ||
1258 | err = sys_ioctl (fd, cmd, (unsigned long)&l); | ||
1259 | set_fs (old_fs); | ||
1260 | if (!err) { | ||
1261 | err = put_user(l.lo_number, &ul->lo_number); | ||
1262 | err |= __put_user(l.lo_device, &ul->lo_device); | ||
1263 | err |= __put_user(l.lo_inode, &ul->lo_inode); | ||
1264 | err |= __put_user(l.lo_rdevice, &ul->lo_rdevice); | ||
1265 | err |= __copy_to_user(&ul->lo_offset, &l.lo_offset, | ||
1266 | (unsigned long)l.lo_init - (unsigned long)&l.lo_offset); | ||
1267 | if (err) | ||
1268 | err = -EFAULT; | ||
1269 | } | ||
1270 | break; | ||
1271 | default: { | ||
1272 | static int count; | ||
1273 | if (++count <= 20) | ||
1274 | printk("%s: Unknown loop ioctl cmd, fd(%d) " | ||
1275 | "cmd(%08x) arg(%08lx)\n", | ||
1276 | __FUNCTION__, fd, cmd, arg); | ||
1277 | } | ||
1278 | } | ||
1279 | return err; | ||
1280 | } | ||
1281 | |||
1282 | #ifdef CONFIG_VT | 1216 | #ifdef CONFIG_VT |
1283 | 1217 | ||
1284 | static int vt_check(struct file *file) | 1218 | static int vt_check(struct file *file) |
@@ -2808,8 +2742,6 @@ HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) | |||
2808 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) | 2742 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) |
2809 | HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) | 2743 | HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) |
2810 | HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) | 2744 | HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) |
2811 | HANDLE_IOCTL(LOOP_SET_STATUS, loop_status) | ||
2812 | HANDLE_IOCTL(LOOP_GET_STATUS, loop_status) | ||
2813 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) | 2745 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) |
2814 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) | 2746 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) |
2815 | #ifdef CONFIG_VT | 2747 | #ifdef CONFIG_VT |