fs.h 981 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef __API_FS__
  2. #define __API_FS__
  3. #include <stdbool.h>
  4. #include <unistd.h>
  5. /*
  6. * On most systems <limits.h> would have given us this, but not on some systems
  7. * (e.g. GNU/Hurd).
  8. */
  9. #ifndef PATH_MAX
  10. #define PATH_MAX 4096
  11. #endif
  12. #define FS(name) \
  13. const char *name##__mountpoint(void); \
  14. const char *name##__mount(void); \
  15. bool name##__configured(void); \
  16. FS(sysfs)
  17. FS(procfs)
  18. FS(debugfs)
  19. FS(tracefs)
  20. FS(hugetlbfs)
  21. #undef FS
  22. int filename__read_int(const char *filename, int *value);
  23. int filename__read_ull(const char *filename, unsigned long long *value);
  24. int filename__read_str(const char *filename, char **buf, size_t *sizep);
  25. int procfs__read_str(const char *entry, char **buf, size_t *sizep);
  26. int sysctl__read_int(const char *sysctl, int *value);
  27. int sysfs__read_int(const char *entry, int *value);
  28. int sysfs__read_ull(const char *entry, unsigned long long *value);
  29. int sysfs__read_str(const char *entry, char **buf, size_t *sizep);
  30. #endif /* __API_FS__ */