proc_self_mountinfo.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_PROC_SELF_MOUNTINFO_H
  3. #define NETDATA_PROC_SELF_MOUNTINFO_H 1
  4. #define MOUNTINFO_IS_DUMMY 0x00000001
  5. #define MOUNTINFO_IS_REMOTE 0x00000002
  6. #define MOUNTINFO_IS_BIND 0x00000004
  7. #define MOUNTINFO_IS_SAME_DEV 0x00000008
  8. #define MOUNTINFO_NO_STAT 0x00000010
  9. #define MOUNTINFO_NO_SIZE 0x00000020
  10. #define MOUNTINFO_READONLY 0x00000040
  11. #define MOUNTINFO_IS_IN_SYSD_PROTECTED_LIST 0x00000080
  12. struct mountinfo {
  13. long id; // mount ID: unique identifier of the mount (may be reused after umount(2)).
  14. long parentid; // parent ID: ID of parent mount (or of self for the top of the mount tree).
  15. unsigned long major; // major:minor: value of st_dev for files on filesystem (see stat(2)).
  16. unsigned long minor;
  17. char *persistent_id; // a calculated persistent id for the mount point
  18. uint32_t persistent_id_hash;
  19. char *root; // root: root of the mount within the filesystem.
  20. uint32_t root_hash;
  21. char *mount_point; // mount point: mount point relative to the process's root.
  22. uint32_t mount_point_hash;
  23. char *mount_options; // mount options: per-mount options.
  24. int optional_fields_count;
  25. /*
  26. char ***optional_fields; // optional fields: zero or more fields of the form "tag[:value]".
  27. */
  28. char *filesystem; // filesystem type: name of filesystem in the form "type[.subtype]".
  29. uint32_t filesystem_hash;
  30. char *mount_source; // mount source: filesystem-specific information or "none".
  31. uint32_t mount_source_hash;
  32. char *mount_source_name;
  33. uint32_t mount_source_name_hash;
  34. char *super_options; // super options: per-superblock options.
  35. uint32_t flags;
  36. dev_t st_dev; // id of device as given by stat()
  37. struct mountinfo *next;
  38. };
  39. struct mountinfo *mountinfo_find(struct mountinfo *root, unsigned long major, unsigned long minor, char *device);
  40. struct mountinfo *mountinfo_find_by_filesystem_mount_source(struct mountinfo *root, const char *filesystem, const char *mount_source);
  41. struct mountinfo *mountinfo_find_by_filesystem_super_option(struct mountinfo *root, const char *filesystem, const char *super_options);
  42. void mountinfo_free_all(struct mountinfo *mi);
  43. struct mountinfo *mountinfo_read(int do_statvfs);
  44. #endif /* NETDATA_PROC_SELF_MOUNTINFO_H */