1 #ifndef _INPUT_COMPAT_H
2 #define _INPUT_COMPAT_H
5 * 32bit compatibility wrappers for the input subsystem.
7 * Very heavily based on evdev.c - Copyright (c) 1999-2002 Vojtech Pavlik
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.
14 #include <linux/compiler.h>
15 #include <linux/compat.h>
16 #include <linux/input.h>
20 /* Note to the author of this code: did it ever occur to
21 you why the ifdefs are needed? Think about it again. -AK */
22 #if defined(CONFIG_X86_64) || defined(CONFIG_TILE)
23 # define INPUT_COMPAT_TEST is_compat_task()
24 #elif defined(CONFIG_S390)
25 # define INPUT_COMPAT_TEST test_thread_flag(TIF_31BIT)
26 #elif defined(CONFIG_MIPS)
27 # define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT_ADDR)
29 # define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT)
32 struct input_event_compat
{
33 struct compat_timeval time
;
39 struct ff_periodic_effect_compat
{
46 struct ff_envelope envelope
;
49 compat_uptr_t custom_data
;
52 struct ff_effect_compat
{
56 struct ff_trigger trigger
;
57 struct ff_replay replay
;
60 struct ff_constant_effect constant
;
61 struct ff_ramp_effect ramp
;
62 struct ff_periodic_effect_compat periodic
;
63 struct ff_condition_effect condition
[2]; /* One for each axis */
64 struct ff_rumble_effect rumble
;
68 static inline size_t input_event_size(void)
70 return INPUT_COMPAT_TEST
?
71 sizeof(struct input_event_compat
) : sizeof(struct input_event
);
76 static inline size_t input_event_size(void)
78 return sizeof(struct input_event
);
81 #endif /* CONFIG_COMPAT */
83 int input_event_from_user(const char __user
*buffer
,
84 struct input_event
*event
);
86 int input_event_to_user(char __user
*buffer
,
87 const struct input_event
*event
);
89 int input_ff_effect_from_user(const char __user
*buffer
, size_t size
,
90 struct ff_effect
*effect
);
92 #endif /* _INPUT_COMPAT_H */