From c571dee74bf5bea67bbe94e3734d19b1092765dd Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 7 Mar 2023 14:39:47 +0100 Subject: [PATCH] dissect: add new helper dissected_partition_fstype() Initially we only have one user, but following patches will add more. --- src/shared/dissect-image.c | 2 +- src/shared/dissect-image.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index 9636fd8d48a..46be0612965 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -1523,7 +1523,7 @@ static int mount_partition( /* Use decrypted node and matching fstype if available, otherwise use the original device */ node = FORMAT_PROC_FD_PATH(m->mount_node_fd); - fstype = m->decrypted_node ? m->decrypted_fstype: m->fstype; + fstype = dissected_partition_fstype(m); if (!fstype) return -EAFNOSUPPORT; diff --git a/src/shared/dissect-image.h b/src/shared/dissect-image.h index 6b90895216c..ff69ec45394 100644 --- a/src/shared/dissect-image.h +++ b/src/shared/dissect-image.h @@ -193,3 +193,9 @@ int dissect_fstype_ok(const char *fstype); int probe_sector_size(int fd, uint32_t *ret); int probe_sector_size_prefer_ioctl(int fd, uint32_t *ret); + +static inline const char *dissected_partition_fstype(const DissectedPartition *m) { + assert(m); + + return m->decrypted_node ? m->decrypted_fstype : m->fstype; +} -- 2.47.3