summaryrefslogtreecommitdiffstats
path: root/src/basic/mountpoint-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-03-07 11:24:00 +0100
committerLennart Poettering <lennart@poettering.net>2023-03-09 21:56:42 +0100
commit034ebc47a280e6f0f1f051ee15099b6e7fe20e9a (patch)
treef006b2ca880bedd5aa83d8927750d2c1217155c0 /src/basic/mountpoint-util.c
parentmountpoint-util: use mount_option_supported() to detect if 'discard' is suppo... (diff)
downloadsystemd-034ebc47a280e6f0f1f051ee15099b6e7fe20e9a.tar.xz
systemd-034ebc47a280e6f0f1f051ee15099b6e7fe20e9a.zip
mountpoint-util: move 'norecovery' detection into its own helper call
And let's also ask the kernel explicitly for support.
Diffstat (limited to 'src/basic/mountpoint-util.c')
-rw-r--r--src/basic/mountpoint-util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
index 4e0994c881..27d20f5fe3 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -478,6 +478,23 @@ bool fstype_can_discard(const char *fstype) {
"xfs");
}
+bool fstype_can_norecovery(const char *fstype) {
+ int r;
+
+ assert(fstype);
+
+ /* On new kernels we can just ask the kernel */
+ r = mount_option_supported(fstype, "norecovery", NULL);
+ if (r >= 0)
+ return r;
+
+ return STR_IN_SET(fstype,
+ "ext3",
+ "ext4",
+ "xfs",
+ "btrfs");
+}
+
bool fstype_can_uid_gid(const char *fstype) {
/* All file systems that have a uid=/gid= mount option that fixates the owners of all files and directories,