ia32_ioctl.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #include <linux/signal.h> /* argh, msdos_fs.h isn't self-contained... */
  10. #include <linux/syscalls.h>
  11. #include "ia32priv.h"
  12. #define INCLUDES
  13. #include "compat_ioctl.c"
  14. #define IOCTL_NR(a) ((a) & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT))
  15. #define DO_IOCTL(fd, cmd, arg) ({ \
  16. int _ret; \
  17. mm_segment_t _old_fs = get_fs(); \
  18. \
  19. set_fs(KERNEL_DS); \
  20. _ret = sys_ioctl(fd, cmd, (unsigned long)arg); \
  21. set_fs(_old_fs); \
  22. _ret; \
  23. })
  24. #define CODE
  25. #include "compat_ioctl.c"
  26. #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl)
  27. #define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL },
  28. #define IOCTL_TABLE_START \
  29. struct ioctl_trans ioctl_start[] = {
  30. #define IOCTL_TABLE_END \
  31. };
  32. IOCTL_TABLE_START
  33. #define DECLARES
  34. #include "compat_ioctl.c"
  35. #include <linux/compat_ioctl.h>
  36. IOCTL_TABLE_END
  37. int ioctl_table_size = ARRAY_SIZE(ioctl_start);