summaryrefslogtreecommitdiffstats
path: root/src/shared/dissect-image.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-11-29 18:30:18 +0100
committerLennart Poettering <lennart@poettering.net>2022-11-29 18:34:59 +0100
commitfb3921b8232b7ac2dc2f8d0254e8a875340be89d (patch)
tree49f823e32ab44676b04240df78678bd511efd155 /src/shared/dissect-image.c
parentdissect-image: don't probe swap partitions needlessly (diff)
downloadsystemd-fb3921b8232b7ac2dc2f8d0254e8a875340be89d.tar.xz
systemd-fb3921b8232b7ac2dc2f8d0254e8a875340be89d.zip
dissect-image: merge handlers for 4 different partition designators into one
These four branches execute the exact same code these days, hence merge them into one.
Diffstat (limited to '')
-rw-r--r--src/shared/dissect-image.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
index 1d634c9b88..4872fe4d6b 100644
--- a/src/shared/dissect-image.c
+++ b/src/shared/dissect-image.c
@@ -648,18 +648,11 @@ static int dissect_image(
label = blkid_partition_get_name(pp); /* libblkid returns NULL here if empty */
- if (type.designator == PARTITION_HOME) {
-
- check_partition_flags(node, pflags,
- SD_GPT_FLAG_NO_AUTO | SD_GPT_FLAG_READ_ONLY | SD_GPT_FLAG_GROWFS);
-
- if (pflags & SD_GPT_FLAG_NO_AUTO)
- continue;
-
- rw = !(pflags & SD_GPT_FLAG_READ_ONLY);
- growfs = FLAGS_SET(pflags, SD_GPT_FLAG_GROWFS);
-
- } else if (type.designator == PARTITION_SRV) {
+ if (IN_SET(type.designator,
+ PARTITION_HOME,
+ PARTITION_SRV,
+ PARTITION_XBOOTLDR,
+ PARTITION_TMP)) {
check_partition_flags(node, pflags,
SD_GPT_FLAG_NO_AUTO | SD_GPT_FLAG_READ_ONLY | SD_GPT_FLAG_GROWFS);
@@ -682,17 +675,6 @@ static int dissect_image(
fstype = "vfat";
- } else if (type.designator == PARTITION_XBOOTLDR) {
-
- check_partition_flags(node, pflags,
- SD_GPT_FLAG_NO_AUTO | SD_GPT_FLAG_READ_ONLY | SD_GPT_FLAG_GROWFS);
-
- if (pflags & SD_GPT_FLAG_NO_AUTO)
- continue;
-
- rw = !(pflags & SD_GPT_FLAG_READ_ONLY);
- growfs = FLAGS_SET(pflags, SD_GPT_FLAG_GROWFS);
-
} else if (type.designator == PARTITION_ROOT) {
check_partition_flags(node, pflags,
@@ -834,17 +816,6 @@ static int dissect_image(
return -ENOMEM;
}
- } else if (type.designator == PARTITION_TMP) {
-
- check_partition_flags(node, pflags,
- SD_GPT_FLAG_NO_AUTO | SD_GPT_FLAG_READ_ONLY | SD_GPT_FLAG_GROWFS);
-
- if (pflags & SD_GPT_FLAG_NO_AUTO)
- continue;
-
- rw = !(pflags & SD_GPT_FLAG_READ_ONLY);
- growfs = FLAGS_SET(pflags, SD_GPT_FLAG_GROWFS);
-
} else if (type.designator == PARTITION_VAR) {
check_partition_flags(node, pflags,