-static int add_mount(const char *what, const char *where, const char *type, const char *opts,
- int passno, bool wait, bool noauto, bool nofail, bool automount, bool isbind, bool isnetwork,
- const char *source) {
- char *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL, *automount_name = NULL, *automount_unit = NULL;
- FILE *f = NULL;
+static bool mount_in_initrd(struct mntent *me) {
+ assert(me);
+
+ return
+ hasmntopt(me, "x-initrd.mount") ||
+ streq(me->mnt_dir, "/usr");
+}
+
+static bool mount_is_rootfs(struct mntent *me) {
+ assert(me);
+
+ return hasmntopt(me, "x-initrd.rootfs");
+}
+
+static int add_mount(
+ const char *what,
+ const char *where,
+ const char *type,
+ const char *opts,
+ int passno,
+ bool noauto,
+ bool nofail,
+ bool automount,
+ bool isbind,
+ const char *pre,
+ const char *post,
+ const char *setup,
+ const char *source) {
+ char _cleanup_free_
+ *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL,
+ *automount_name = NULL, *automount_unit = NULL;
+ FILE _cleanup_fclose_ *f = NULL;