Debian Codegraph @

src/core/unit-dependency-atom.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "core-forward.h"
5
6 /* Flags that identify the various "atomic" behaviours a specific dependency type implies. Each dependency is
7 * a combination of one or more of these flags that define what they actually entail. */
8 typedef enum UnitDependencyAtom {
9
10 /* This unit pulls in the other unit as JOB_START job into the transaction, and if that doesn't work
11 * the transaction fails. */
12 UNIT_ATOM_PULL_IN_START = UINT64_C(1) << 0,
13 /* Similar, but if it doesn't work, ignore. */
14 UNIT_ATOM_PULL_IN_START_IGNORED = UINT64_C(1) << 1,
15 /* Pull in a JOB_VERIFY job into the transaction, i.e. pull in JOB_VERIFY rather than
16 * JOB_START. i.e. check the unit is started but don't pull it in. */
17 UNIT_ATOM_PULL_IN_VERIFY = UINT64_C(1) << 2,
18
19 /* Pull in a JOB_STOP job for the other job into transactions, and fail if that doesn't work. */
20 UNIT_ATOM_PULL_IN_STOP = UINT64_C(1) << 3,
21 /* Same, but don't fail, ignore it. */
22 UNIT_ATOM_PULL_IN_STOP_IGNORED = UINT64_C(1) << 4,
23
24 /* If our enters inactive state, add the other unit to the StopWhenUneeded= queue */
25 UNIT_ATOM_ADD_STOP_WHEN_UNNEEDED_QUEUE = UINT64_C(1) << 5,
26 /* Pin the other unit i.e. ensure StopWhenUneeded= won't trigger for the other unit as long as we are
27 * not in inactive state */
28 UNIT_ATOM_PINS_STOP_WHEN_UNNEEDED = UINT64_C(1) << 6,
29
30 /* Stop our unit if the other unit happens to inactive */
31 UNIT_ATOM_CANNOT_BE_ACTIVE_WITHOUT = UINT64_C(1) << 7,
32 /* If our unit enters inactive state, add the other unit to the BoundBy= queue */
33 UNIT_ATOM_ADD_CANNOT_BE_ACTIVE_WITHOUT_QUEUE = UINT64_C(1) << 8,
34
35 /* Start this unit whenever we find it inactive and the other unit active */
36 UNIT_ATOM_START_STEADILY = UINT64_C(1) << 9,
37 /* Whenever our unit becomes active, add other unit to start_when_upheld_queue */
38 UNIT_ATOM_ADD_START_WHEN_UPHELD_QUEUE = UINT64_C(1) << 10,
39
40 /* If our unit unexpectedly becomes active, retroactively start the other unit too, in "replace" job
41 * mode */
42 UNIT_ATOM_RETROACTIVE_START_REPLACE = UINT64_C(1) << 11,
43 /* Similar, but in "fail" job mode */
44 UNIT_ATOM_RETROACTIVE_START_FAIL = UINT64_C(1) << 12,
45 /* If our unit unexpectedly becomes active, retroactively stop the other unit too */
46 UNIT_ATOM_RETROACTIVE_STOP_ON_START = UINT64_C(1) << 13,
47 /* If our unit unexpectedly becomes inactive, retroactively stop the other unit too */
48 UNIT_ATOM_RETROACTIVE_STOP_ON_STOP = UINT64_C(1) << 14,
49
50 /* If a start job for this unit fails, propagate the failure to start job of other unit too */
51 UNIT_ATOM_PROPAGATE_START_FAILURE = UINT64_C(1) << 15,
52 /* If a stop job for this unit fails, propagate the failure to any stop job of the other unit too */
53 UNIT_ATOM_PROPAGATE_STOP_FAILURE = UINT64_C(1) << 16,
54 /* If our start job succeeded but the unit is inactive then (think: oneshot units), propagate this as
55 * failure to the other unit. */
56 UNIT_ATOM_PROPAGATE_INACTIVE_START_AS_FAILURE = UINT64_C(1) << 17,
57 /* When putting together a transaction, propagate JOB_STOP/JOB_RESTART from our unit to the other. */
58 UNIT_ATOM_PROPAGATE_STOP = UINT64_C(1) << 18,
59 /* Like UNIT_ATOM_PROPAGATE_STOP, but enqueues a restart job if there's already a start job (avoids
60 * job type conflict). */
61 UNIT_ATOM_PROPAGATE_STOP_GRACEFUL = UINT64_C(1) << 19,
62
63 /* Add the other unit to the default target dependency queue */
64 UNIT_ATOM_ADD_DEFAULT_TARGET_DEPENDENCY_QUEUE = UINT64_C(1) << 20,
65 /* Recheck default target deps on other units (which are target units) */
66 UNIT_ATOM_DEFAULT_TARGET_DEPENDENCIES = UINT64_C(1) << 21,
67
68 /* The remaining atoms map 1:1 to the equally named high-level deps */
69 UNIT_ATOM_ON_FAILURE = UINT64_C(1) << 22,
70 UNIT_ATOM_ON_SUCCESS = UINT64_C(1) << 23,
71 UNIT_ATOM_ON_FAILURE_OF = UINT64_C(1) << 24,
72 UNIT_ATOM_ON_SUCCESS_OF = UINT64_C(1) << 25,
73 UNIT_ATOM_BEFORE = UINT64_C(1) << 26,
74 UNIT_ATOM_AFTER = UINT64_C(1) << 27,
75 UNIT_ATOM_TRIGGERS = UINT64_C(1) << 28,
76 UNIT_ATOM_TRIGGERED_BY = UINT64_C(1) << 29,
77 UNIT_ATOM_PROPAGATES_RELOAD_TO = UINT64_C(1) << 30,
78 UNIT_ATOM_JOINS_NAMESPACE_OF = UINT64_C(1) << 31,
79 UNIT_ATOM_REFERENCES = UINT64_C(1) << 32,
80 UNIT_ATOM_REFERENCED_BY = UINT64_C(1) << 33,
81 UNIT_ATOM_IN_SLICE = UINT64_C(1) << 34,
82 UNIT_ATOM_SLICE_OF = UINT64_C(1) << 35,
83 _UNIT_DEPENDENCY_ATOM_MAX = (UINT64_C(1) << 36) - 1,
84 _UNIT_DEPENDENCY_ATOM_INVALID = -EINVAL,
85 } UnitDependencyAtom;
86
87 UnitDependencyAtom unit_dependency_to_atom(UnitDependency d);
88 UnitDependency unit_dependency_from_unique_atom(UnitDependencyAtom atom);