}
static int add_swap(
+ const char *source,
const char *what,
struct mntent *me,
MountPointFlags flags) {
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- r = generator_open_unit_file(arg_dest, fstab_path(), name, &f);
+ r = generator_open_unit_file(arg_dest, source, name, &f);
if (r < 0)
return r;
"[Unit]\n"
"Documentation=man:fstab(5) man:systemd-fstab-generator(8)\n"
"SourcePath=%s\n",
- fstab_path());
+ source);
r = generator_write_blockdev_dependency(f, what);
if (r < 0)
}
static int add_mount(
+ const char *source,
const char *dest,
const char *what,
const char *where,
const char *opts,
int passno,
MountPointFlags flags,
- const char *post,
- const char *source) {
+ const char *post) {
_cleanup_free_ char
*name = NULL,
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- r = generator_open_unit_file(dest, fstab_path(), name, &f);
+ r = generator_open_unit_file(dest, source, name, &f);
if (r < 0)
return r;
f = safe_fclose(f);
- r = generator_open_unit_file(dest, fstab_path(), automount_name, &f);
+ r = generator_open_unit_file(dest, source, automount_name, &f);
if (r < 0)
return r;
nofail * MOUNT_NOFAIL;
if (streq(me->mnt_type, "swap"))
- k = add_swap(what, me, flags);
+ k = add_swap(fstab, what, me, flags);
else {
bool rw_only, automount;
const char *post;
else
post = SPECIAL_LOCAL_FS_TARGET;
- k = add_mount(arg_dest,
+ k = add_mount(fstab,
+ arg_dest,
what,
canonical_where ?: where,
canonical_where ? where: NULL,
me->mnt_opts,
me->mnt_passno,
flags,
- post,
- fstab);
+ post);
}
if (r >= 0 && k < 0)
return r;
}
- return add_mount(arg_dest,
+ return add_mount("/proc/cmdline",
+ arg_dest,
what,
"/sysroot",
NULL,
opts,
is_device_path(what) ? 1 : 0, /* passno */
0, /* makefs off, growfs off, noauto off, nofail off, automount off */
- SPECIAL_INITRD_ROOT_FS_TARGET,
- "/proc/cmdline");
+ SPECIAL_INITRD_ROOT_FS_TARGET);
}
static int add_sysroot_usr_mount(void) {
log_debug("Found entry what=%s where=/sysusr/usr type=%s opts=%s", what, strna(arg_usr_fstype), strempty(opts));
- r = add_mount(arg_dest,
+ r = add_mount("/proc/cmdline",
+ arg_dest,
what,
"/sysusr/usr",
NULL,
opts,
is_device_path(what) ? 1 : 0, /* passno */
0,
- SPECIAL_INITRD_USR_FS_TARGET,
- "/proc/cmdline");
+ SPECIAL_INITRD_USR_FS_TARGET);
if (r < 0)
return r;
log_debug("Synthesizing entry what=/sysusr/usr where=/sysrootr/usr opts=bind");
- r = add_mount(arg_dest,
+ r = add_mount("/proc/cmdline",
+ arg_dest,
"/sysusr/usr",
"/sysroot/usr",
NULL,
"bind",
0,
0,
- SPECIAL_INITRD_FS_TARGET,
- "/proc/cmdline");
+ SPECIAL_INITRD_FS_TARGET);
if (r < 0)
return r;
/* If requested, mount /var as tmpfs, but do so only if there's nothing else defined for this. */
- return add_mount(arg_dest_late,
+ return add_mount("/proc/cmdline",
+ arg_dest_late,
"tmpfs",
"/var",
NULL,
"mode=0755" TMPFS_LIMITS_VAR,
0,
0,
- SPECIAL_LOCAL_FS_TARGET,
- "/proc/cmdline");
+ SPECIAL_LOCAL_FS_TARGET);
}
static int parse_proc_cmdline_item(const char *key, const char *value, void *data) {