From: Lennart Poettering Date: Tue, 7 Mar 2023 13:39:47 +0000 (+0100) Subject: dissect: add new helper dissected_partition_fstype() X-Git-Tag: v254-rc1~1073^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c571dee74bf5bea67bbe94e3734d19b1092765dd;p=thirdparty%2Fsystemd.git dissect: add new helper dissected_partition_fstype() Initially we only have one user, but following patches will add more. --- 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; +}