return false;
}
-static int fstab_is_mount_point_of(const char *what_fstab, const char *path) {
+static int fstab_is_same_node(const char *what_fstab, const char *path) {
_cleanup_free_ char *node = NULL;
assert(what_fstab);
_cleanup_endmntent_ FILE *f = NULL;
int r;
- assert(where);
+ assert(where || path);
f = setmntent(fstab_path(), "re");
if (!f)
if (!me)
return errno != 0 ? -errno : false;
- if (path_equal(where, me->mnt_dir)) {
- if (!path)
- return true;
+ if (where && !path_equal(where, me->mnt_dir))
+ continue;
- r = fstab_is_mount_point_of(me->mnt_fsname, path);
- if (r > 0 || (r < 0 && !ERRNO_IS_DEVICE_ABSENT(r)))
- return r;
- }
+ if (!path)
+ return true;
+
+ r = fstab_is_same_node(me->mnt_fsname, path);
+ if (r > 0 || (r < 0 && !ERRNO_IS_DEVICE_ABSENT(r)))
+ return r;
}
return false;
static inline int fstab_is_mount_point(const char *where) {
return fstab_is_mount_point_full(where, NULL);
}
+static inline int fstab_has_node(const char *path) {
+ return fstab_is_mount_point_full(NULL, path);
+}
int fstab_filter_options(
const char *opts,