diff options
author | Arnd Bergmann <arnd@arndb.de> | 2007-10-09 07:23:56 -0400 |
---|---|---|
committer | Jens Axboe <axboe@carl.home.kernel.dk> | 2007-10-10 03:26:00 -0400 |
commit | b3087cc4f31a66c8c7b63419e913ed9d34145f10 (patch) | |
tree | fa597c0aebee961d086a0a40373b925eb33d73ab /fs/compat_ioctl.c | |
parent | 18cf7f8723d913ce02bea43e468bebdd07bc880c (diff) |
compat_ioctl: move cdrom handlers to block/compat_ioctl.c
These are shared by all cd-rom drivers and should have common
handlers. Do slight cosmetic cleanups in the process.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r-- | fs/compat_ioctl.c | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 3baa90d31090..24c743571127 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/if_ppp.h> | 37 | #include <linux/if_ppp.h> |
38 | #include <linux/if_pppox.h> | 38 | #include <linux/if_pppox.h> |
39 | #include <linux/mtio.h> | 39 | #include <linux/mtio.h> |
40 | #include <linux/cdrom.h> | ||
41 | #include <linux/auto_fs.h> | 40 | #include <linux/auto_fs.h> |
42 | #include <linux/auto_fs4.h> | 41 | #include <linux/auto_fs4.h> |
43 | #include <linux/tty.h> | 42 | #include <linux/tty.h> |
@@ -1039,108 +1038,6 @@ static int mt_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
1039 | return err ? -EFAULT: 0; | 1038 | return err ? -EFAULT: 0; |
1040 | } | 1039 | } |
1041 | 1040 | ||
1042 | struct cdrom_read_audio32 { | ||
1043 | union cdrom_addr addr; | ||
1044 | u8 addr_format; | ||
1045 | compat_int_t nframes; | ||
1046 | compat_caddr_t buf; | ||
1047 | }; | ||
1048 | |||
1049 | struct cdrom_generic_command32 { | ||
1050 | unsigned char cmd[CDROM_PACKET_SIZE]; | ||
1051 | compat_caddr_t buffer; | ||
1052 | compat_uint_t buflen; | ||
1053 | compat_int_t stat; | ||
1054 | compat_caddr_t sense; | ||
1055 | unsigned char data_direction; | ||
1056 | compat_int_t quiet; | ||
1057 | compat_int_t timeout; | ||
1058 | compat_caddr_t reserved[1]; | ||
1059 | }; | ||
1060 | |||
1061 | static int cdrom_do_read_audio(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1062 | { | ||
1063 | struct cdrom_read_audio __user *cdread_audio; | ||
1064 | struct cdrom_read_audio32 __user *cdread_audio32; | ||
1065 | __u32 data; | ||
1066 | void __user *datap; | ||
1067 | |||
1068 | cdread_audio = compat_alloc_user_space(sizeof(*cdread_audio)); | ||
1069 | cdread_audio32 = compat_ptr(arg); | ||
1070 | |||
1071 | if (copy_in_user(&cdread_audio->addr, | ||
1072 | &cdread_audio32->addr, | ||
1073 | (sizeof(*cdread_audio32) - | ||
1074 | sizeof(compat_caddr_t)))) | ||
1075 | return -EFAULT; | ||
1076 | |||
1077 | if (get_user(data, &cdread_audio32->buf)) | ||
1078 | return -EFAULT; | ||
1079 | datap = compat_ptr(data); | ||
1080 | if (put_user(datap, &cdread_audio->buf)) | ||
1081 | return -EFAULT; | ||
1082 | |||
1083 | return sys_ioctl(fd, cmd, (unsigned long) cdread_audio); | ||
1084 | } | ||
1085 | |||
1086 | static int cdrom_do_generic_command(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1087 | { | ||
1088 | struct cdrom_generic_command __user *cgc; | ||
1089 | struct cdrom_generic_command32 __user *cgc32; | ||
1090 | u32 data; | ||
1091 | unsigned char dir; | ||
1092 | int itmp; | ||
1093 | |||
1094 | cgc = compat_alloc_user_space(sizeof(*cgc)); | ||
1095 | cgc32 = compat_ptr(arg); | ||
1096 | |||
1097 | if (copy_in_user(&cgc->cmd, &cgc32->cmd, sizeof(cgc->cmd)) || | ||
1098 | get_user(data, &cgc32->buffer) || | ||
1099 | put_user(compat_ptr(data), &cgc->buffer) || | ||
1100 | copy_in_user(&cgc->buflen, &cgc32->buflen, | ||
1101 | (sizeof(unsigned int) + sizeof(int))) || | ||
1102 | get_user(data, &cgc32->sense) || | ||
1103 | put_user(compat_ptr(data), &cgc->sense) || | ||
1104 | get_user(dir, &cgc32->data_direction) || | ||
1105 | put_user(dir, &cgc->data_direction) || | ||
1106 | get_user(itmp, &cgc32->quiet) || | ||
1107 | put_user(itmp, &cgc->quiet) || | ||
1108 | get_user(itmp, &cgc32->timeout) || | ||
1109 | put_user(itmp, &cgc->timeout) || | ||
1110 | get_user(data, &cgc32->reserved[0]) || | ||
1111 | put_user(compat_ptr(data), &cgc->reserved[0])) | ||
1112 | return -EFAULT; | ||
1113 | |||
1114 | return sys_ioctl(fd, cmd, (unsigned long) cgc); | ||
1115 | } | ||
1116 | |||
1117 | static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1118 | { | ||
1119 | int err; | ||
1120 | |||
1121 | switch(cmd) { | ||
1122 | case CDROMREADAUDIO: | ||
1123 | err = cdrom_do_read_audio(fd, cmd, arg); | ||
1124 | break; | ||
1125 | |||
1126 | case CDROM_SEND_PACKET: | ||
1127 | err = cdrom_do_generic_command(fd, cmd, arg); | ||
1128 | break; | ||
1129 | |||
1130 | default: | ||
1131 | do { | ||
1132 | static int count; | ||
1133 | if (++count <= 20) | ||
1134 | printk("cdrom_ioctl: Unknown cmd fd(%d) " | ||
1135 | "cmd(%08x) arg(%08x)\n", | ||
1136 | (int)fd, (unsigned int)cmd, (unsigned int)arg); | ||
1137 | } while(0); | ||
1138 | err = -EINVAL; | ||
1139 | break; | ||
1140 | }; | ||
1141 | |||
1142 | return err; | ||
1143 | } | ||
1144 | #endif /* CONFIG_BLOCK */ | 1041 | #endif /* CONFIG_BLOCK */ |
1145 | 1042 | ||
1146 | #ifdef CONFIG_VT | 1043 | #ifdef CONFIG_VT |
@@ -3147,8 +3044,6 @@ HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans) | |||
3147 | #ifdef CONFIG_BLOCK | 3044 | #ifdef CONFIG_BLOCK |
3148 | HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) | 3045 | HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) |
3149 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) | 3046 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) |
3150 | HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) | ||
3151 | HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) | ||
3152 | #endif | 3047 | #endif |
3153 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) | 3048 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) |
3154 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) | 3049 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) |