static int add_cryptsetup(
const char *id,
const char *what,
+ const char *mount_opts,
bool rw,
bool require,
bool measure,
if (r < 0)
return log_error_errno(r, "Failed to write file %s: %m", n);
+ r = generator_write_device_timeout(arg_dest, what, mount_opts, /* filtered = */ NULL);
+ if (r < 0)
+ return r;
+
r = generator_add_symlink(arg_dest, d, "wants", n);
if (r < 0)
return r;
const char *description,
const char *post) {
- _cleanup_free_ char *unit = NULL, *crypto_what = NULL;
+ _cleanup_free_ char *unit = NULL, *crypto_what = NULL, *opts_filtered = NULL;
_cleanup_fclose_ FILE *f = NULL;
int r;
log_debug("Adding %s: %s fstype=%s", where, what, fstype ?: "(any)");
if (streq_ptr(fstype, "crypto_LUKS")) {
- r = add_cryptsetup(id, what, rw, /* require= */ true, measure, &crypto_what);
+ /* Mount options passed are determined by partition_pick_mount_options(), whose result
+ * is known to not contain timeout options. */
+ r = add_cryptsetup(id, what, /* mount_opts = */ NULL, rw, /* require= */ true, measure, &crypto_what);
if (r < 0)
return r;
fstype, where);
}
+ r = generator_write_device_timeout(arg_dest, what, options, &opts_filtered);
+ if (r < 0)
+ return r;
+
r = unit_name_from_path(where, ".mount", &unit);
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
if (fstype)
fprintf(f, "Type=%s\n", fstype);
- if (options)
- fprintf(f, "Options=%s\n", options);
+ if (opts_filtered)
+ fprintf(f, "Options=%s\n", opts_filtered);
+
+ r = generator_write_mount_timeout(f, where, opts_filtered);
+ if (r < 0)
+ return r;
r = fflush_and_check(f);
if (r < 0)
}
if (streq_ptr(p->fstype, "crypto_LUKS")) {
- r = add_cryptsetup("swap", p->node, /* rw= */ true, /* require= */ true, /* measure= */ false, &crypto_what);
+ r = add_cryptsetup("swap", p->node, /* mount_opts = */ NULL, /* rw= */ true, /* require= */ true, /* measure= */ false, &crypto_what);
if (r < 0)
return r;
what = crypto_what;
/* If a device /dev/gpt-auto-root-luks appears, then make it pull in systemd-cryptsetup-root.service, which
* sets it up, and causes /dev/gpt-auto-root to appear which is all we are looking for. */
- return add_cryptsetup("root", "/dev/gpt-auto-root-luks", /* rw= */ true, /* require= */ false, /* measure= */ true, NULL);
+ return add_cryptsetup("root", "/dev/gpt-auto-root-luks", arg_root_options, /* rw= */ true, /* require= */ false, /* measure= */ true, NULL);
#else
return 0;
#endif