compat.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_POWERPC_COMPAT_H
  3. #define _ASM_POWERPC_COMPAT_H
  4. #ifdef __KERNEL__
  5. /*
  6. * Architecture specific compatibility types
  7. */
  8. #include <linux/types.h>
  9. #include <linux/sched.h>
  10. #define compat_ipc_pid_t compat_ipc_pid_t
  11. typedef u16 compat_ipc_pid_t;
  12. #define compat_ipc64_perm compat_ipc64_perm
  13. #include <asm-generic/compat.h>
  14. #ifdef __BIG_ENDIAN__
  15. #define COMPAT_UTS_MACHINE "ppc\0\0"
  16. #else
  17. #define COMPAT_UTS_MACHINE "ppcle\0\0"
  18. #endif
  19. typedef s16 compat_nlink_t;
  20. struct compat_stat {
  21. compat_dev_t st_dev;
  22. compat_ino_t st_ino;
  23. compat_mode_t st_mode;
  24. compat_nlink_t st_nlink;
  25. __compat_uid32_t st_uid;
  26. __compat_gid32_t st_gid;
  27. compat_dev_t st_rdev;
  28. compat_off_t st_size;
  29. compat_off_t st_blksize;
  30. compat_off_t st_blocks;
  31. old_time32_t st_atime;
  32. u32 st_atime_nsec;
  33. old_time32_t st_mtime;
  34. u32 st_mtime_nsec;
  35. old_time32_t st_ctime;
  36. u32 st_ctime_nsec;
  37. u32 __unused4[2];
  38. };
  39. /*
  40. * ipc64_perm is actually 32/64bit clean but since the compat layer refers to
  41. * it we may as well define it.
  42. */
  43. struct compat_ipc64_perm {
  44. compat_key_t key;
  45. __compat_uid_t uid;
  46. __compat_gid_t gid;
  47. __compat_uid_t cuid;
  48. __compat_gid_t cgid;
  49. compat_mode_t mode;
  50. unsigned int seq;
  51. unsigned int __pad2;
  52. unsigned long __unused1; /* yes they really are 64bit pads */
  53. unsigned long __unused2;
  54. };
  55. struct compat_semid64_ds {
  56. struct compat_ipc64_perm sem_perm;
  57. unsigned int sem_otime_high;
  58. unsigned int sem_otime;
  59. unsigned int sem_ctime_high;
  60. unsigned int sem_ctime;
  61. compat_ulong_t sem_nsems;
  62. compat_ulong_t __unused3;
  63. compat_ulong_t __unused4;
  64. };
  65. struct compat_msqid64_ds {
  66. struct compat_ipc64_perm msg_perm;
  67. unsigned int msg_stime_high;
  68. unsigned int msg_stime;
  69. unsigned int msg_rtime_high;
  70. unsigned int msg_rtime;
  71. unsigned int msg_ctime_high;
  72. unsigned int msg_ctime;
  73. compat_ulong_t msg_cbytes;
  74. compat_ulong_t msg_qnum;
  75. compat_ulong_t msg_qbytes;
  76. compat_pid_t msg_lspid;
  77. compat_pid_t msg_lrpid;
  78. compat_ulong_t __unused4;
  79. compat_ulong_t __unused5;
  80. };
  81. struct compat_shmid64_ds {
  82. struct compat_ipc64_perm shm_perm;
  83. unsigned int shm_atime_high;
  84. unsigned int shm_atime;
  85. unsigned int shm_dtime_high;
  86. unsigned int shm_dtime;
  87. unsigned int shm_ctime_high;
  88. unsigned int shm_ctime;
  89. unsigned int __unused4;
  90. compat_size_t shm_segsz;
  91. compat_pid_t shm_cpid;
  92. compat_pid_t shm_lpid;
  93. compat_ulong_t shm_nattch;
  94. compat_ulong_t __unused5;
  95. compat_ulong_t __unused6;
  96. };
  97. static inline int is_compat_task(void)
  98. {
  99. return is_32bit_task();
  100. }
  101. #endif /* __KERNEL__ */
  102. #endif /* _ASM_POWERPC_COMPAT_H */