]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
analyze: don't list filesystems among ungrouped that are aliases
authorLennart Poettering <lennart@poettering.net>
Mon, 15 Nov 2021 13:05:31 +0000 (14:05 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 15 Nov 2021 21:43:03 +0000 (22:43 +0100)
There are a bunch of filesystems that actually are just aliases for
other filesystems. So far we listed them as "ungrouped", suggesting they
should be added to some file system group. But that's not really
something needed, since they are after all not file systems in their own
right, but aliases only (and usually legacy at that).

hence, let's hide them from display (but debug log about them)

src/analyze/analyze.c

index 4153afb1c6d5a71b6206a4b3a4138cf66a1a7a29..3801cf0eade4899f430624aebe0afc49a99f7c61 100644 (file)
@@ -1944,8 +1944,29 @@ static int dump_filesystems(int argc, char *argv[], void *userdata) {
 
                         strv_sort(l);
 
-                        STRV_FOREACH(filesystem, l)
+                        STRV_FOREACH(filesystem, l) {
+                                const statfs_f_type_t *magic;
+                                bool is_primary = false;
+
+                                assert(fs_type_from_string(*filesystem, &magic) >= 0);
+
+                                for (size_t i = 0; magic[i] != 0; i++) {
+                                        const char *primary;
+
+                                        primary = fs_type_to_string(magic[i]);
+                                        assert(primary);
+
+                                        if (streq(primary, *filesystem))
+                                                is_primary = true;
+                                }
+
+                                if (!is_primary) {
+                                        log_debug("Skipping ungrouped file system '%s', because it's an alias for another one.", *filesystem);
+                                        continue;
+                                }
+
                                 printf("#   %s\n", *filesystem);
+                        }
                 }
 
                 if (k < 0) {