static bool mount_is_bind(const MountParameters *p) {
assert(p);
-
- if (fstab_test_option(p->options, "bind\0" "rbind\0"))
- return true;
-
- if (p->fstype && STR_IN_SET(p->fstype, "bind", "rbind"))
- return true;
-
- return false;
+ return fstab_is_bind(p->options, p->fstype);
}
static bool mount_is_bound_to_device(Mount *m) {
_cleanup_endmntent_ FILE *f = NULL;
struct mntent *m;
+ assert(fstype);
+
f = setmntent(fstab_path(), "re");
if (!f)
return errno == ENOENT ? false : -errno;
return strdup(p);
}
+
+bool fstab_is_bind(const char *options, const char *fstype) {
+
+ if (fstab_test_option(options, "bind\0" "rbind\0"))
+ return true;
+
+ if (fstype && STR_IN_SET(fstype, "bind", "rbind"))
+ return true;
+
+ return false;
+}
static inline const char* fstab_path(void) {
return secure_getenv("SYSTEMD_FSTAB") ?: "/etc/fstab";
}
+
+bool fstab_is_bind(const char *options, const char *fstype);