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>
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();
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();
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);