diff options
author | Christoph Hellwig <hch@lst.de> | 2006-01-09 23:52:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 11:01:32 -0500 |
commit | ec3cad96901373ad0e21611cfbcc372fe09df1f7 (patch) | |
tree | 4c4fff817b9e88fe3fd015382913944fe2d946d8 /fs/compat_ioctl.c | |
parent | 3a0f69d59ba41fbcad6a17b6e8aab02bf45e20ce (diff) |
[PATCH] move rtc compat ioctl handling to fs/compat_ioctl.c
This patch implements generic handling of RTC_IRQP_READ32, RTC_IRQP_SET32,
RTC_EPOCH_READ32 and RTC_EPOCH_SET32 in fs/compat_ioctl.c. It's based on the
x86_64 code which needed a little massaging to be endian-clean.
parisc used COMPAT_IOCTL or generic w_long handlers for these whichce is wrong
and can't work because the ioctls encode sizeof(unsigned long) in their ioctl
number. parisc also duplicated COMPAT_IOCTL entries for other rtc ioctls
which I remove in this patch, too.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Matthew Wilcox <matthew@wil.cx>
Acked-by: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r-- | fs/compat_ioctl.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 55d9a3a954cf..b9aeacc11c8f 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -2475,6 +2475,49 @@ static int old_bridge_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg | |||
2475 | return -EINVAL; | 2475 | return -EINVAL; |
2476 | } | 2476 | } |
2477 | 2477 | ||
2478 | #define RTC_IRQP_READ32 _IOR('p', 0x0b, compat_ulong_t) | ||
2479 | #define RTC_IRQP_SET32 _IOW('p', 0x0c, compat_ulong_t) | ||
2480 | #define RTC_EPOCH_READ32 _IOR('p', 0x0d, compat_ulong_t) | ||
2481 | #define RTC_EPOCH_SET32 _IOW('p', 0x0e, compat_ulong_t) | ||
2482 | |||
2483 | static int rtc_ioctl(unsigned fd, unsigned cmd, unsigned long arg) | ||
2484 | { | ||
2485 | mm_segment_t oldfs = get_fs(); | ||
2486 | compat_ulong_t val32; | ||
2487 | unsigned long kval; | ||
2488 | int ret; | ||
2489 | |||
2490 | switch (cmd) { | ||
2491 | case RTC_IRQP_READ32: | ||
2492 | case RTC_EPOCH_READ32: | ||
2493 | set_fs(KERNEL_DS); | ||
2494 | ret = sys_ioctl(fd, (cmd == RTC_IRQP_READ32) ? | ||
2495 | RTC_IRQP_READ : RTC_EPOCH_READ, | ||
2496 | (unsigned long)&kval); | ||
2497 | set_fs(oldfs); | ||
2498 | if (ret) | ||
2499 | return ret; | ||
2500 | val32 = kval; | ||
2501 | return put_user(val32, (unsigned int __user *)arg); | ||
2502 | case RTC_IRQP_SET32: | ||
2503 | case RTC_EPOCH_SET32: | ||
2504 | ret = get_user(val32, (unsigned int __user *)arg); | ||
2505 | if (ret) | ||
2506 | return ret; | ||
2507 | kval = val32; | ||
2508 | |||
2509 | set_fs(KERNEL_DS); | ||
2510 | ret = sys_ioctl(fd, (cmd == RTC_IRQP_SET32) ? | ||
2511 | RTC_IRQP_SET : RTC_EPOCH_SET, | ||
2512 | (unsigned long)&kval); | ||
2513 | set_fs(oldfs); | ||
2514 | return ret; | ||
2515 | default: | ||
2516 | /* unreached */ | ||
2517 | return -ENOIOCTLCMD; | ||
2518 | } | ||
2519 | } | ||
2520 | |||
2478 | #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE) | 2521 | #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE) |
2479 | struct ncp_ioctl_request_32 { | 2522 | struct ncp_ioctl_request_32 { |
2480 | u32 function; | 2523 | u32 function; |
@@ -2858,6 +2901,10 @@ HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl) | |||
2858 | HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl) | 2901 | HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl) |
2859 | HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl) | 2902 | HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl) |
2860 | HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl) | 2903 | HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl) |
2904 | HANDLE_IOCTL(RTC_IRQP_READ32, rtc_ioctl) | ||
2905 | HANDLE_IOCTL(RTC_IRQP_SET32, rtc_ioctl) | ||
2906 | HANDLE_IOCTL(RTC_EPOCH_READ32, rtc_ioctl) | ||
2907 | HANDLE_IOCTL(RTC_EPOCH_SET32, rtc_ioctl) | ||
2861 | 2908 | ||
2862 | #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE) | 2909 | #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE) |
2863 | HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest) | 2910 | HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest) |