]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkfs-util: add fsverity option to make_filesystem()
authorAllison Karlitskaya <allison.karlitskaya@redhat.com>
Mon, 2 Dec 2024 20:00:47 +0000 (21:00 +0100)
committerAllison Karlitskaya <allison.karlitskaya@redhat.com>
Tue, 27 May 2025 07:26:02 +0000 (09:26 +0200)
Add an fsverity flag to MkfsFlags and use it to pass the `-O verity`
option when creating an ext4 or f2fs filesystem: they share the same
argument for this.

The only other filesystem that currently supports fs-verity is btrfs and
it doesn't require a flag to be enabled when creating the filesystem.

Nothing uses this yet.

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
src/shared/mkfs-util.c
src/shared/mkfs-util.h

index e8412cb4b0268fa5c04799d7247c0f5377595135..629d02207c14610f63b81c65add1cf4bfc22c637 100644 (file)
@@ -435,6 +435,9 @@ int make_filesystem(
                 if (FLAGS_SET(flags, MKFS_QUIET) && strv_extend(&argv, "-q") < 0)
                         return log_oom();
 
+                if (FLAGS_SET(flags, MKFS_FS_VERITY) && strv_extend_many(&argv, "-O", "verity") < 0)
+                        return log_oom();
+
                 if (strv_extend(&argv, node) < 0)
                         return log_oom();
 
@@ -501,6 +504,9 @@ int make_filesystem(
                 if (FLAGS_SET(flags, MKFS_QUIET) && strv_extend(&argv, "-q") < 0)
                         return log_oom();
 
+                if (FLAGS_SET(flags, MKFS_FS_VERITY) && strv_extend_many(&argv, "-O", "verity") < 0)
+                        return log_oom();
+
                 if (sector_size > 0) {
                         if (strv_extend(&argv, "-w") < 0)
                                 return log_oom();
index ca2fae7e3e08a87a017bd9593a805aa99f48af91..2e83370d03c08e638065900b1b22df30469da417 100644 (file)
@@ -8,6 +8,7 @@
 typedef enum MakeFilesystemFlags {
         MKFS_QUIET     = 1 << 0,  /* Suppress mkfs command output */
         MKFS_DISCARD   = 1 << 1,  /* Enable 'discard' mode on the filesystem */
+        MKFS_FS_VERITY = 1 << 2,  /* Enable fs-verity support on the filesystem */
 } MakeFileSystemFlags;
 
 int mkfs_exists(const char *fstype);