pid1: include the source unit in UnitRef

No functional change.

The source unit manages the reference. It allocates the UnitRef structure and
registers it in the target unit, and then the reference must be destroyed
before the source unit is destroyed. Thus, is should be OK to include the
pointer to the source unit, it should be live as long as the reference exists.

v2:
- rename refs to refs_by_target
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-02-15 13:27:06 +01:00
parent f2f725e5cc
commit 7f7d01ed58
6 changed files with 30 additions and 30 deletions
+2 -2
View File
@@ -250,7 +250,7 @@ int socket_instantiate_service(Socket *s) {
if (r < 0)
return r;
unit_ref_set(&s->service, u);
unit_ref_set(&s->service, UNIT(s), u);
return unit_add_two_dependencies(UNIT(s), UNIT_BEFORE, UNIT_TRIGGERS, u, false, UNIT_DEPENDENCY_IMPLICIT);
}
@@ -377,7 +377,7 @@ static int socket_add_extras(Socket *s) {
if (r < 0)
return r;
unit_ref_set(&s->service, x);
unit_ref_set(&s->service, u, x);
}
r = unit_add_two_dependencies(u, UNIT_BEFORE, UNIT_TRIGGERS, UNIT_DEREF(s->service), true, UNIT_DEPENDENCY_IMPLICIT);