stat.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef __ASM_GENERIC_STAT_H
  3. #define __ASM_GENERIC_STAT_H
  4. /*
  5. * Everybody gets this wrong and has to stick with it for all
  6. * eternity. Hopefully, this version gets used by new architectures
  7. * so they don't fall into the same traps.
  8. *
  9. * stat64 is copied from powerpc64, with explicit padding added.
  10. * stat is the same structure layout on 64-bit, without the 'long long'
  11. * types.
  12. *
  13. * By convention, 64 bit architectures use the stat interface, while
  14. * 32 bit architectures use the stat64 interface. Note that we don't
  15. * provide an __old_kernel_stat here, which new architecture should
  16. * not have to start with.
  17. */
  18. #include <asm/bitsperlong.h>
  19. #define STAT_HAVE_NSEC 1
  20. struct stat {
  21. unsigned long st_dev; /* Device. */
  22. unsigned long st_ino; /* File serial number. */
  23. unsigned int st_mode; /* File mode. */
  24. unsigned int st_nlink; /* Link count. */
  25. unsigned int st_uid; /* User ID of the file's owner. */
  26. unsigned int st_gid; /* Group ID of the file's group. */
  27. unsigned long st_rdev; /* Device number, if device. */
  28. unsigned long __pad1;
  29. long st_size; /* Size of file, in bytes. */
  30. int st_blksize; /* Optimal block size for I/O. */
  31. int __pad2;
  32. long st_blocks; /* Number 512-byte blocks allocated. */
  33. long st_atime; /* Time of last access. */
  34. unsigned long st_atime_nsec;
  35. long st_mtime; /* Time of last modification. */
  36. unsigned long st_mtime_nsec;
  37. long st_ctime; /* Time of last status change. */
  38. unsigned long st_ctime_nsec;
  39. unsigned int __unused4;
  40. unsigned int __unused5;
  41. };
  42. /* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
  43. #if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64)
  44. struct stat64 {
  45. unsigned long long st_dev; /* Device. */
  46. unsigned long long st_ino; /* File serial number. */
  47. unsigned int st_mode; /* File mode. */
  48. unsigned int st_nlink; /* Link count. */
  49. unsigned int st_uid; /* User ID of the file's owner. */
  50. unsigned int st_gid; /* Group ID of the file's group. */
  51. unsigned long long st_rdev; /* Device number, if device. */
  52. unsigned long long __pad1;
  53. long long st_size; /* Size of file, in bytes. */
  54. int st_blksize; /* Optimal block size for I/O. */
  55. int __pad2;
  56. long long st_blocks; /* Number 512-byte blocks allocated. */
  57. int st_atime; /* Time of last access. */
  58. unsigned int st_atime_nsec;
  59. int st_mtime; /* Time of last modification. */
  60. unsigned int st_mtime_nsec;
  61. int st_ctime; /* Time of last status change. */
  62. unsigned int st_ctime_nsec;
  63. unsigned int __unused4;
  64. unsigned int __unused5;
  65. };
  66. #endif
  67. #endif /* __ASM_GENERIC_STAT_H */