stat_x86.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _ASM_X86_STAT_H
  3. #define _ASM_X86_STAT_H
  4. #include <asm/posix_types.h>
  5. #define STAT_HAVE_NSEC 1
  6. #ifdef __i386__
  7. struct stat {
  8. unsigned long st_dev;
  9. unsigned long st_ino;
  10. unsigned short st_mode;
  11. unsigned short st_nlink;
  12. unsigned short st_uid;
  13. unsigned short st_gid;
  14. unsigned long st_rdev;
  15. unsigned long st_size;
  16. unsigned long st_blksize;
  17. unsigned long st_blocks;
  18. unsigned long st_atime;
  19. unsigned long st_atime_nsec;
  20. unsigned long st_mtime;
  21. unsigned long st_mtime_nsec;
  22. unsigned long st_ctime;
  23. unsigned long st_ctime_nsec;
  24. unsigned long __unused4;
  25. unsigned long __unused5;
  26. };
  27. /* We don't need to memset the whole thing just to initialize the padding */
  28. #define INIT_STRUCT_STAT_PADDING(st) do { \
  29. st.__unused4 = 0; \
  30. st.__unused5 = 0; \
  31. } while (0)
  32. #define STAT64_HAS_BROKEN_ST_INO 1
  33. /* This matches struct stat64 in glibc2.1, hence the absolutely
  34. * insane amounts of padding around dev_t's.
  35. */
  36. struct stat64 {
  37. unsigned long long st_dev;
  38. unsigned char __pad0[4];
  39. unsigned long __st_ino;
  40. unsigned int st_mode;
  41. unsigned int st_nlink;
  42. unsigned long st_uid;
  43. unsigned long st_gid;
  44. unsigned long long st_rdev;
  45. unsigned char __pad3[4];
  46. long long st_size;
  47. unsigned long st_blksize;
  48. /* Number 512-byte blocks allocated. */
  49. unsigned long long st_blocks;
  50. unsigned long st_atime;
  51. unsigned long st_atime_nsec;
  52. unsigned long st_mtime;
  53. unsigned int st_mtime_nsec;
  54. unsigned long st_ctime;
  55. unsigned long st_ctime_nsec;
  56. unsigned long long st_ino;
  57. };
  58. /* We don't need to memset the whole thing just to initialize the padding */
  59. #define INIT_STRUCT_STAT64_PADDING(st) do { \
  60. memset(&st.__pad0, 0, sizeof(st.__pad0)); \
  61. memset(&st.__pad3, 0, sizeof(st.__pad3)); \
  62. } while (0)
  63. #else /* __i386__ */
  64. struct stat {
  65. __kernel_ulong_t st_dev;
  66. __kernel_ulong_t st_ino;
  67. __kernel_ulong_t st_nlink;
  68. unsigned int st_mode;
  69. unsigned int st_uid;
  70. unsigned int st_gid;
  71. unsigned int __pad0;
  72. __kernel_ulong_t st_rdev;
  73. __kernel_long_t st_size;
  74. __kernel_long_t st_blksize;
  75. __kernel_long_t st_blocks; /* Number 512-byte blocks allocated. */
  76. __kernel_ulong_t st_atime;
  77. __kernel_ulong_t st_atime_nsec;
  78. __kernel_ulong_t st_mtime;
  79. __kernel_ulong_t st_mtime_nsec;
  80. __kernel_ulong_t st_ctime;
  81. __kernel_ulong_t st_ctime_nsec;
  82. __kernel_long_t __unused[3];
  83. };
  84. /* We don't need to memset the whole thing just to initialize the padding */
  85. #define INIT_STRUCT_STAT_PADDING(st) do { \
  86. st.__pad0 = 0; \
  87. st.__unused[0] = 0; \
  88. st.__unused[1] = 0; \
  89. st.__unused[2] = 0; \
  90. } while (0)
  91. #endif
  92. /* for 32bit emulation and 32 bit kernels */
  93. struct __old_kernel_stat {
  94. unsigned short st_dev;
  95. unsigned short st_ino;
  96. unsigned short st_mode;
  97. unsigned short st_nlink;
  98. unsigned short st_uid;
  99. unsigned short st_gid;
  100. unsigned short st_rdev;
  101. #ifdef __i386__
  102. unsigned long st_size;
  103. unsigned long st_atime;
  104. unsigned long st_mtime;
  105. unsigned long st_ctime;
  106. #else
  107. unsigned int st_size;
  108. unsigned int st_atime;
  109. unsigned int st_mtime;
  110. unsigned int st_ctime;
  111. #endif
  112. };
  113. #endif /* _ASM_X86_STAT_H */