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 /arch/x86_64 | |
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 'arch/x86_64')
-rw-r--r-- | arch/x86_64/ia32/ia32_ioctl.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c index e335bd0b637d..e11cc5699352 100644 --- a/arch/x86_64/ia32/ia32_ioctl.c +++ b/arch/x86_64/ia32/ia32_ioctl.c | |||
@@ -16,45 +16,6 @@ | |||
16 | 16 | ||
17 | #define CODE | 17 | #define CODE |
18 | #include "compat_ioctl.c" | 18 | #include "compat_ioctl.c" |
19 | |||
20 | #define RTC_IRQP_READ32 _IOR('p', 0x0b, unsigned int) /* Read IRQ rate */ | ||
21 | #define RTC_IRQP_SET32 _IOW('p', 0x0c, unsigned int) /* Set IRQ rate */ | ||
22 | #define RTC_EPOCH_READ32 _IOR('p', 0x0d, unsigned) /* Read epoch */ | ||
23 | #define RTC_EPOCH_SET32 _IOW('p', 0x0e, unsigned) /* Set epoch */ | ||
24 | |||
25 | static int rtc32_ioctl(unsigned fd, unsigned cmd, unsigned long arg) | ||
26 | { | ||
27 | unsigned long val; | ||
28 | mm_segment_t oldfs = get_fs(); | ||
29 | int ret; | ||
30 | |||
31 | switch (cmd) { | ||
32 | case RTC_IRQP_READ32: | ||
33 | set_fs(KERNEL_DS); | ||
34 | ret = sys_ioctl(fd, RTC_IRQP_READ, (unsigned long)&val); | ||
35 | set_fs(oldfs); | ||
36 | if (!ret) | ||
37 | ret = put_user(val, (unsigned int __user *) arg); | ||
38 | return ret; | ||
39 | |||
40 | case RTC_IRQP_SET32: | ||
41 | cmd = RTC_IRQP_SET; | ||
42 | break; | ||
43 | |||
44 | case RTC_EPOCH_READ32: | ||
45 | set_fs(KERNEL_DS); | ||
46 | ret = sys_ioctl(fd, RTC_EPOCH_READ, (unsigned long) &val); | ||
47 | set_fs(oldfs); | ||
48 | if (!ret) | ||
49 | ret = put_user(val, (unsigned int __user *) arg); | ||
50 | return ret; | ||
51 | |||
52 | case RTC_EPOCH_SET32: | ||
53 | cmd = RTC_EPOCH_SET; | ||
54 | break; | ||
55 | } | ||
56 | return sys_ioctl(fd,cmd,arg); | ||
57 | } | ||
58 | 19 | ||
59 | 20 | ||
60 | #define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler) }, | 21 | #define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler) }, |
@@ -64,14 +25,6 @@ struct ioctl_trans ioctl_start[] = { | |||
64 | #include <linux/compat_ioctl.h> | 25 | #include <linux/compat_ioctl.h> |
65 | #define DECLARES | 26 | #define DECLARES |
66 | #include "compat_ioctl.c" | 27 | #include "compat_ioctl.c" |
67 | |||
68 | /* And these ioctls need translation */ | ||
69 | /* realtime device */ | ||
70 | HANDLE_IOCTL(RTC_IRQP_READ, rtc32_ioctl) | ||
71 | HANDLE_IOCTL(RTC_IRQP_READ32,rtc32_ioctl) | ||
72 | HANDLE_IOCTL(RTC_IRQP_SET32, rtc32_ioctl) | ||
73 | HANDLE_IOCTL(RTC_EPOCH_READ32, rtc32_ioctl) | ||
74 | HANDLE_IOCTL(RTC_EPOCH_SET32, rtc32_ioctl) | ||
75 | /* take care of sizeof(sizeof()) breakage */ | 28 | /* take care of sizeof(sizeof()) breakage */ |
76 | }; | 29 | }; |
77 | 30 | ||