statfs.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  3. *
  4. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  5. */
  6. #ifndef _SYS_STATFS_H
  7. # error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
  8. #endif
  9. #include <endian.h>
  10. #include <bits/align64bit.h>
  11. #include <bits/types.h>
  12. #include <bits/wordsize.h>
  13. /* 64-bit libc uses the kernel's 'struct statfs', accessed via the
  14. statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64'
  15. and accesses it via the statfs64() syscall. All the various
  16. APIs offered by libc use the kernel shape for their struct statfs
  17. structure; the only difference is that 32-bit programs not
  18. using __USE_FILE_OFFSET64 only see the low 32 bits of some
  19. of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */
  20. #if defined __USE_FILE_OFFSET64
  21. # define __field64(type, type64, name) type64 name
  22. #elif __WORDSIZE == 64
  23. # define __field64(type, type64, name) type name
  24. #elif __BYTE_ORDER == __LITTLE_ENDIAN
  25. # define __field64(type, type64, name) \
  26. type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
  27. #else
  28. # define __field64(type, type64, name) \
  29. int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
  30. #endif
  31. struct statfs
  32. {
  33. __SWORD_TYPE f_type;
  34. __SWORD_TYPE f_bsize;
  35. __field64(__fsblkcnt_t, __fsblkcnt64_t, f_blocks);
  36. __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bfree);
  37. __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bavail);
  38. __field64(__fsfilcnt_t, __fsfilcnt64_t, f_files);
  39. __field64(__fsfilcnt_t, __fsfilcnt64_t, f_ffree);
  40. __fsid_t f_fsid;
  41. __SWORD_TYPE f_namelen;
  42. __SWORD_TYPE f_frsize;
  43. __SWORD_TYPE f_flags;
  44. __SWORD_TYPE f_spare[4];
  45. };
  46. #undef __field64
  47. #ifdef __USE_LARGEFILE64
  48. struct statfs64
  49. {
  50. __SWORD_TYPE f_type;
  51. __SWORD_TYPE f_bsize;
  52. __U64_TYPE f_blocks;
  53. __U64_TYPE f_bfree;
  54. __U64_TYPE f_bavail;
  55. __U64_TYPE f_files;
  56. __U64_TYPE f_ffree;
  57. __fsid_t f_fsid;
  58. __SWORD_TYPE f_namelen;
  59. __SWORD_TYPE f_frsize;
  60. __SWORD_TYPE f_flags;
  61. __SWORD_TYPE f_spare[4];
  62. };
  63. #endif
  64. /* Tell code we have these members. */
  65. #define _STATFS_F_NAMELEN
  66. #define _STATFS_F_FRSIZE