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