chiark / gitweb /
main: don't force text mode in console_setup()
[elogind.git] / src / mount.c
index 5c45686c2a0806d6f80e8bf7506cb7a8112b2e0b..965f70567b877601883b56d7d7fb02b20e291058 100644 (file)
@@ -160,7 +160,7 @@ static int mount_add_mount_links(Mount *m) {
          * above us in the hierarchy */
 
         LIST_FOREACH(units_by_type, other, UNIT(m)->manager->units_by_type[UNIT_MOUNT]) {
-                Mount *n = (Mount*) other;
+                Mount *n = MOUNT(other);
                 MountParameters *pn;
 
                 if (n == m)
@@ -217,7 +217,7 @@ static int mount_add_swap_links(Mount *m) {
         assert(m);
 
         LIST_FOREACH(units_by_type, other, UNIT(m)->manager->units_by_type[UNIT_SWAP])
-                if ((r = swap_add_one_mount_link((Swap*) other, m)) < 0)
+                if ((r = swap_add_one_mount_link(SWAP(other), m)) < 0)
                         return r;
 
         return 0;
@@ -230,7 +230,7 @@ static int mount_add_path_links(Mount *m) {
         assert(m);
 
         LIST_FOREACH(units_by_type, other, UNIT(m)->manager->units_by_type[UNIT_PATH])
-                if ((r = path_add_one_mount_link((Path*) other, m)) < 0)
+                if ((r = path_add_one_mount_link(PATH(other), m)) < 0)
                         return r;
 
         return 0;
@@ -243,7 +243,7 @@ static int mount_add_automount_links(Mount *m) {
         assert(m);
 
         LIST_FOREACH(units_by_type, other, UNIT(m)->manager->units_by_type[UNIT_AUTOMOUNT])
-                if ((r = automount_add_one_mount_link((Automount*) other, m)) < 0)
+                if ((r = automount_add_one_mount_link(AUTOMOUNT(other), m)) < 0)
                         return r;
 
         return 0;
@@ -256,7 +256,7 @@ static int mount_add_socket_links(Mount *m) {
         assert(m);
 
         LIST_FOREACH(units_by_type, other, UNIT(m)->manager->units_by_type[UNIT_SOCKET])
-                if ((r = socket_add_one_mount_link((Socket*) other, m)) < 0)
+                if ((r = socket_add_one_mount_link(SOCKET(other), m)) < 0)
                         return r;
 
         return 0;
@@ -583,6 +583,11 @@ static int mount_load(Unit *u) {
 
                 if (UNIT(m)->fragment_path)
                         m->from_fragment = true;
+                else if (m->from_etc_fstab)
+                        /* We always add several default dependencies to fstab mounts,
+                         * but we do not want the implicit complementing of Wants= with After=
+                         * in the target unit that this mount unit will be hooked into. */
+                        UNIT(m)->default_dependencies = false;
 
                 if (!m->where)
                         if (!(m->where = unit_name_to_path(u->id)))
@@ -615,7 +620,7 @@ static int mount_load(Unit *u) {
                 if ((r = mount_add_fstab_links(m)) < 0)
                         return r;
 
-                if (UNIT(m)->default_dependencies)
+                if (UNIT(m)->default_dependencies || m->from_etc_fstab)
                         if ((r = mount_add_default_dependencies(m)) < 0)
                                 return r;
 
@@ -1679,7 +1684,7 @@ fail:
 }
 
 void mount_fd_event(Manager *m, int events) {
-        Unit *meta;
+        Unit *u;
         int r;
 
         assert(m);
@@ -1693,8 +1698,8 @@ void mount_fd_event(Manager *m, int events) {
                 log_error("Failed to reread /proc/self/mountinfo: %s", strerror(-r));
 
                 /* Reset flags, just in case, for later calls */
-                LIST_FOREACH(units_by_type, meta, m->units_by_type[UNIT_MOUNT]) {
-                        Mount *mount = (Mount*) meta;
+                LIST_FOREACH(units_by_type, u, m->units_by_type[UNIT_MOUNT]) {
+                        Mount *mount = MOUNT(u);
 
                         mount->is_mounted = mount->just_mounted = mount->just_changed = false;
                 }
@@ -1704,8 +1709,8 @@ void mount_fd_event(Manager *m, int events) {
 
         manager_dispatch_load_queue(m);
 
-        LIST_FOREACH(units_by_type, meta, m->units_by_type[UNIT_MOUNT]) {
-                Mount *mount = (Mount*) meta;
+        LIST_FOREACH(units_by_type, u, m->units_by_type[UNIT_MOUNT]) {
+                Mount *mount = MOUNT(u);
 
                 if (!mount->is_mounted) {
                         /* This has just been unmounted. */