input: redefine INPUT_COMPAT_TEST as in_compat_syscall()
[deliverable/linux.git] / drivers / input / input-compat.h
1 #ifndef _INPUT_COMPAT_H
2 #define _INPUT_COMPAT_H
3
4 /*
5 * 32bit compatibility wrappers for the input subsystem.
6 *
7 * Very heavily based on evdev.c - Copyright (c) 1999-2002 Vojtech Pavlik
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published by
11 * the Free Software Foundation.
12 */
13
14 #include <linux/compiler.h>
15 #include <linux/compat.h>
16 #include <linux/input.h>
17
18 #ifdef CONFIG_COMPAT
19
20 #define INPUT_COMPAT_TEST in_compat_syscall()
21
22 struct input_event_compat {
23 struct compat_timeval time;
24 __u16 type;
25 __u16 code;
26 __s32 value;
27 };
28
29 struct ff_periodic_effect_compat {
30 __u16 waveform;
31 __u16 period;
32 __s16 magnitude;
33 __s16 offset;
34 __u16 phase;
35
36 struct ff_envelope envelope;
37
38 __u32 custom_len;
39 compat_uptr_t custom_data;
40 };
41
42 struct ff_effect_compat {
43 __u16 type;
44 __s16 id;
45 __u16 direction;
46 struct ff_trigger trigger;
47 struct ff_replay replay;
48
49 union {
50 struct ff_constant_effect constant;
51 struct ff_ramp_effect ramp;
52 struct ff_periodic_effect_compat periodic;
53 struct ff_condition_effect condition[2]; /* One for each axis */
54 struct ff_rumble_effect rumble;
55 } u;
56 };
57
58 static inline size_t input_event_size(void)
59 {
60 return (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) ?
61 sizeof(struct input_event_compat) : sizeof(struct input_event);
62 }
63
64 #else
65
66 static inline size_t input_event_size(void)
67 {
68 return sizeof(struct input_event);
69 }
70
71 #endif /* CONFIG_COMPAT */
72
73 int input_event_from_user(const char __user *buffer,
74 struct input_event *event);
75
76 int input_event_to_user(char __user *buffer,
77 const struct input_event *event);
78
79 int input_ff_effect_from_user(const char __user *buffer, size_t size,
80 struct ff_effect *effect);
81
82 #endif /* _INPUT_COMPAT_H */
This page took 0.053319 seconds and 5 git commands to generate.