* 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)
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;
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;
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;
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;
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)))
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;
}
void mount_fd_event(Manager *m, int events) {
- Unit *meta;
+ Unit *u;
int r;
assert(m);
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;
}
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. */