]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect: add new helper dissected_partition_fstype()
authorLennart Poettering <lennart@poettering.net>
Tue, 7 Mar 2023 13:39:47 +0000 (14:39 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 9 Mar 2023 15:15:26 +0000 (16:15 +0100)
Initially we only have one user, but following patches will add more.

src/shared/dissect-image.c
src/shared/dissect-image.h

index 9636fd8d48a2490d5959cae64a864aabdad75979..46be0612965aae8d7fda2e4eeee4d65ff497ed40 100644 (file)
@@ -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;
index 6b90895216cbaca34846eb4339d2dea67046cb6b..ff69ec45394dd2cb8f3673bdc9a5e15cd3a46c16 100644 (file)
@@ -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;
+}