]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: drop effectively unused UNIT_ATOM_PROPAGATE_RESTART
authorMike Yuan <me@yhndnzj.com>
Mon, 14 Oct 2024 17:27:19 +0000 (19:27 +0200)
committerMike Yuan <me@yhndnzj.com>
Sun, 27 Oct 2024 19:02:46 +0000 (20:02 +0100)
Restart jobs are always run as stop jobs initially, and later gets
converted to start jobs by job engine. Hence UNIT_ATOM_PROPAGATE_STOP
should and does cover the restart case, as currently all dep types
with _RESTART also carries _STOP. Drop UNIT_ATOM_PROPAGATE_RESTART.

src/core/transaction.c
src/core/unit-dependency-atom.c
src/core/unit-dependency-atom.h

index 9d48768d876310eaaab99caf54a0fafea44a4356..1ab59b823e577d269e94990970dac86485be9f63 100644 (file)
@@ -1087,7 +1087,7 @@ int transaction_add_job_and_dependencies(
         if (IN_SET(type, JOB_RESTART, JOB_STOP) || (type == JOB_START && FLAGS_SET(flags, TRANSACTION_PROPAGATE_START_AS_RESTART))) {
                 bool is_stop = type == JOB_STOP;
 
-                UNIT_FOREACH_DEPENDENCY(dep, ret->unit, is_stop ? UNIT_ATOM_PROPAGATE_STOP : UNIT_ATOM_PROPAGATE_RESTART) {
+                UNIT_FOREACH_DEPENDENCY(dep, ret->unit, UNIT_ATOM_PROPAGATE_STOP) {
                         /* We propagate RESTART only as TRY_RESTART, in order not to start dependencies that
                          * are not around. */
                         JobType nt;
index 35b279b5c743967cb291e051a3daf16125a0c2b7..aba58612f7cfe451e108311c70d508a34dad0a68 100644 (file)
@@ -33,8 +33,6 @@ static const UnitDependencyAtom atom_map[_UNIT_DEPENDENCY_MAX] = {
                                         UNIT_ATOM_ADD_STOP_WHEN_UNNEEDED_QUEUE |
                                         UNIT_ATOM_ADD_DEFAULT_TARGET_DEPENDENCY_QUEUE,
 
-        [UNIT_PART_OF]                = UNIT_ATOM_ADD_DEFAULT_TARGET_DEPENDENCY_QUEUE,
-
         [UNIT_UPHOLDS]                = UNIT_ATOM_PULL_IN_START_IGNORED |
                                         UNIT_ATOM_RETROACTIVE_START_REPLACE |
                                         UNIT_ATOM_ADD_START_WHEN_UPHELD_QUEUE |
@@ -42,13 +40,11 @@ static const UnitDependencyAtom atom_map[_UNIT_DEPENDENCY_MAX] = {
                                         UNIT_ATOM_ADD_DEFAULT_TARGET_DEPENDENCY_QUEUE,
 
         [UNIT_REQUIRED_BY]            = UNIT_ATOM_PROPAGATE_STOP |
-                                        UNIT_ATOM_PROPAGATE_RESTART |
                                         UNIT_ATOM_PROPAGATE_START_FAILURE |
                                         UNIT_ATOM_PINS_STOP_WHEN_UNNEEDED |
                                         UNIT_ATOM_DEFAULT_TARGET_DEPENDENCIES,
 
         [UNIT_REQUISITE_OF]           = UNIT_ATOM_PROPAGATE_STOP |
-                                        UNIT_ATOM_PROPAGATE_RESTART |
                                         UNIT_ATOM_PROPAGATE_START_FAILURE |
                                         UNIT_ATOM_PROPAGATE_INACTIVE_START_AS_FAILURE |
                                         UNIT_ATOM_PINS_STOP_WHEN_UNNEEDED |
@@ -59,7 +55,6 @@ static const UnitDependencyAtom atom_map[_UNIT_DEPENDENCY_MAX] = {
 
         [UNIT_BOUND_BY]               = UNIT_ATOM_RETROACTIVE_STOP_ON_STOP |
                                         UNIT_ATOM_PROPAGATE_STOP |
-                                        UNIT_ATOM_PROPAGATE_RESTART |
                                         UNIT_ATOM_PROPAGATE_START_FAILURE |
                                         UNIT_ATOM_PINS_STOP_WHEN_UNNEEDED |
                                         UNIT_ATOM_ADD_CANNOT_BE_ACTIVE_WITHOUT_QUEUE |
@@ -69,9 +64,6 @@ static const UnitDependencyAtom atom_map[_UNIT_DEPENDENCY_MAX] = {
                                         UNIT_ATOM_DEFAULT_TARGET_DEPENDENCIES |
                                         UNIT_ATOM_PINS_STOP_WHEN_UNNEEDED,
 
-        [UNIT_CONSISTS_OF]            = UNIT_ATOM_PROPAGATE_STOP |
-                                        UNIT_ATOM_PROPAGATE_RESTART,
-
         [UNIT_CONFLICTS]              = UNIT_ATOM_PULL_IN_STOP |
                                         UNIT_ATOM_RETROACTIVE_STOP_ON_START,
 
@@ -89,6 +81,8 @@ static const UnitDependencyAtom atom_map[_UNIT_DEPENDENCY_MAX] = {
         [UNIT_ON_SUCCESS_OF]          = UNIT_ATOM_ON_SUCCESS_OF,
         [UNIT_BEFORE]                 = UNIT_ATOM_BEFORE,
         [UNIT_AFTER]                  = UNIT_ATOM_AFTER,
+        [UNIT_PART_OF]                = UNIT_ATOM_ADD_DEFAULT_TARGET_DEPENDENCY_QUEUE,
+        [UNIT_CONSISTS_OF]            = UNIT_ATOM_PROPAGATE_STOP,
         [UNIT_TRIGGERS]               = UNIT_ATOM_TRIGGERS,
         [UNIT_TRIGGERED_BY]           = UNIT_ATOM_TRIGGERED_BY,
         [UNIT_PROPAGATES_RELOAD_TO]   = UNIT_ATOM_PROPAGATES_RELOAD_TO,
@@ -160,7 +154,6 @@ UnitDependency unit_dependency_from_unique_atom(UnitDependencyAtom atom) {
                 return UNIT_UPHOLDS;
 
         case UNIT_ATOM_PROPAGATE_STOP |
-                UNIT_ATOM_PROPAGATE_RESTART |
                 UNIT_ATOM_PROPAGATE_START_FAILURE |
                 UNIT_ATOM_PROPAGATE_INACTIVE_START_AS_FAILURE |
                 UNIT_ATOM_PINS_STOP_WHEN_UNNEEDED |
@@ -170,7 +163,6 @@ UnitDependency unit_dependency_from_unique_atom(UnitDependencyAtom atom) {
 
         case UNIT_ATOM_RETROACTIVE_STOP_ON_STOP |
                 UNIT_ATOM_PROPAGATE_STOP |
-                UNIT_ATOM_PROPAGATE_RESTART |
                 UNIT_ATOM_PROPAGATE_START_FAILURE |
                 UNIT_ATOM_PINS_STOP_WHEN_UNNEEDED |
                 UNIT_ATOM_ADD_CANNOT_BE_ACTIVE_WITHOUT_QUEUE |
index 96f00ca39a89d802227f513f5d39d196a5b92fc6..89a3eae1bf0ca5ff9281fe6997e4e7b95bc0b7bf 100644 (file)
@@ -56,35 +56,33 @@ typedef enum UnitDependencyAtom {
         /* If our start job succeeded but the unit is inactive then (think: oneshot units), propagate this as
          * failure to the other unit. */
         UNIT_ATOM_PROPAGATE_INACTIVE_START_AS_FAILURE = UINT64_C(1) << 17,
-        /* When putting together a transaction, propagate JOB_STOP from our unit to the other. */
+        /* When putting together a transaction, propagate JOB_STOP/JOB_RESTART from our unit to the other. */
         UNIT_ATOM_PROPAGATE_STOP                      = UINT64_C(1) << 18,
         /* Like UNIT_ATOM_PROPAGATE_STOP, but enqueues a restart job if there's already a start job (avoids
          * job type conflict). */
         UNIT_ATOM_PROPAGATE_STOP_GRACEFUL             = UINT64_C(1) << 19,
-        /* When putting together a transaction, propagate JOB_RESTART from our unit to the other. */
-        UNIT_ATOM_PROPAGATE_RESTART                   = UINT64_C(1) << 20,
 
         /* Add the other unit to the default target dependency queue */
-        UNIT_ATOM_ADD_DEFAULT_TARGET_DEPENDENCY_QUEUE = UINT64_C(1) << 21,
+        UNIT_ATOM_ADD_DEFAULT_TARGET_DEPENDENCY_QUEUE = UINT64_C(1) << 20,
         /* Recheck default target deps on other units (which are target units) */
-        UNIT_ATOM_DEFAULT_TARGET_DEPENDENCIES         = UINT64_C(1) << 22,
+        UNIT_ATOM_DEFAULT_TARGET_DEPENDENCIES         = UINT64_C(1) << 21,
 
         /* The remaining atoms map 1:1 to the equally named high-level deps */
-        UNIT_ATOM_ON_FAILURE                          = UINT64_C(1) << 23,
-        UNIT_ATOM_ON_SUCCESS                          = UINT64_C(1) << 24,
-        UNIT_ATOM_ON_FAILURE_OF                       = UINT64_C(1) << 25,
-        UNIT_ATOM_ON_SUCCESS_OF                       = UINT64_C(1) << 26,
-        UNIT_ATOM_BEFORE                              = UINT64_C(1) << 27,
-        UNIT_ATOM_AFTER                               = UINT64_C(1) << 28,
-        UNIT_ATOM_TRIGGERS                            = UINT64_C(1) << 29,
-        UNIT_ATOM_TRIGGERED_BY                        = UINT64_C(1) << 30,
-        UNIT_ATOM_PROPAGATES_RELOAD_TO                = UINT64_C(1) << 31,
-        UNIT_ATOM_JOINS_NAMESPACE_OF                  = UINT64_C(1) << 32,
-        UNIT_ATOM_REFERENCES                          = UINT64_C(1) << 33,
-        UNIT_ATOM_REFERENCED_BY                       = UINT64_C(1) << 34,
-        UNIT_ATOM_IN_SLICE                            = UINT64_C(1) << 35,
-        UNIT_ATOM_SLICE_OF                            = UINT64_C(1) << 36,
-        _UNIT_DEPENDENCY_ATOM_MAX                     = (UINT64_C(1) << 37) - 1,
+        UNIT_ATOM_ON_FAILURE                          = UINT64_C(1) << 22,
+        UNIT_ATOM_ON_SUCCESS                          = UINT64_C(1) << 23,
+        UNIT_ATOM_ON_FAILURE_OF                       = UINT64_C(1) << 24,
+        UNIT_ATOM_ON_SUCCESS_OF                       = UINT64_C(1) << 25,
+        UNIT_ATOM_BEFORE                              = UINT64_C(1) << 26,
+        UNIT_ATOM_AFTER                               = UINT64_C(1) << 27,
+        UNIT_ATOM_TRIGGERS                            = UINT64_C(1) << 28,
+        UNIT_ATOM_TRIGGERED_BY                        = UINT64_C(1) << 29,
+        UNIT_ATOM_PROPAGATES_RELOAD_TO                = UINT64_C(1) << 30,
+        UNIT_ATOM_JOINS_NAMESPACE_OF                  = UINT64_C(1) << 31,
+        UNIT_ATOM_REFERENCES                          = UINT64_C(1) << 32,
+        UNIT_ATOM_REFERENCED_BY                       = UINT64_C(1) << 33,
+        UNIT_ATOM_IN_SLICE                            = UINT64_C(1) << 34,
+        UNIT_ATOM_SLICE_OF                            = UINT64_C(1) << 35,
+        _UNIT_DEPENDENCY_ATOM_MAX                     = (UINT64_C(1) << 36) - 1,
         _UNIT_DEPENDENCY_ATOM_INVALID                 = -EINVAL,
 } UnitDependencyAtom;