Linux-2.6.12-rc2
[pandora-kernel.git] / arch / ia64 / ia32 / ia32_ioctl.c
1 /*
2  * IA32 Architecture-specific ioctl shim code
3  *
4  * Copyright (C) 2000 VA Linux Co
5  * Copyright (C) 2000 Don Dugger <n0ano@valinux.com>
6  * Copyright (C) 2001-2003 Hewlett-Packard Co
7  *      David Mosberger-Tang <davidm@hpl.hp.com>
8  */
9
10 #include <linux/signal.h>       /* argh, msdos_fs.h isn't self-contained... */
11 #include <linux/syscalls.h>
12 #include "ia32priv.h"
13   
14 #define INCLUDES
15 #include "compat_ioctl.c"
16 #include <asm/ioctl32.h>
17
18 #define IOCTL_NR(a)     ((a) & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT))
19
20 #define DO_IOCTL(fd, cmd, arg) ({                       \
21         int _ret;                                       \
22         mm_segment_t _old_fs = get_fs();                \
23                                                         \
24         set_fs(KERNEL_DS);                              \
25         _ret = sys_ioctl(fd, cmd, (unsigned long)arg);  \
26         set_fs(_old_fs);                                \
27         _ret;                                           \
28 })
29
30 #define CODE
31 #include "compat_ioctl.c"
32
33 typedef int (* ioctl32_handler_t)(unsigned int, unsigned int, unsigned long, struct file *);
34
35 #define COMPATIBLE_IOCTL(cmd)           HANDLE_IOCTL((cmd),sys_ioctl)
36 #define HANDLE_IOCTL(cmd,handler)       { (cmd), (ioctl32_handler_t)(handler), NULL },
37 #define IOCTL_TABLE_START \
38         struct ioctl_trans ioctl_start[] = {
39 #define IOCTL_TABLE_END \
40         };
41
42 IOCTL_TABLE_START
43 #define DECLARES
44 #include "compat_ioctl.c"
45 #include <linux/compat_ioctl.h>
46 IOCTL_TABLE_END
47
48 int ioctl_table_size = ARRAY_SIZE(ioctl_start);