+static int mount_add_device_links(Mount *m) {
+ MountParameters *p;
+ bool nofail, noauto;
+
+ assert(m);
+
+ if (m->from_fragment)
+ p = &m->parameters_fragment;
+ else if (m->from_etc_fstab)
+ p = &m->parameters_etc_fstab;
+ else
+ return 0;
+
+ if (!p->what || path_equal(m->where, "/"))
+ return 0;
+
+ noauto = !!mount_test_option(p->options, MNTOPT_NOAUTO);
+ nofail = !!mount_test_option(p->options, "nofail");
+
+ return unit_add_node_link(UNIT(m), p->what,
+ !noauto && nofail &&
+ UNIT(m)->meta.manager->running_as == MANAGER_SYSTEM);
+}
+
+static int mount_add_default_dependencies(Mount *m) {
+ int r;
+
+ assert(m);
+
+ if (m->meta.manager->running_as == MANAGER_SYSTEM &&
+ !path_equal(m->where, "/")) {
+
+ if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, SPECIAL_FSCK_TARGET, NULL, true)) < 0)
+ return r;
+
+ if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTED_BY, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+ return r;
+ }
+
+ return 0;
+}
+