aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKevin Cernekee <kpc.mtd@gmail.com>2009-04-09 01:53:13 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-05-29 10:24:48 -0400
commit977185404046afb31d2e18fac0a076de1a20bf0e (patch)
tree4b0cd9a27748549126c52dbf0af6f4c3c89224df /fs
parent0dc54e9f33e2fbcea28356bc2c8c931cb307d3b3 (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.c51
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
1414struct 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
1423static 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
1455struct raw32_config_request 1415struct raw32_config_request
1456{ 1416{
@@ -2439,8 +2399,17 @@ COMPATIBLE_IOCTL(MEMLOCK)
2439COMPATIBLE_IOCTL(MEMUNLOCK) 2399COMPATIBLE_IOCTL(MEMUNLOCK)
2440COMPATIBLE_IOCTL(MEMGETREGIONCOUNT) 2400COMPATIBLE_IOCTL(MEMGETREGIONCOUNT)
2441COMPATIBLE_IOCTL(MEMGETREGIONINFO) 2401COMPATIBLE_IOCTL(MEMGETREGIONINFO)
2402COMPATIBLE_IOCTL(MEMSETOOBSEL)
2403COMPATIBLE_IOCTL(MEMGETOOBSEL)
2442COMPATIBLE_IOCTL(MEMGETBADBLOCK) 2404COMPATIBLE_IOCTL(MEMGETBADBLOCK)
2443COMPATIBLE_IOCTL(MEMSETBADBLOCK) 2405COMPATIBLE_IOCTL(MEMSETBADBLOCK)
2406COMPATIBLE_IOCTL(OTPSELECT)
2407COMPATIBLE_IOCTL(OTPGETREGIONCOUNT)
2408COMPATIBLE_IOCTL(OTPGETREGIONINFO)
2409COMPATIBLE_IOCTL(OTPLOCK)
2410COMPATIBLE_IOCTL(ECCGETLAYOUT)
2411COMPATIBLE_IOCTL(ECCGETSTATS)
2412COMPATIBLE_IOCTL(MTDFILEMODE)
2444COMPATIBLE_IOCTL(MEMERASE64) 2413COMPATIBLE_IOCTL(MEMERASE64)
2445/* NBD */ 2414/* NBD */
2446ULONG_IOCTL(NBD_SET_SOCK) 2415ULONG_IOCTL(NBD_SET_SOCK)
@@ -2551,8 +2520,6 @@ COMPATIBLE_IOCTL(JSIOCGBUTTONS)
2551COMPATIBLE_IOCTL(JSIOCGNAME(0)) 2520COMPATIBLE_IOCTL(JSIOCGNAME(0))
2552 2521
2553/* now things that need handlers */ 2522/* now things that need handlers */
2554HANDLE_IOCTL(MEMREADOOB32, mtd_rw_oob)
2555HANDLE_IOCTL(MEMWRITEOOB32, mtd_rw_oob)
2556#ifdef CONFIG_NET 2523#ifdef CONFIG_NET
2557HANDLE_IOCTL(SIOCGIFNAME, dev_ifname32) 2524HANDLE_IOCTL(SIOCGIFNAME, dev_ifname32)
2558HANDLE_IOCTL(SIOCGIFCONF, dev_ifconf) 2525HANDLE_IOCTL(SIOCGIFCONF, dev_ifconf)