chiark / gitweb /
dissect: automatically mark partitions read-only that have a read-only file system
authorLennart Poettering <lennart@poettering.net>
Fri, 29 Sep 2017 12:19:22 +0000 (14:19 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 22 Nov 2017 07:25:27 +0000 (08:25 +0100)
Specifically, squashfs and iso9660 are always read-only, hence make sure
we never even think about mounting them writable.

src/basic/mount-util.c
src/basic/mount-util.h

index adf60c7ee26873944ab8833095c519d210670281..d8850bf83c05628ff9cf3e76c7e59da58de86ede 100644 (file)
@@ -578,6 +578,19 @@ bool fstype_is_api_vfs(const char *fstype) {
         return nulstr_contains(table, fstype);
 }
 
+bool fstype_is_ro(const char *fstype) {
+
+        /* All Linux file systems that are necessarily read-only */
+
+        static const char table[] =
+                "DM_verity_hash\0"
+                "iso9660\0"
+                "squashfs\0"
+                ;
+
+        return nulstr_contains(table, fstype);
+}
+
 int repeat_unmount(const char *path, int flags) {
         bool done = false;
 
index 571a0eb50166f52a85e1cf16e444ad0cd6caf829..3b026c1b543e5ef19a59ad21203c6682c4cfdac8 100644 (file)
@@ -49,6 +49,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent);
 bool fstype_is_network(const char *fstype);
 #endif // 0
 bool fstype_is_api_vfs(const char *fstype);
+bool fstype_is_ro(const char *fsype);
 
 union file_handle_union {
         struct file_handle handle;