]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-image: split-out dissected_image_probe_filesystem()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 19 Sep 2022 11:30:29 +0000 (20:30 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 27 Sep 2022 18:06:27 +0000 (03:06 +0900)
No functional changes, just preparation for later commits.

src/shared/dissect-image.c

index 2ea053e009ae28a58eac78340db81ef5e2f251d9..cc5cee045199fee37fe5fb932282461ea371e98b 100644 (file)
@@ -126,6 +126,38 @@ not_found:
 }
 
 #if HAVE_BLKID
+static int dissected_image_probe_filesystem(DissectedImage *m) {
+        int r;
+
+        assert(m);
+
+        /* Fill in file system types if we don't know them yet. */
+
+        for (PartitionDesignator i = 0; i < _PARTITION_DESIGNATOR_MAX; i++) {
+                DissectedPartition *p = m->partitions + i;
+
+                if (!p->found)
+                        continue;
+
+                if (!p->fstype && p->node) {
+                        r = probe_filesystem(p->node, &p->fstype);
+                        if (r < 0 && r != -EUCLEAN)
+                                return r;
+                }
+
+                if (streq_ptr(p->fstype, "crypto_LUKS"))
+                        m->encrypted = true;
+
+                if (p->fstype && fstype_is_ro(p->fstype))
+                        p->rw = false;
+
+                if (!p->rw)
+                        p->growfs = false;
+        }
+
+        return 0;
+}
+
 static void check_partition_flags(
                 const char *node,
                 unsigned long long pflags,
@@ -1108,28 +1140,9 @@ int dissect_image(
         blkid_free_probe(b);
         b = NULL;
 
-        /* Fill in file system types if we don't know them yet. */
-        for (PartitionDesignator i = 0; i < _PARTITION_DESIGNATOR_MAX; i++) {
-                DissectedPartition *p = m->partitions + i;
-
-                if (!p->found)
-                        continue;
-
-                if (!p->fstype && p->node) {
-                        r = probe_filesystem(p->node, &p->fstype);
-                        if (r < 0 && r != -EUCLEAN)
-                                return r;
-                }
-
-                if (streq_ptr(p->fstype, "crypto_LUKS"))
-                        m->encrypted = true;
-
-                if (p->fstype && fstype_is_ro(p->fstype))
-                        p->rw = false;
-
-                if (!p->rw)
-                        p->growfs = false;
-        }
+        r = dissected_image_probe_filesystem(m);
+        if (r < 0)
+                return r;
 
         *ret = TAKE_PTR(m);
         return 0;