diff options
author | Kevin Cernekee <kpc.mtd@gmail.com> | 2009-04-09 01:53:13 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-05-29 10:24:48 -0400 |
commit | 977185404046afb31d2e18fac0a076de1a20bf0e (patch) | |
tree | 4b0cd9a27748549126c52dbf0af6f4c3c89224df /fs | |
parent | 0dc54e9f33e2fbcea28356bc2c8c931cb307d3b3 (diff) |
mtd: compat_ioctl cleanup
1) Move the MEMREADOOB/MEMWRITEOOB compat_ioctl wrappers from
fs/compat_ioctl.c into mtdchar.c . Original request was here:
http://lkml.org/lkml/2009/4/1/295
2) Add missing COMPATIBLE_IOCTL lines, so that mtd-utils does not error
out when running in 64/32 compatibility mode.
LKML-Reference: <200904011650.22928.arnd@arndb.de>
Signed-off-by: Kevin Cernekee <kpc.mtd@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/compat_ioctl.c | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index c603ca2c223a..196397bff086 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -1411,46 +1411,6 @@ static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
1411 | #define HIDPGETCONNLIST _IOR('H', 210, int) | 1411 | #define HIDPGETCONNLIST _IOR('H', 210, int) |
1412 | #define HIDPGETCONNINFO _IOR('H', 211, int) | 1412 | #define HIDPGETCONNINFO _IOR('H', 211, int) |
1413 | 1413 | ||
1414 | struct mtd_oob_buf32 { | ||
1415 | u_int32_t start; | ||
1416 | u_int32_t length; | ||
1417 | compat_caddr_t ptr; /* unsigned char* */ | ||
1418 | }; | ||
1419 | |||
1420 | #define MEMWRITEOOB32 _IOWR('M',3,struct mtd_oob_buf32) | ||
1421 | #define MEMREADOOB32 _IOWR('M',4,struct mtd_oob_buf32) | ||
1422 | |||
1423 | static int mtd_rw_oob(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1424 | { | ||
1425 | struct mtd_oob_buf __user *buf = compat_alloc_user_space(sizeof(*buf)); | ||
1426 | struct mtd_oob_buf32 __user *buf32 = compat_ptr(arg); | ||
1427 | u32 data; | ||
1428 | char __user *datap; | ||
1429 | unsigned int real_cmd; | ||
1430 | int err; | ||
1431 | |||
1432 | real_cmd = (cmd == MEMREADOOB32) ? | ||
1433 | MEMREADOOB : MEMWRITEOOB; | ||
1434 | |||
1435 | if (copy_in_user(&buf->start, &buf32->start, | ||
1436 | 2 * sizeof(u32)) || | ||
1437 | get_user(data, &buf32->ptr)) | ||
1438 | return -EFAULT; | ||
1439 | datap = compat_ptr(data); | ||
1440 | if (put_user(datap, &buf->ptr)) | ||
1441 | return -EFAULT; | ||
1442 | |||
1443 | err = sys_ioctl(fd, real_cmd, (unsigned long) buf); | ||
1444 | |||
1445 | if (!err) { | ||
1446 | if (copy_in_user(&buf32->start, &buf->start, | ||
1447 | 2 * sizeof(u32))) | ||
1448 | err = -EFAULT; | ||
1449 | } | ||
1450 | |||
1451 | return err; | ||
1452 | } | ||
1453 | |||
1454 | #ifdef CONFIG_BLOCK | 1414 | #ifdef CONFIG_BLOCK |
1455 | struct raw32_config_request | 1415 | struct raw32_config_request |
1456 | { | 1416 | { |
@@ -2439,8 +2399,17 @@ COMPATIBLE_IOCTL(MEMLOCK) | |||
2439 | COMPATIBLE_IOCTL(MEMUNLOCK) | 2399 | COMPATIBLE_IOCTL(MEMUNLOCK) |
2440 | COMPATIBLE_IOCTL(MEMGETREGIONCOUNT) | 2400 | COMPATIBLE_IOCTL(MEMGETREGIONCOUNT) |
2441 | COMPATIBLE_IOCTL(MEMGETREGIONINFO) | 2401 | COMPATIBLE_IOCTL(MEMGETREGIONINFO) |
2402 | COMPATIBLE_IOCTL(MEMSETOOBSEL) | ||
2403 | COMPATIBLE_IOCTL(MEMGETOOBSEL) | ||
2442 | COMPATIBLE_IOCTL(MEMGETBADBLOCK) | 2404 | COMPATIBLE_IOCTL(MEMGETBADBLOCK) |
2443 | COMPATIBLE_IOCTL(MEMSETBADBLOCK) | 2405 | COMPATIBLE_IOCTL(MEMSETBADBLOCK) |
2406 | COMPATIBLE_IOCTL(OTPSELECT) | ||
2407 | COMPATIBLE_IOCTL(OTPGETREGIONCOUNT) | ||
2408 | COMPATIBLE_IOCTL(OTPGETREGIONINFO) | ||
2409 | COMPATIBLE_IOCTL(OTPLOCK) | ||
2410 | COMPATIBLE_IOCTL(ECCGETLAYOUT) | ||
2411 | COMPATIBLE_IOCTL(ECCGETSTATS) | ||
2412 | COMPATIBLE_IOCTL(MTDFILEMODE) | ||
2444 | COMPATIBLE_IOCTL(MEMERASE64) | 2413 | COMPATIBLE_IOCTL(MEMERASE64) |
2445 | /* NBD */ | 2414 | /* NBD */ |
2446 | ULONG_IOCTL(NBD_SET_SOCK) | 2415 | ULONG_IOCTL(NBD_SET_SOCK) |
@@ -2551,8 +2520,6 @@ COMPATIBLE_IOCTL(JSIOCGBUTTONS) | |||
2551 | COMPATIBLE_IOCTL(JSIOCGNAME(0)) | 2520 | COMPATIBLE_IOCTL(JSIOCGNAME(0)) |
2552 | 2521 | ||
2553 | /* now things that need handlers */ | 2522 | /* now things that need handlers */ |
2554 | HANDLE_IOCTL(MEMREADOOB32, mtd_rw_oob) | ||
2555 | HANDLE_IOCTL(MEMWRITEOOB32, mtd_rw_oob) | ||
2556 | #ifdef CONFIG_NET | 2523 | #ifdef CONFIG_NET |
2557 | HANDLE_IOCTL(SIOCGIFNAME, dev_ifname32) | 2524 | HANDLE_IOCTL(SIOCGIFNAME, dev_ifname32) |
2558 | HANDLE_IOCTL(SIOCGIFCONF, dev_ifconf) | 2525 | HANDLE_IOCTL(SIOCGIFCONF, dev_ifconf) |