summaryrefslogtreecommitdiffstats
path: root/src/shared/fstab-util.c
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2020-03-30 10:39:21 +0200
committerFranck Bui <fbui@suse.com>2020-04-01 10:36:28 +0200
commitbc9e5a4c67f5fff536d122118e16a53dfb592acd (patch)
tree30e12b17dcd15b30a096865aeb152ce376ba3e21 /src/shared/fstab-util.c
parentdevice: drop refuse_after (diff)
downloadsystemd-bc9e5a4c67f5fff536d122118e16a53dfb592acd.tar.xz
systemd-bc9e5a4c67f5fff536d122118e16a53dfb592acd.zip
fstab-util: introduce fstab_is_extrinsic()
Diffstat (limited to 'src/shared/fstab-util.c')
-rw-r--r--src/shared/fstab-util.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c
index 86a57e6b2c..b19127be09 100644
--- a/src/shared/fstab-util.c
+++ b/src/shared/fstab-util.c
@@ -35,6 +35,30 @@ int fstab_has_fstype(const char *fstype) {
return false;
}
+bool fstab_is_extrinsic(const char *mount, const char *opts) {
+
+ /* Don't bother with the OS data itself */
+ if (PATH_IN_SET(mount,
+ "/",
+ "/usr",
+ "/etc"))
+ return true;
+
+ if (PATH_STARTSWITH_SET(mount,
+ "/run/initramfs", /* This should stay around from before we boot until after we shutdown */
+ "/proc", /* All of this is API VFS */
+ "/sys", /* … dito … */
+ "/dev")) /* … dito … */
+ return true;
+
+ /* If this is an initrd mount, and we are not in the initrd, then leave
+ * this around forever, too. */
+ if (opts && fstab_test_option(opts, "x-initrd.mount\0") && !in_initrd())
+ return true;
+
+ return false;
+}
+
int fstab_is_mount_point(const char *mount) {
_cleanup_endmntent_ FILE *f = NULL;
struct mntent *m;