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 */
 
  23 #  define INPUT_COMPAT_TEST is_compat_task()
 
  24 #elif defined(CONFIG_IA64)
 
  25 #  define INPUT_COMPAT_TEST IS_IA32_PROCESS(task_pt_regs(current))
 
  26 #elif defined(CONFIG_S390)
 
  27 #  define INPUT_COMPAT_TEST test_thread_flag(TIF_31BIT)
 
  28 #elif defined(CONFIG_MIPS)
 
  29 #  define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT_ADDR)
 
  31 #  define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT)
 
  34 struct input_event_compat {
 
  35         struct compat_timeval time;
 
  41 struct ff_periodic_effect_compat {
 
  48         struct ff_envelope envelope;
 
  51         compat_uptr_t custom_data;
 
  54 struct ff_effect_compat {
 
  58         struct ff_trigger trigger;
 
  59         struct ff_replay replay;
 
  62                 struct ff_constant_effect constant;
 
  63                 struct ff_ramp_effect ramp;
 
  64                 struct ff_periodic_effect_compat periodic;
 
  65                 struct ff_condition_effect condition[2]; /* One for each axis */
 
  66                 struct ff_rumble_effect rumble;
 
  70 static inline size_t input_event_size(void)
 
  72         return INPUT_COMPAT_TEST ?
 
  73                 sizeof(struct input_event_compat) : sizeof(struct input_event);
 
  78 static inline size_t input_event_size(void)
 
  80         return sizeof(struct input_event);
 
  83 #endif /* CONFIG_COMPAT */
 
  85 int input_event_from_user(const char __user *buffer,
 
  86                          struct input_event *event);
 
  88 int input_event_to_user(char __user *buffer,
 
  89                         const struct input_event *event);
 
  91 int input_ff_effect_from_user(const char __user *buffer, size_t size,
 
  92                               struct ff_effect *effect);
 
  94 #endif /* _INPUT_COMPAT_H */