fstab-util: introduce fstab_is_extrinsic()
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
bool fstab_is_extrinsic(const char *mount, const char *opts);
|
||||
int fstab_is_mount_point(const char *mount);
|
||||
int fstab_has_fstype(const char *fstype);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user