summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/basic/mountpoint-util.c21
-rw-r--r--src/basic/mountpoint-util.h6
-rw-r--r--src/core/automount.c2
-rw-r--r--src/core/exec-credential.c4
-rw-r--r--src/core/import-creds.c2
-rw-r--r--src/core/namespace.c12
-rw-r--r--src/gpt-auto-generator/gpt-auto-generator.c2
-rw-r--r--src/home/user-record-util.c2
-rw-r--r--src/libsystemd/sd-device/test-device-util.c2
-rw-r--r--src/libsystemd/sd-device/test-sd-device-monitor.c2
-rw-r--r--src/libsystemd/sd-device/test-sd-device.c2
-rw-r--r--src/login/user-runtime-dir.c2
-rw-r--r--src/nspawn/nspawn-cgroup.c8
-rw-r--r--src/nspawn/nspawn-mount.c2
-rw-r--r--src/nspawn/nspawn.c8
-rw-r--r--src/partition/growfs.c2
-rw-r--r--src/partition/repart.c4
-rw-r--r--src/shared/condition.c2
-rw-r--r--src/shared/machine-id-setup.c2
-rw-r--r--src/shared/mount-setup.c2
-rw-r--r--src/shared/mount-util.c6
-rw-r--r--src/shared/switch-root.c2
-rw-r--r--src/sysext/sysext.c2
-rw-r--r--src/test/test-mount-util.c4
-rw-r--r--src/test/test-mountpoint-util.c74
-rw-r--r--src/test/test-stat-util.c8
-rw-r--r--src/udev/test-udev-format.c2
-rw-r--r--src/udev/test-udev-spawn.c2
-rw-r--r--src/volatile-root/volatile-root.c2
29 files changed, 97 insertions, 94 deletions
diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
index 0ff1ed6018..8014e91dc5 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -329,34 +329,33 @@ fallback_fstat:
}
/* flags can be AT_SYMLINK_FOLLOW or 0 */
-int path_is_mount_point(const char *t, const char *root, int flags) {
+int path_is_mount_point_full(const char *path, const char *root, int flags) {
_cleanup_free_ char *canonical = NULL;
_cleanup_close_ int fd = -EBADF;
int r;
- assert(t);
+ assert(path);
assert((flags & ~AT_SYMLINK_FOLLOW) == 0);
- if (path_equal(t, "/"))
+ if (path_equal(path, "/"))
return 1;
- /* we need to resolve symlinks manually, we can't just rely on
- * fd_is_mount_point() to do that for us; if we have a structure like
- * /bin -> /usr/bin/ and /usr is a mount point, then the parent that we
+ /* we need to resolve symlinks manually, we can't just rely on fd_is_mount_point() to do that for us;
+ * if we have a structure like /bin -> /usr/bin/ and /usr is a mount point, then the parent that we
* look at needs to be /usr, not /. */
- if (flags & AT_SYMLINK_FOLLOW) {
- r = chase(t, root, CHASE_TRAIL_SLASH, &canonical, NULL);
+ if (FLAGS_SET(flags, AT_SYMLINK_FOLLOW)) {
+ r = chase(path, root, CHASE_TRAIL_SLASH, &canonical, NULL);
if (r < 0)
return r;
- t = canonical;
+ path = canonical;
}
- fd = open_parent(t, O_PATH|O_CLOEXEC, 0);
+ fd = open_parent(path, O_PATH|O_CLOEXEC, 0);
if (fd < 0)
return fd;
- return fd_is_mount_point(fd, last_path_component(t), flags);
+ return fd_is_mount_point(fd, last_path_component(path), flags);
}
int path_get_mnt_id_at_fallback(int dir_fd, const char *path, int *ret) {
diff --git a/src/basic/mountpoint-util.h b/src/basic/mountpoint-util.h
index 499403a4d8..04f79bf76a 100644
--- a/src/basic/mountpoint-util.h
+++ b/src/basic/mountpoint-util.h
@@ -3,6 +3,7 @@
#include <fcntl.h>
#include <stdbool.h>
+#include <stddef.h>
#include <sys/types.h>
/* The limit used for /dev itself. 4MB should be enough since device nodes and symlinks don't
@@ -44,7 +45,10 @@ static inline int path_get_mnt_id(const char *path, int *ret) {
}
int fd_is_mount_point(int fd, const char *filename, int flags);
-int path_is_mount_point(const char *path, const char *root, int flags);
+int path_is_mount_point_full(const char *path, const char *root, int flags);
+static inline int path_is_mount_point(const char *path) {
+ return path_is_mount_point_full(path, NULL, 0);
+}
bool fstype_is_network(const char *fstype);
bool fstype_needs_quota(const char *fstype);
diff --git a/src/core/automount.c b/src/core/automount.c
index 4cbb3727e5..88a9f49b5f 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -821,7 +821,7 @@ static int automount_start(Unit *u) {
assert(a);
assert(IN_SET(a->state, AUTOMOUNT_DEAD, AUTOMOUNT_FAILED));
- if (path_is_mount_point(a->where, NULL, 0) > 0)
+ if (path_is_mount_point(a->where) > 0)
return log_unit_error_errno(u, SYNTHETIC_ERRNO(EEXIST), "Path %s is already a mount point, refusing start.", a->where);
r = unit_test_trigger_loaded(u);
diff --git a/src/core/exec-credential.c b/src/core/exec-credential.c
index ef3033f67a..048cccf56e 100644
--- a/src/core/exec-credential.c
+++ b/src/core/exec-credential.c
@@ -777,7 +777,7 @@ static int setup_credentials_internal(
assert(workspace);
if (reuse_workspace) {
- r = path_is_mount_point(workspace, NULL, 0);
+ r = path_is_mount_point(workspace);
if (r < 0)
return r;
if (r > 0)
@@ -788,7 +788,7 @@ static int setup_credentials_internal(
} else
workspace_mounted = -1; /* ditto */
- r = path_is_mount_point(final, NULL, 0);
+ r = path_is_mount_point(final);
if (r < 0)
return r;
if (r > 0) {
diff --git a/src/core/import-creds.c b/src/core/import-creds.c
index be56c4676f..18e4bce67f 100644
--- a/src/core/import-creds.c
+++ b/src/core/import-creds.c
@@ -80,7 +80,7 @@ static int acquire_credential_directory(ImportCredentialContext *c, const char *
if (c->target_dir_fd >= 0)
return c->target_dir_fd;
- r = path_is_mount_point(path, NULL, 0);
+ r = path_is_mount_point(path);
if (r < 0) {
if (r != -ENOENT)
return log_error_errno(r, "Failed to determine if %s is a mount point: %m", path);
diff --git a/src/core/namespace.c b/src/core/namespace.c
index aef0d52799..d87079ccbc 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -1117,7 +1117,7 @@ static int mount_bind_dev(const MountEntry *m) {
(void) mkdir_p_label(mount_entry_path(m), 0755);
- r = path_is_mount_point(mount_entry_path(m), NULL, 0);
+ r = path_is_mount_point(mount_entry_path(m));
if (r < 0)
return log_debug_errno(r, "Unable to determine whether /dev is already mounted: %m");
if (r > 0) /* make this a NOP if /dev is already a mount point */
@@ -1137,7 +1137,7 @@ static int mount_bind_sysfs(const MountEntry *m) {
(void) mkdir_p_label(mount_entry_path(m), 0755);
- r = path_is_mount_point(mount_entry_path(m), NULL, 0);
+ r = path_is_mount_point(mount_entry_path(m));
if (r < 0)
return log_debug_errno(r, "Unable to determine whether /sys is already mounted: %m");
if (r > 0) /* make this a NOP if /sys is already a mount point */
@@ -1184,7 +1184,7 @@ static int mount_private_apivfs(
/* When we do not have enough privileges to mount a new instance, fall back to use an
* existing mount. */
- r = path_is_mount_point(entry_path, /* root = */ NULL, /* flags = */ 0);
+ r = path_is_mount_point(entry_path);
if (r < 0)
return log_debug_errno(r, "Unable to determine whether '%s' is already mounted: %m", entry_path);
if (r > 0)
@@ -1299,7 +1299,7 @@ static int mount_run(const MountEntry *m) {
assert(m);
- r = path_is_mount_point(mount_entry_path(m), NULL, 0);
+ r = path_is_mount_point(mount_entry_path(m));
if (r < 0 && r != -ENOENT)
return log_debug_errno(r, "Unable to determine whether /run is already mounted: %m");
if (r > 0) /* make this a NOP if /run is already a mount point */
@@ -1533,7 +1533,7 @@ static int apply_one_mount(
case MOUNT_READ_WRITE_IMPLICIT:
case MOUNT_EXEC:
case MOUNT_NOEXEC:
- r = path_is_mount_point(mount_entry_path(m), root_directory, 0);
+ r = path_is_mount_point_full(mount_entry_path(m), root_directory, /* flags = */ 0);
if (r == -ENOENT && m->ignore)
return 0;
if (r < 0)
@@ -2537,7 +2537,7 @@ int setup_namespace(const NamespaceParameters *p, char **error_path) {
} else if (p->root_directory) {
/* A root directory is specified. Turn its directory into bind mount, if it isn't one yet. */
- r = path_is_mount_point(root, NULL, AT_SYMLINK_FOLLOW);
+ r = path_is_mount_point_full(root, /* root = */ NULL, AT_SYMLINK_FOLLOW);
if (r < 0)
return log_debug_errno(r, "Failed to detect that %s is a mount point or not: %m", root);
if (r == 0) {
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 80ca647e51..d23999ed93 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -280,7 +280,7 @@ static int path_is_busy(const char *where) {
assert(where);
/* already a mountpoint; generators run during reload */
- r = path_is_mount_point(where, NULL, AT_SYMLINK_FOLLOW);
+ r = path_is_mount_point_full(where, /* root = */ NULL, AT_SYMLINK_FOLLOW);
if (r > 0)
return false;
/* The directory will be created by the mount or automount unit when it is started. */
diff --git a/src/home/user-record-util.c b/src/home/user-record-util.c
index 089cbb1a1d..6c42713866 100644
--- a/src/home/user-record-util.c
+++ b/src/home/user-record-util.c
@@ -428,7 +428,7 @@ int user_record_test_home_directory(UserRecord *h) {
if (r == 0)
return -ENOTDIR;
- r = path_is_mount_point(hd, NULL, 0);
+ r = path_is_mount_point(hd);
if (r < 0)
return r;
if (r > 0)
diff --git a/src/libsystemd/sd-device/test-device-util.c b/src/libsystemd/sd-device/test-device-util.c
index 4d38982e34..d98c687bc2 100644
--- a/src/libsystemd/sd-device/test-device-util.c
+++ b/src/libsystemd/sd-device/test-device-util.c
@@ -82,7 +82,7 @@ TEST(device_is_devtype) {
}
static int intro(void) {
- if (path_is_mount_point("/sys", NULL, 0) <= 0)
+ if (path_is_mount_point("/sys") <= 0)
return log_tests_skipped("/sys is not mounted");
return EXIT_SUCCESS;
diff --git a/src/libsystemd/sd-device/test-sd-device-monitor.c b/src/libsystemd/sd-device/test-sd-device-monitor.c
index 4f80c4e579..3dbf9871dc 100644
--- a/src/libsystemd/sd-device/test-sd-device-monitor.c
+++ b/src/libsystemd/sd-device/test-sd-device-monitor.c
@@ -299,7 +299,7 @@ int main(int argc, char *argv[]) {
if (getuid() != 0)
return log_tests_skipped("not root");
- if (path_is_mount_point("/sys", NULL, 0) <= 0)
+ if (path_is_mount_point("/sys") <= 0)
return log_tests_skipped("/sys is not mounted");
if (path_is_read_only_fs("/sys") > 0)
diff --git a/src/libsystemd/sd-device/test-sd-device.c b/src/libsystemd/sd-device/test-sd-device.c
index f64f6013cf..9fde1a0814 100644
--- a/src/libsystemd/sd-device/test-sd-device.c
+++ b/src/libsystemd/sd-device/test-sd-device.c
@@ -677,7 +677,7 @@ TEST(devname_from_devnum) {
}
static int intro(void) {
- if (path_is_mount_point("/sys", NULL, 0) <= 0)
+ if (path_is_mount_point("/sys") <= 0)
return log_tests_skipped("/sys is not mounted");
return EXIT_SUCCESS;
diff --git a/src/login/user-runtime-dir.c b/src/login/user-runtime-dir.c
index ad04b04df9..5f527d8c43 100644
--- a/src/login/user-runtime-dir.c
+++ b/src/login/user-runtime-dir.c
@@ -67,7 +67,7 @@ static int user_mkdir_runtime_path(
if (r < 0)
return log_error_errno(r, "Failed to create /run/user: %m");
- if (path_is_mount_point(runtime_path, NULL, 0) > 0)
+ if (path_is_mount_point(runtime_path) > 0)
log_debug("%s is already a mount point", runtime_path);
else {
char options[sizeof("mode=0700,uid=,gid=,size=,nr_inodes=,smackfsroot=*")
diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
index a5002437c6..c4a784fd64 100644
--- a/src/nspawn/nspawn-cgroup.c
+++ b/src/nspawn/nspawn-cgroup.c
@@ -265,7 +265,7 @@ static int mount_legacy_cgroup_hierarchy(
to = strjoina(strempty(dest), "/sys/fs/cgroup/", hierarchy);
- r = path_is_mount_point(to, dest, 0);
+ r = path_is_mount_point_full(to, dest, /* flags = */ 0);
if (r < 0 && r != -ENOENT)
return log_error_errno(r, "Failed to determine if %s is mounted already: %m", to);
if (r > 0)
@@ -317,7 +317,7 @@ static int mount_legacy_cgns_supported(
(void) mkdir_p(cgroup_root, 0755);
/* Mount a tmpfs to /sys/fs/cgroup if it's not mounted there yet. */
- r = path_is_mount_point(cgroup_root, dest, AT_SYMLINK_FOLLOW);
+ r = path_is_mount_point_full(cgroup_root, dest, AT_SYMLINK_FOLLOW);
if (r < 0)
return log_error_errno(r, "Failed to determine if /sys/fs/cgroup is already mounted: %m");
if (r == 0) {
@@ -427,7 +427,7 @@ static int mount_legacy_cgns_unsupported(
(void) mkdir_p(cgroup_root, 0755);
/* Mount a tmpfs to /sys/fs/cgroup if it's not mounted there yet. */
- r = path_is_mount_point(cgroup_root, dest, AT_SYMLINK_FOLLOW);
+ r = path_is_mount_point_full(cgroup_root, dest, AT_SYMLINK_FOLLOW);
if (r < 0)
return log_error_errno(r, "Failed to determine if /sys/fs/cgroup is already mounted: %m");
if (r == 0) {
@@ -529,7 +529,7 @@ static int mount_unified_cgroups(const char *dest) {
(void) mkdir_p(p, 0755);
- r = path_is_mount_point(p, dest, AT_SYMLINK_FOLLOW);
+ r = path_is_mount_point_full(p, dest, AT_SYMLINK_FOLLOW);
if (r < 0)
return log_error_errno(r, "Failed to determine if %s is mounted already: %m", p);
if (r > 0) {
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c
index 24771076b4..5f41c1c91f 100644
--- a/src/nspawn/nspawn-mount.c
+++ b/src/nspawn/nspawn-mount.c
@@ -642,7 +642,7 @@ int mount_all(const char *dest,
/* Skip this entry if it is not a remount. */
if (mount_table[k].what) {
- r = path_is_mount_point(where, NULL, 0);
+ r = path_is_mount_point(where);
if (r < 0 && r != -ENOENT)
return log_error_errno(r, "Failed to detect whether %s is a mount point: %m", where);
if (r > 0)
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index c0ec076b24..ead1e4af8d 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2560,7 +2560,7 @@ static int setup_journal(const char *directory) {
p = strjoina("/var/log/journal/", SD_ID128_TO_STRING(arg_uuid));
q = prefix_roota(directory, p);
- if (path_is_mount_point(p, NULL, 0) > 0) {
+ if (path_is_mount_point(p) > 0) {
if (try)
return 0;
@@ -2568,7 +2568,7 @@ static int setup_journal(const char *directory) {
"%s: already a mount point, refusing to use for journal", p);
}
- if (path_is_mount_point(q, NULL, 0) > 0) {
+ if (path_is_mount_point(q) > 0) {
if (try)
return 0;
@@ -3633,7 +3633,7 @@ static int setup_unix_export_dir_outside(char **ret) {
if (!p)
return log_oom();
- r = path_is_mount_point(p, /* root= */ NULL, 0);
+ r = path_is_mount_point(p);
if (r > 0)
return log_error_errno(SYNTHETIC_ERRNO(EEXIST), "Mount point '%s' exists already, refusing.", p);
if (r < 0 && r != -ENOENT)
@@ -5680,7 +5680,7 @@ static int run(int argc, char *argv[]) {
/* If the specified path is a mount point we generate the new snapshot immediately
* inside it under a random name. However if the specified is not a mount point we
* create the new snapshot in the parent directory, just next to it. */
- r = path_is_mount_point(arg_directory, NULL, 0);
+ r = path_is_mount_point(arg_directory);
if (r < 0) {
log_error_errno(r, "Failed to determine whether directory %s is mount point: %m", arg_directory);
goto finish;
diff --git a/src/partition/growfs.c b/src/partition/growfs.c
index 491040ffb0..f9600ace84 100644
--- a/src/partition/growfs.c
+++ b/src/partition/growfs.c
@@ -224,7 +224,7 @@ static int run(int argc, char *argv[]) {
if (r <= 0)
return r;
- r = path_is_mount_point(arg_target, NULL, 0);
+ r = path_is_mount_point(arg_target);
if (r < 0)
return log_error_errno(r, "Failed to check if \"%s\" is a mount point: %m", arg_target);
if (r == 0)
diff --git a/src/partition/repart.c b/src/partition/repart.c
index 2deada0718..05332f9680 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -5828,7 +5828,7 @@ static int find_backing_devno(
if (r < 0)
return r;
- r = path_is_mount_point(resolved, NULL, 0);
+ r = path_is_mount_point(resolved);
if (r < 0)
return r;
if (r == 0) /* Not a mount point, then it's not a partition of its own, let's not automatically use it. */
@@ -7037,7 +7037,7 @@ static int parse_argv(int argc, char *argv[]) {
/* By default operate on /sysusr/ or /sysroot/ when invoked in the initrd. We prefer the
* former, if it is mounted, so that we have deterministic behaviour on systems where /usr/
* is vendor-supplied but the root fs formatted on first boot. */
- r = path_is_mount_point("/sysusr/usr", NULL, 0);
+ r = path_is_mount_point("/sysusr/usr");
if (r <= 0) {
if (r < 0 && r != -ENOENT)
log_debug_errno(r, "Unable to determine whether /sysusr/usr is a mount point, assuming it is not: %m");
diff --git a/src/shared/condition.c b/src/shared/condition.c
index b08cd959a0..385ceee332 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -931,7 +931,7 @@ static int condition_test_path_is_mount_point(Condition *c, char **env) {
assert(c->parameter);
assert(c->type == CONDITION_PATH_IS_MOUNT_POINT);
- return path_is_mount_point(c->parameter, NULL, AT_SYMLINK_FOLLOW) > 0;
+ return path_is_mount_point_full(c->parameter, /* root = */ NULL, AT_SYMLINK_FOLLOW) > 0;
}
static int condition_test_path_is_read_write(Condition *c, char **env) {
diff --git a/src/shared/machine-id-setup.c b/src/shared/machine-id-setup.c
index 94425d6a73..f821ea7c9d 100644
--- a/src/shared/machine-id-setup.c
+++ b/src/shared/machine-id-setup.c
@@ -237,7 +237,7 @@ int machine_id_commit(const char *root) {
etc_machine_id = prefix_roota(root, "/etc/machine-id");
- r = path_is_mount_point(etc_machine_id, NULL, 0);
+ r = path_is_mount_point(etc_machine_id);
if (r < 0)
return log_error_errno(r, "Failed to determine whether %s is a mount point: %m", etc_machine_id);
if (r == 0) {
diff --git a/src/shared/mount-setup.c b/src/shared/mount-setup.c
index a602f6f1e2..a492e7127f 100644
--- a/src/shared/mount-setup.c
+++ b/src/shared/mount-setup.c
@@ -177,7 +177,7 @@ static int mount_one(const MountPoint *p, bool relabel) {
if (relabel)
(void) label_fix(p->where, LABEL_IGNORE_ENOENT|LABEL_IGNORE_EROFS);
- r = path_is_mount_point(p->where, NULL, AT_SYMLINK_FOLLOW);
+ r = path_is_mount_point_full(p->where, /* root = */ NULL, AT_SYMLINK_FOLLOW);
if (r < 0 && r != -ENOENT) {
log_full_errno(priority, r, "Failed to determine whether %s is a mount point: %m", p->where);
return (p->mode & MNT_FATAL) ? r : 0;
diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c
index bf351820a7..9bae21f88e 100644
--- a/src/shared/mount-util.c
+++ b/src/shared/mount-util.c
@@ -347,7 +347,7 @@ int bind_remount_recursive_with_mountinfo(
* think autofs, NFS, FUSE, …), but let's generate useful debug messages at
* the very least. */
- q = path_is_mount_point(x, NULL, 0);
+ q = path_is_mount_point(x);
if (IN_SET(q, 0, -ENOENT)) {
/* Hmm, whaaaa? The mount point is not actually a mount point? Then
* it is either obstructed by a later mount or somebody has been
@@ -1283,7 +1283,7 @@ int make_mount_point(const char *path) {
/* If 'path' is already a mount point, does nothing and returns 0. If it is not it makes it one, and returns 1. */
- r = path_is_mount_point(path, NULL, 0);
+ r = path_is_mount_point(path);
if (r < 0)
return log_debug_errno(r, "Failed to determine whether '%s' is a mount point: %m", path);
if (r > 0)
@@ -1590,7 +1590,7 @@ int bind_mount_submounts(
if (!t)
return -ENOMEM;
- r = path_is_mount_point(t, NULL, 0);
+ r = path_is_mount_point(t);
if (r < 0) {
log_debug_errno(r, "Failed to detect if '%s' already is a mount point, ignoring: %m", t);
continue;
diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
index 787fb79afb..aba9d52e96 100644
--- a/src/shared/switch-root.c
+++ b/src/shared/switch-root.c
@@ -144,7 +144,7 @@ int switch_root(const char *new_root,
return log_error_errno(r, "Failed to resolve %s/%s: %m", new_root, transfer->path);
/* Let's see if it is a mount point already. */
- r = path_is_mount_point(chased, NULL, 0);
+ r = path_is_mount_point(chased);
if (r < 0)
return log_error_errno(r, "Failed to determine whether %s is a mount point: %m", chased);
if (r > 0) /* If it is already mounted, then do nothing */
diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c
index fc79370781..49cedcc24b 100644
--- a/src/sysext/sysext.c
+++ b/src/sysext/sysext.c
@@ -113,7 +113,7 @@ static int is_our_mount_point(
assert(p);
- r = path_is_mount_point(p, NULL, 0);
+ r = path_is_mount_point(p);
if (r == -ENOENT) {
log_debug_errno(r, "Hierarchy '%s' doesn't exist.", p);
return false;
diff --git a/src/test/test-mount-util.c b/src/test/test-mount-util.c
index 069a63290c..3e22ac67fc 100644
--- a/src/test/test-mount-util.c
+++ b/src/test/test-mount-util.c
@@ -508,11 +508,11 @@ TEST(bind_mount_submounts) {
free(x);
assert_se(x = path_join(b, "x"));
- assert_se(path_is_mount_point(x, NULL, 0) > 0);
+ assert_se(path_is_mount_point(x) > 0);
free(x);
assert_se(x = path_join(b, "y"));
- assert_se(path_is_mount_point(x, NULL, 0) > 0);
+ assert_se(path_is_mount_point(x) > 0);
assert_se(umount_recursive(a, 0) >= 0);
assert_se(umount_recursive(b, 0) >= 0);
diff --git a/src/test/test-mountpoint-util.c b/src/test/test-mountpoint-util.c
index 1f71a25859..6d784a9ae8 100644
--- a/src/test/test-mountpoint-util.c
+++ b/src/test/test-mountpoint-util.c
@@ -101,7 +101,7 @@ TEST(mnt_id) {
* See #11505. */
assert_se(q = hashmap_get(h, INT_TO_PTR(mnt_id2)));
- assert_se((r = path_is_mount_point(p, NULL, 0)) >= 0);
+ assert_se((r = path_is_mount_point_full(p, NULL, 0)) >= 0);
if (r == 0) {
/* If the path is not a mount point anymore, then it must be a sub directory of
* the path corresponds to mnt_id2. */
@@ -123,20 +123,20 @@ TEST(path_is_mount_point) {
_cleanup_free_ char *dir1 = NULL, *dir1file = NULL, *dirlink1 = NULL, *dirlink1file = NULL;
_cleanup_free_ char *dir2 = NULL, *dir2file = NULL;
- assert_se(path_is_mount_point("/", NULL, AT_SYMLINK_FOLLOW) > 0);
- assert_se(path_is_mount_point("/", NULL, 0) > 0);
- assert_se(path_is_mount_point("//", NULL, AT_SYMLINK_FOLLOW) > 0);
- assert_se(path_is_mount_point("//", NULL, 0) > 0);
+ assert_se(path_is_mount_point_full("/", NULL, AT_SYMLINK_FOLLOW) > 0);
+ assert_se(path_is_mount_point_full("/", NULL, 0) > 0);
+ assert_se(path_is_mount_point_full("//", NULL, AT_SYMLINK_FOLLOW) > 0);
+ assert_se(path_is_mount_point_full("//", NULL, 0) > 0);
- assert_se(path_is_mount_point("/proc", NULL, AT_SYMLINK_FOLLOW) > 0);
- assert_se(path_is_mount_point("/proc", NULL, 0) > 0);
- assert_se(path_is_mount_point("/proc/", NULL, AT_SYMLINK_FOLLOW) > 0);
- assert_se(path_is_mount_point("/proc/", NULL, 0) > 0);
+ assert_se(path_is_mount_point_full("/proc", NULL, AT_SYMLINK_FOLLOW) > 0);
+ assert_se(path_is_mount_point_full("/proc", NULL, 0) > 0);
+ assert_se(path_is_mount_point_full("/proc/", NULL, AT_SYMLINK_FOLLOW) > 0);
+ assert_se(path_is_mount_point_full("/proc/", NULL, 0) > 0);
- assert_se(path_is_mount_point("/proc/1", NULL, AT_SYMLINK_FOLLOW) == 0);
- assert_se(path_is_mount_point("/proc/1", NULL, 0) == 0);
- assert_se(path_is_mount_point("/proc/1/", NULL, AT_SYMLINK_FOLLOW) == 0);
- assert_se(path_is_mount_point("/proc/1/", NULL, 0) == 0);
+ assert_se(path_is_mount_point_full("/proc/1", NULL, AT_SYMLINK_FOLLOW) == 0);
+ assert_se(path_is_mount_point_full("/proc/1", NULL, 0) == 0);
+ assert_se(path_is_mount_point_full("/proc/1/", NULL, AT_SYMLINK_FOLLOW) == 0);
+ assert_se(path_is_mount_point_full("/proc/1/", NULL, 0) == 0);
/* we'll create a hierarchy of different kinds of dir/file/link
* layouts:
@@ -170,10 +170,10 @@ TEST(path_is_mount_point) {
assert_se(link1);
assert_se(symlink("file2", link2) == 0);
- assert_se(path_is_mount_point(file1, NULL, AT_SYMLINK_FOLLOW) == 0);
- assert_se(path_is_mount_point(file1, NULL, 0) == 0);
- assert_se(path_is_mount_point(link1, NULL, AT_SYMLINK_FOLLOW) == 0);
- assert_se(path_is_mount_point(link1, NULL, 0) == 0);
+ assert_se(path_is_mount_point_full(file1, NULL, AT_SYMLINK_FOLLOW) == 0);
+ assert_se(path_is_mount_point_full(file1, NULL, 0) == 0);
+ assert_se(path_is_mount_point_full(link1, NULL, AT_SYMLINK_FOLLOW) == 0);
+ assert_se(path_is_mount_point_full(link1, NULL, 0) == 0);
/* directory mountpoints */
dir1 = path_join(tmp_dir, "dir1");
@@ -189,10 +189,10 @@ TEST(path_is_mount_point) {
assert_se(dir2);
assert_se(mkdir(dir2, 0755) == 0);
- assert_se(path_is_mount_point(dir1, NULL, AT_SYMLINK_FOLLOW) == 0);
- assert_se(path_is_mount_point(dir1, NULL, 0) == 0);
- assert_se(path_is_mount_point(dirlink1, NULL, AT_SYMLINK_FOLLOW) == 0);
- assert_se(path_is_mount_point(dirlink1, NULL, 0) == 0);
+ assert_se(path_is_mount_point_full(dir1, NULL, AT_SYMLINK_FOLLOW) == 0);
+ assert_se(path_is_mount_point_full(dir1, NULL, 0) == 0);
+ assert_se(path_is_mount_point_full(dirlink1, NULL, AT_SYMLINK_FOLLOW) == 0);
+ assert_se(path_is_mount_point_full(dirlink1, NULL, 0) == 0);
/* file in subdirectory mountpoints */
dir1file = path_join(dir1, "file");
@@ -201,10 +201,10 @@ TEST(path_is_mount_point) {
assert_se(fd > 0);
close(fd);
- assert_se(path_is_mount_point(dir1file, NULL, AT_SYMLINK_FOLLOW) == 0);
- assert_se(path_is_mount_point(dir1file, NULL, 0) == 0);
- assert_se(path_is_mount_point(dirlink1file, NULL, AT_SYMLINK_FOLLOW) == 0);
- assert_se(path_is_mount_point(dirlink1file, NULL, 0) == 0);
+ assert_se(path_is_mount_point_full(dir1file, NULL, AT_SYMLINK_FOLLOW) == 0);
+ assert_se(path_is_mount_point_full(dir1file, NULL, 0) == 0);
+ assert_se(path_is_mount_point_full(dirlink1file, NULL, AT_SYMLINK_FOLLOW) == 0);
+ assert_se(path_is_mount_point_full(dirlink1file, NULL, 0) == 0);
/* these tests will only work as root */
if (mount(file1, file2, NULL, MS_BIND, NULL) >= 0) {
@@ -214,17 +214,17 @@ TEST(path_is_mount_point) {
/* files */
/* capture results in vars, to avoid dangling mounts on failure */
log_info("%s: %s", __func__, file2);
- rf = path_is_mount_point(file2, NULL, 0);
- rt = path_is_mount_point(file2, NULL, AT_SYMLINK_FOLLOW);
+ rf = path_is_mount_point_full(file2, NULL, 0);
+ rt = path_is_mount_point_full(file2, NULL, AT_SYMLINK_FOLLOW);
file2d = strjoina(file2, "/");
log_info("%s: %s", __func__, file2d);
- rdf = path_is_mount_point(file2d, NULL, 0);
- rdt = path_is_mount_point(file2d, NULL, AT_SYMLINK_FOLLOW);
+ rdf = path_is_mount_point_full(file2d, NULL, 0);
+ rdt = path_is_mount_point_full(file2d, NULL, AT_SYMLINK_FOLLOW);
log_info("%s: %s", __func__, link2);
- rlf = path_is_mount_point(link2, NULL, 0);
- rlt = path_is_mount_point(link2, NULL, AT_SYMLINK_FOLLOW);
+ rlf = path_is_mount_point_full(link2, NULL, 0);
+ rlt = path_is_mount_point_full(link2, NULL, AT_SYMLINK_FOLLOW);
assert_se(umount(file2) == 0);
@@ -245,15 +245,15 @@ TEST(path_is_mount_point) {
assert_se(mount(dir2, dir1, NULL, MS_BIND, NULL) >= 0);
log_info("%s: %s", __func__, dir1);
- rf = path_is_mount_point(dir1, NULL, 0);
- rt = path_is_mount_point(dir1, NULL, AT_SYMLINK_FOLLOW);
+ rf = path_is_mount_point_full(dir1, NULL, 0);
+ rt = path_is_mount_point_full(dir1, NULL, AT_SYMLINK_FOLLOW);
log_info("%s: %s", __func__, dirlink1);
- rlf = path_is_mount_point(dirlink1, NULL, 0);
- rlt = path_is_mount_point(dirlink1, NULL, AT_SYMLINK_FOLLOW);
+ rlf = path_is_mount_point_full(dirlink1, NULL, 0);
+ rlt = path_is_mount_point_full(dirlink1, NULL, AT_SYMLINK_FOLLOW);
log_info("%s: %s", __func__, dirlink1file);
/* its parent is a mount point, but not /file itself */
- rl1f = path_is_mount_point(dirlink1file, NULL, 0);
- rl1t = path_is_mount_point(dirlink1file, NULL, AT_SYMLINK_FOLLOW);
+ rl1f = path_is_mount_point_full(dirlink1file, NULL, 0);
+ rl1t = path_is_mount_point_full(dirlink1file, NULL, AT_SYMLINK_FOLLOW);
assert_se(umount(dir1) == 0);
diff --git a/src/test/test-stat-util.c b/src/test/test-stat-util.c
index 95137ffcf1..3fc83fc043 100644
--- a/src/test/test-stat-util.c
+++ b/src/test/test-stat-util.c
@@ -73,11 +73,11 @@ TEST(is_symlink) {
TEST(path_is_fs_type) {
/* run might not be a mount point in build chroots */
- if (path_is_mount_point("/run", NULL, AT_SYMLINK_FOLLOW) > 0) {
+ if (path_is_mount_point_full("/run", NULL, AT_SYMLINK_FOLLOW) > 0) {
assert_se(path_is_fs_type("/run", TMPFS_MAGIC) > 0);
assert_se(path_is_fs_type("/run", BTRFS_SUPER_MAGIC) == 0);
}
- if (path_is_mount_point("/proc", NULL, AT_SYMLINK_FOLLOW) > 0) {
+ if (path_is_mount_point_full("/proc", NULL, AT_SYMLINK_FOLLOW) > 0) {
assert_se(path_is_fs_type("/proc", PROC_SUPER_MAGIC) > 0);
assert_se(path_is_fs_type("/proc", BTRFS_SUPER_MAGIC) == 0);
}
@@ -95,7 +95,7 @@ TEST(path_is_temporary_fs) {
}
/* run might not be a mount point in build chroots */
- if (path_is_mount_point("/run", NULL, AT_SYMLINK_FOLLOW) > 0)
+ if (path_is_mount_point_full("/run", NULL, AT_SYMLINK_FOLLOW) > 0)
assert_se(path_is_temporary_fs("/run") > 0);
assert_se(path_is_temporary_fs("/proc") == 0);
assert_se(path_is_temporary_fs("/i-dont-exist") == -ENOENT);
@@ -111,7 +111,7 @@ TEST(path_is_read_only_fs) {
s, r, r < 0 ? errno_to_name(r) : yes_no(r));
}
- if (path_is_mount_point("/sys", NULL, AT_SYMLINK_FOLLOW) > 0)
+ if (path_is_mount_point_full("/sys", NULL, AT_SYMLINK_FOLLOW) > 0)
assert_se(IN_SET(path_is_read_only_fs("/sys"), 0, 1));
assert_se(path_is_read_only_fs("/proc") == 0);
diff --git a/src/udev/test-udev-format.c b/src/udev/test-udev-format.c
index 18a60b351e..7eacb6b81a 100644
--- a/src/udev/test-udev-format.c
+++ b/src/udev/test-udev-format.c
@@ -36,7 +36,7 @@ TEST(udev_resolve_subsys_kernel) {
}
static int intro(void) {
- if (path_is_mount_point("/sys", NULL, 0) <= 0)
+ if (path_is_mount_point("/sys") <= 0)
return log_tests_skipped("/sys is not mounted");
return EXIT_SUCCESS;
diff --git a/src/udev/test-udev-spawn.c b/src/udev/test-udev-spawn.c
index 3a11dd9b20..8486676821 100644
--- a/src/udev/test-udev-spawn.c
+++ b/src/udev/test-udev-spawn.c
@@ -81,7 +81,7 @@ static void test2(void) {
int main(int argc, char *argv[]) {
_cleanup_free_ char *self = NULL;
- if (path_is_mount_point("/sys", NULL, 0) <= 0)
+ if (path_is_mount_point("/sys") <= 0)
return log_tests_skipped("/sys is not mounted");
if (argc > 1) {
diff --git a/src/volatile-root/volatile-root.c b/src/volatile-root/volatile-root.c
index 27be7bdf56..9ab9650480 100644
--- a/src/volatile-root/volatile-root.c
+++ b/src/volatile-root/volatile-root.c
@@ -154,7 +154,7 @@ static int run(int argc, char *argv[]) {
if (!IN_SET(m, VOLATILE_YES, VOLATILE_OVERLAY))
return 0;
- r = path_is_mount_point(path, NULL, AT_SYMLINK_FOLLOW);
+ r = path_is_mount_point_full(path, /* root = */ NULL, AT_SYMLINK_FOLLOW);
if (r < 0)
return log_error_errno(r, "Couldn't determine whether %s is a mount point: %m", path);
if (r == 0)