Lines Matching defs:other

75 static void maybe_warn_about_dependency(Unit *u, const char *other, UnitDependency dependency);
390 Unit *other;
397 SET_FOREACH(other, s, i) {
401 set_remove(other->dependencies[d], u);
403 unit_add_to_gc_queue(other);
585 static int complete_move(Set **s, Set **other) {
589 assert(other);
591 if (!*other)
595 r = set_move(*s, *other);
599 *s = *other;
600 *other = NULL;
606 static int merge_names(Unit *u, Unit *other) {
612 assert(other);
614 r = complete_move(&u->names, &other->names);
618 set_free_free(other->names);
619 other->names = NULL;
620 other->id = NULL;
628 static int reserve_dependencies(Unit *u, Unit *other, UnitDependency d) {
632 assert(other);
637 * to reserve anything. In that case other's set will be transferred
644 n_reserve = set_size(other->dependencies[d]) - !!set_get(other->dependencies[d], u);
649 static void merge_dependencies(Unit *u, Unit *other, const char *other_id, UnitDependency d) {
655 assert(other);
659 SET_FOREACH(back, other->dependencies[d], i) {
665 if (set_remove(back->dependencies[k], other))
668 r = set_remove_and_put(back->dependencies[k], other, u);
670 set_remove(back->dependencies[k], other);
678 back = set_remove(other->dependencies[d], u);
683 assert_se(complete_move(&u->dependencies[d], &other->dependencies[d]) == 0);
685 other->dependencies[d] = set_free(other->dependencies[d]);
688 int unit_merge(Unit *u, Unit *other) {
694 assert(other);
695 assert(u->manager == other->manager);
698 other = unit_follow_merge(other);
700 if (other == u)
703 if (u->type != other->type)
706 if (!u->instance != !other->instance)
709 if (other->load_state != UNIT_STUB &&
710 other->load_state != UNIT_NOT_FOUND)
713 if (other->job)
716 if (other->nop_job)
719 if (!UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other)))
722 if (other->id)
723 other_id = strdupa(other->id);
727 r = reserve_dependencies(u, other, d);
737 r = merge_names(u, other);
742 while (other->refs)
743 unit_ref_set(other->refs, u);
747 merge_dependencies(u, other, other_id, d);
749 other->load_state = UNIT_MERGED;
750 other->merged_into = u;
752 /* If there is still some data attached to the other node, we
754 if (other->load_state != UNIT_STUB)
755 if (UNIT_VTABLE(other)->done)
756 UNIT_VTABLE(other)->done(other);
759 unit_add_to_cleanup_queue(other);
765 Unit *other;
783 other = manager_get_unit(u->manager, name);
784 if (other)
785 return unit_merge(u, other);
935 Unit *other;
937 SET_FOREACH(other, following_set, i)
938 fprintf(f, "%s\tFollowing Set Member: %s\n", prefix, other->id);
977 Unit *other;
979 SET_FOREACH(other, u->dependencies[d], i)
980 fprintf(f, "%s\t%s: %s\n", prefix, unit_dependency_to_string(d), other->id);
1640 Unit *other;
1657 SET_FOREACH(other, u->dependencies[needed_dependencies[j]], i)
1658 if (unit_active_or_pending(other))
1680 Unit *other;
1692 SET_FOREACH(other, u->dependencies[UNIT_BINDS_TO], i) {
1693 if (other->job)
1696 if (!UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other)))
1710 log_unit_warning(u, "Unit is bound to inactive unit %s, but not stopping since we tried this too often recently.", other->id);
1714 assert(other);
1715 log_unit_info(u, "Unit is bound to inactive unit %s. Stopping, too.", other->id);
1725 Unit *other;
1730 SET_FOREACH(other, u->dependencies[UNIT_REQUIRES], i)
1731 if (!set_get(u->dependencies[UNIT_AFTER], other) &&
1732 !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
1733 manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, NULL, NULL);
1735 SET_FOREACH(other, u->dependencies[UNIT_BINDS_TO], i)
1736 if (!set_get(u->dependencies[UNIT_AFTER], other) &&
1737 !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
1738 manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, NULL, NULL);
1740 SET_FOREACH(other, u->dependencies[UNIT_WANTS], i)
1741 if (!set_get(u->dependencies[UNIT_AFTER], other) &&
1742 !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
1743 manager_add_job(u->manager, JOB_START, other, JOB_FAIL, NULL, NULL);
1745 SET_FOREACH(other, u->dependencies[UNIT_CONFLICTS], i)
1746 if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
1747 manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, NULL, NULL);
1749 SET_FOREACH(other, u->dependencies[UNIT_CONFLICTED_BY], i)
1750 if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
1751 manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, NULL, NULL);
1756 Unit *other;
1762 SET_FOREACH(other, u->dependencies[UNIT_BOUND_BY], i)
1763 if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
1764 manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, NULL, NULL);
1769 Unit *other;
1775 SET_FOREACH(other, u->dependencies[UNIT_REQUIRES], i)
1776 if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
1777 unit_check_unneeded(other);
1778 SET_FOREACH(other, u->dependencies[UNIT_WANTS], i)
1779 if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
1780 unit_check_unneeded(other);
1781 SET_FOREACH(other, u->dependencies[UNIT_REQUISITE], i)
1782 if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
1783 unit_check_unneeded(other);
1784 SET_FOREACH(other, u->dependencies[UNIT_BINDS_TO], i)
1785 if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
1786 unit_check_unneeded(other);
1790 Unit *other;
1800 SET_FOREACH(other, u->dependencies[UNIT_ON_FAILURE], i) {
1803 r = manager_add_job(u->manager, JOB_START, other, u->on_failure_job_mode, NULL, NULL);
1810 Unit *other;
1815 SET_FOREACH(other, u->dependencies[UNIT_TRIGGERED_BY], i)
1816 if (UNIT_VTABLE(other)->trigger_notify)
1817 UNIT_VTABLE(other)->trigger_notify(other, u);
2134 static void maybe_warn_about_dependency(Unit *u, const char *other, UnitDependency dependency) {
2141 if (streq_ptr(u->id, other))
2144 log_unit_warning(u, "Dependency %s=%s dropped, merged into %s", unit_dependency_to_string(dependency), strna(other), u->id);
2147 int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_reference) {
2174 Unit *orig_u = u, *orig_other = other;
2178 assert(other);
2181 other = unit_follow_merge(other);
2185 if (u == other) {
2195 r = set_ensure_allocated(&other->dependencies[inverse_table[d]], NULL);
2205 r = set_ensure_allocated(&other->dependencies[UNIT_REFERENCED_BY], NULL);
2210 q = set_put(u->dependencies[d], other);
2215 v = set_put(other->dependencies[inverse_table[d]], u);
2223 w = set_put(u->dependencies[UNIT_REFERENCES], other);
2229 r = set_put(other->dependencies[UNIT_REFERENCED_BY], u);
2239 set_remove(u->dependencies[d], other);
2242 set_remove(other->dependencies[inverse_table[d]], u);
2245 set_remove(u->dependencies[UNIT_REFERENCES], other);
2250 int unit_add_two_dependencies(Unit *u, UnitDependency d, UnitDependency e, Unit *other, bool add_reference) {
2255 r = unit_add_dependency(u, d, other, add_reference);
2259 return unit_add_dependency(u, e, other, add_reference);
2299 Unit *other;
2309 r = manager_load_unit(u->manager, name, path, NULL, &other);
2313 return unit_add_dependency(u, d, other, add_reference);
2318 Unit *other;
2328 r = manager_load_unit(u->manager, name, path, NULL, &other);
2332 return unit_add_two_dependencies(u, d, e, other, add_reference);
3659 Unit *other;
3670 SET_FOREACH(other, u->dependencies[UNIT_JOINS_NAMESPACE_OF], i) {
3672 *rt = unit_get_exec_runtime(other);