summaryrefslogtreecommitdiffstats
path: root/src/shared/dissect-image.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-09-19 13:30:29 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-09-27 20:06:27 +0200
commit698bb074a316015bd9ec7529a2781422004fe6c8 (patch)
tree7ad786934c3dea5da67b224e170428100385220d /src/shared/dissect-image.c
parentMerge pull request #24832 from mrc0mmand/more-TEST-64-tweaks (diff)
downloadsystemd-698bb074a316015bd9ec7529a2781422004fe6c8.tar.xz
systemd-698bb074a316015bd9ec7529a2781422004fe6c8.zip
dissect-image: split-out dissected_image_probe_filesystem()
No functional changes, just preparation for later commits.
Diffstat (limited to 'src/shared/dissect-image.c')
-rw-r--r--src/shared/dissect-image.c57
1 files changed, 35 insertions, 22 deletions
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
index 2ea053e009..cc5cee0451 100644
--- a/src/shared/dissect-image.c
+++ b/src/shared/dissect-image.c
@@ -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;