diff options
Diffstat (limited to 'arch/ia64/ia32')
-rw-r--r-- | arch/ia64/ia32/ia32_entry.S | 2 | ||||
-rw-r--r-- | arch/ia64/ia32/ia32priv.h | 7 | ||||
-rw-r--r-- | arch/ia64/ia32/sys_ia32.c | 132 |
3 files changed, 1 insertions, 140 deletions
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S index 06efd1f9b800..ff88c48c5d19 100644 --- a/arch/ia64/ia32/ia32_entry.S +++ b/arch/ia64/ia32/ia32_entry.S | |||
@@ -262,7 +262,7 @@ ia32_syscall_table: | |||
262 | data8 sys_uselib | 262 | data8 sys_uselib |
263 | data8 sys_swapon | 263 | data8 sys_swapon |
264 | data8 sys_reboot | 264 | data8 sys_reboot |
265 | data8 sys32_readdir | 265 | data8 compat_sys_old_readdir |
266 | data8 sys32_mmap /* 90 */ | 266 | data8 sys32_mmap /* 90 */ |
267 | data8 sys32_munmap | 267 | data8 sys32_munmap |
268 | data8 sys_truncate | 268 | data8 sys_truncate |
diff --git a/arch/ia64/ia32/ia32priv.h b/arch/ia64/ia32/ia32priv.h index c5c872b250da..dd0c53687a96 100644 --- a/arch/ia64/ia32/ia32priv.h +++ b/arch/ia64/ia32/ia32priv.h | |||
@@ -276,13 +276,6 @@ typedef struct compat_siginfo { | |||
276 | } _sifields; | 276 | } _sifields; |
277 | } compat_siginfo_t; | 277 | } compat_siginfo_t; |
278 | 278 | ||
279 | struct old_linux32_dirent { | ||
280 | u32 d_ino; | ||
281 | u32 d_offset; | ||
282 | u16 d_namlen; | ||
283 | char d_name[1]; | ||
284 | }; | ||
285 | |||
286 | /* | 279 | /* |
287 | * IA-32 ELF specific definitions for IA-64. | 280 | * IA-32 ELF specific definitions for IA-64. |
288 | */ | 281 | */ |
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index 465116aecb85..bf196cbb3796 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c | |||
@@ -1210,138 +1210,6 @@ sys32_settimeofday (struct compat_timeval __user *tv, struct timezone __user *tz | |||
1210 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); | 1210 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); |
1211 | } | 1211 | } |
1212 | 1212 | ||
1213 | struct getdents32_callback { | ||
1214 | struct compat_dirent __user *current_dir; | ||
1215 | struct compat_dirent __user *previous; | ||
1216 | int count; | ||
1217 | int error; | ||
1218 | }; | ||
1219 | |||
1220 | struct readdir32_callback { | ||
1221 | struct old_linux32_dirent __user * dirent; | ||
1222 | int count; | ||
1223 | }; | ||
1224 | |||
1225 | static int | ||
1226 | filldir32 (void *__buf, const char *name, int namlen, loff_t offset, u64 ino, | ||
1227 | unsigned int d_type) | ||
1228 | { | ||
1229 | struct compat_dirent __user * dirent; | ||
1230 | struct getdents32_callback * buf = (struct getdents32_callback *) __buf; | ||
1231 | int reclen = ROUND_UP(offsetof(struct compat_dirent, d_name) + namlen + 1, 4); | ||
1232 | u32 d_ino; | ||
1233 | |||
1234 | buf->error = -EINVAL; /* only used if we fail.. */ | ||
1235 | if (reclen > buf->count) | ||
1236 | return -EINVAL; | ||
1237 | d_ino = ino; | ||
1238 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) | ||
1239 | return -EOVERFLOW; | ||
1240 | buf->error = -EFAULT; /* only used if we fail.. */ | ||
1241 | dirent = buf->previous; | ||
1242 | if (dirent) | ||
1243 | if (put_user(offset, &dirent->d_off)) | ||
1244 | return -EFAULT; | ||
1245 | dirent = buf->current_dir; | ||
1246 | buf->previous = dirent; | ||
1247 | if (put_user(d_ino, &dirent->d_ino) | ||
1248 | || put_user(reclen, &dirent->d_reclen) | ||
1249 | || copy_to_user(dirent->d_name, name, namlen) | ||
1250 | || put_user(0, dirent->d_name + namlen)) | ||
1251 | return -EFAULT; | ||
1252 | dirent = (struct compat_dirent __user *) ((char __user *) dirent + reclen); | ||
1253 | buf->current_dir = dirent; | ||
1254 | buf->count -= reclen; | ||
1255 | return 0; | ||
1256 | } | ||
1257 | |||
1258 | asmlinkage long | ||
1259 | sys32_getdents (unsigned int fd, struct compat_dirent __user *dirent, unsigned int count) | ||
1260 | { | ||
1261 | struct file * file; | ||
1262 | struct compat_dirent __user * lastdirent; | ||
1263 | struct getdents32_callback buf; | ||
1264 | int error; | ||
1265 | |||
1266 | error = -EFAULT; | ||
1267 | if (!access_ok(VERIFY_WRITE, dirent, count)) | ||
1268 | goto out; | ||
1269 | |||
1270 | error = -EBADF; | ||
1271 | file = fget(fd); | ||
1272 | if (!file) | ||
1273 | goto out; | ||
1274 | |||
1275 | buf.current_dir = dirent; | ||
1276 | buf.previous = NULL; | ||
1277 | buf.count = count; | ||
1278 | buf.error = 0; | ||
1279 | |||
1280 | error = vfs_readdir(file, filldir32, &buf); | ||
1281 | if (error < 0) | ||
1282 | goto out_putf; | ||
1283 | error = buf.error; | ||
1284 | lastdirent = buf.previous; | ||
1285 | if (lastdirent) { | ||
1286 | if (put_user(file->f_pos, &lastdirent->d_off)) | ||
1287 | error = -EFAULT; | ||
1288 | else | ||
1289 | error = count - buf.count; | ||
1290 | } | ||
1291 | |||
1292 | out_putf: | ||
1293 | fput(file); | ||
1294 | out: | ||
1295 | return error; | ||
1296 | } | ||
1297 | |||
1298 | static int | ||
1299 | fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, u64 ino, | ||
1300 | unsigned int d_type) | ||
1301 | { | ||
1302 | struct readdir32_callback * buf = (struct readdir32_callback *) __buf; | ||
1303 | struct old_linux32_dirent __user * dirent; | ||
1304 | u32 d_ino; | ||
1305 | |||
1306 | if (buf->count) | ||
1307 | return -EINVAL; | ||
1308 | d_ino = ino; | ||
1309 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) | ||
1310 | return -EOVERFLOW; | ||
1311 | buf->count++; | ||
1312 | dirent = buf->dirent; | ||
1313 | if (put_user(d_ino, &dirent->d_ino) | ||
1314 | || put_user(offset, &dirent->d_offset) | ||
1315 | || put_user(namlen, &dirent->d_namlen) | ||
1316 | || copy_to_user(dirent->d_name, name, namlen) | ||
1317 | || put_user(0, dirent->d_name + namlen)) | ||
1318 | return -EFAULT; | ||
1319 | return 0; | ||
1320 | } | ||
1321 | |||
1322 | asmlinkage long | ||
1323 | sys32_readdir (unsigned int fd, void __user *dirent, unsigned int count) | ||
1324 | { | ||
1325 | int error; | ||
1326 | struct file * file; | ||
1327 | struct readdir32_callback buf; | ||
1328 | |||
1329 | error = -EBADF; | ||
1330 | file = fget(fd); | ||
1331 | if (!file) | ||
1332 | goto out; | ||
1333 | |||
1334 | buf.count = 0; | ||
1335 | buf.dirent = dirent; | ||
1336 | |||
1337 | error = vfs_readdir(file, fillonedir32, &buf); | ||
1338 | if (error >= 0) | ||
1339 | error = buf.count; | ||
1340 | fput(file); | ||
1341 | out: | ||
1342 | return error; | ||
1343 | } | ||
1344 | |||
1345 | struct sel_arg_struct { | 1213 | struct sel_arg_struct { |
1346 | unsigned int n; | 1214 | unsigned int n; |
1347 | unsigned int inp; | 1215 | unsigned int inp; |