1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

mountpoint-util: add small helper that checks if a path is below the API VFS hierarchies

This commit is contained in:
Lennart Poettering 2024-02-05 15:38:20 +01:00
parent b63e3bd308
commit 0fb08bd5e3
3 changed files with 10 additions and 1 deletions

View File

@ -785,3 +785,10 @@ int mount_option_supported(const char *fstype, const char *key, const char *valu
return true; /* works! */
}
bool path_below_api_vfs(const char *p) {
assert(p);
/* API VFS are either directly mounted on any of these three paths, or below it. */
return PATH_STARTSWITH_SET(p, "/dev", "/sys", "/proc");
}

View File

@ -69,3 +69,5 @@ bool mount_new_api_supported(void);
unsigned long ms_nosymfollow_supported(void);
int mount_option_supported(const char *fstype, const char *key, const char *value);
bool path_below_api_vfs(const char *p);

View File

@ -95,7 +95,7 @@ int mount_points_list_get(const char *mountinfo, MountPoint **head) {
* we might lack the rights to unmount these things, hence don't bother. */
if (mount_point_is_api(path) ||
mount_point_ignore(path) ||
PATH_STARTSWITH_SET(path, "/dev", "/sys", "/proc"))
path_below_api_vfs(path))
continue;
is_api_vfs = fstype_is_api_vfs(fstype);