-static Job* transaction_add_job(Manager *m, JobType type, Name *name, bool *is_new) {
+static Job* transaction_add_one_job(Manager *m, JobType type, Name *name, bool *is_new) {
-static int real_add_job(Manager *m, JobType type, Name *name, Job *by, bool matters, bool force, Job **_ret) {
+static int transaction_add_job_and_dependencies(Manager *m, JobType type, Name *name, Job *by, bool matters, bool force, Job **_ret) {
- if (!(ret = transaction_add_job(m, type, name, &is_new)))
+ if (!(ret = transaction_add_one_job(m, type, name, &is_new)))
/* Finally, recursively add in all dependencies. */
if (type == JOB_START || type == JOB_RELOAD_OR_START) {
SET_FOREACH(dep, ret->name->meta.dependencies[NAME_REQUIRES], state)
/* Finally, recursively add in all dependencies. */
if (type == JOB_START || type == JOB_RELOAD_OR_START) {
SET_FOREACH(dep, ret->name->meta.dependencies[NAME_REQUIRES], state)
- if ((r = real_add_job(m, JOB_START, dep, ret, true, force, NULL)) < 0)
+ if ((r = transaction_add_job_and_dependencies(m, JOB_START, dep, ret, true, force, NULL)) < 0)
- if ((r = real_add_job(m, JOB_START, dep, ret, !force, force, NULL)) < 0)
+ if ((r = transaction_add_job_and_dependencies(m, JOB_START, dep, ret, !force, force, NULL)) < 0)
- if ((r = real_add_job(m, JOB_START, dep, ret, false, force, NULL)) < 0)
+ if ((r = transaction_add_job_and_dependencies(m, JOB_START, dep, ret, false, force, NULL)) < 0)
- if ((r = real_add_job(m, JOB_VERIFY_STARTED, dep, ret, true, force, NULL)) < 0)
+ if ((r = transaction_add_job_and_dependencies(m, JOB_VERIFY_STARTED, dep, ret, true, force, NULL)) < 0)
- if ((r = real_add_job(m, JOB_VERIFY_STARTED, dep, ret, !force, force, NULL)) < 0)
+ if ((r = transaction_add_job_and_dependencies(m, JOB_VERIFY_STARTED, dep, ret, !force, force, NULL)) < 0)
- if ((r = real_add_job(m, JOB_STOP, dep, ret, true, force, NULL)) < 0)
+ if ((r = transaction_add_job_and_dependencies(m, JOB_STOP, dep, ret, true, force, NULL)) < 0)
goto fail;
} else if (type == JOB_STOP || type == JOB_RESTART || type == JOB_TRY_RESTART) {
SET_FOREACH(dep, ret->name->meta.dependencies[NAME_REQUIRED_BY], state)
goto fail;
} else if (type == JOB_STOP || type == JOB_RESTART || type == JOB_TRY_RESTART) {
SET_FOREACH(dep, ret->name->meta.dependencies[NAME_REQUIRED_BY], state)
- if ((r = real_add_job(m, type, dep, ret, true, force, NULL)) < 0)
+ if ((r = transaction_add_job_and_dependencies(m, type, dep, ret, true, force, NULL)) < 0)
- if ((r = real_add_job(m, type, name, NULL, true, force, &ret))) {
+ if ((r = transaction_add_job_and_dependencies(m, type, name, NULL, true, force, &ret))) {
HASHMAP_FOREACH_KEY(n, t, s->names, state)
if (name_id(n) == t)
HASHMAP_FOREACH_KEY(n, t, s->names, state)
if (name_id(n) == t)