static int add_sysroot_mount(void) {
_cleanup_free_ char *what = NULL;
const char *extra_opts = NULL, *fstype = NULL;
- bool default_rw = true, makefs = false;
+ bool default_rw = true;
MountPointFlags flags;
if (!validate_root_or_usr_mount_source(arg_root_what, "root="))
log_debug("Found entry what=%s where=/sysroot type=%s opts=%s", what, strna(arg_root_fstype), strempty(combined_options));
- makefs = fstab_test_option(combined_options, "x-systemd.makefs\0");
- flags = makefs * MOUNT_MAKEFS;
+ /* Only honor x-systemd.makefs and .validatefs here, others are not relevant in initrd/not used
+ * at all (also see mandatory_mount_drop_unapplicable_options()) */
+ flags = fstab_options_to_flags(combined_options, /* is_swap = */ false) & (MOUNT_MAKEFS|MOUNT_VALIDATEFS);
return add_mount("/proc/cmdline",
arg_dest,
static int add_sysroot_usr_mount(void) {
_cleanup_free_ char *what = NULL;
const char *extra_opts = NULL;
- MountPointFlags flags;
- bool makefs;
+ bool makefs, validatefs;
int r;
/* Returns 0 if we didn't do anything, > 0 if we either generated a unit for the /usr/ mount, or we
log_debug("Found entry what=%s where=/sysusr/usr type=%s opts=%s", what, strna(arg_usr_fstype), strempty(combined_options));
+ /* Only honor x-systemd.makefs and .validatefs here, others are not relevant in initrd/not used
+ * at all (also see mandatory_mount_drop_unapplicable_options()) */
makefs = fstab_test_option(combined_options, "x-systemd.makefs\0");
- flags = makefs * MOUNT_MAKEFS;
+ validatefs = fstab_test_option(combined_options, "x-systemd.validatefs\0");
r = add_mount("/proc/cmdline",
arg_dest,
arg_usr_fstype,
combined_options,
/* passno= */ is_device_path(what) ? 1 : 0,
- flags,
+ makefs ? MOUNT_MAKEFS : 0,
SPECIAL_INITRD_USR_FS_TARGET,
"imports.target");
if (r < 0)
return r;
- r = add_sysusr_sysroot_usr_bind_mount("/proc/cmdline", /* validatefs = */ false);
+ r = add_sysusr_sysroot_usr_bind_mount("/proc/cmdline", validatefs);
if (r < 0)
return r;