From: Yu Watanabe Date: Thu, 15 May 2025 00:10:36 +0000 (+0900) Subject: core/transaction: rename ret -> job X-Git-Tag: v256.17~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c41a1c28c6af28ee05097296518aa6ea2221b288;p=thirdparty%2Fsystemd.git core/transaction: rename ret -> job (cherry picked from commit fc49b2994d77338a0982a4d5ff78a35617311a42) (cherry picked from commit 74682088723f62424ab6ad7e219d9e6ecbc51c38) --- diff --git a/src/core/transaction.c b/src/core/transaction.c index ab6e699d33e..d6c0b1ac413 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -939,7 +939,7 @@ int transaction_add_job_and_dependencies( sd_bus_error *e) { bool is_new; - Job *ret; + Job *job; int r; assert(tr); @@ -992,21 +992,21 @@ int transaction_add_job_and_dependencies( job_type_to_string(type), unit->id); /* First add the job. */ - ret = transaction_add_one_job(tr, type, unit, &is_new); - if (!ret) + job = transaction_add_one_job(tr, type, unit, &is_new); + if (!job) return -ENOMEM; if (FLAGS_SET(flags, TRANSACTION_IGNORE_ORDER)) - ret->ignore_order = true; + job->ignore_order = true; /* Then, add a link to the job. */ if (by) { - if (!job_dependency_new(by, ret, FLAGS_SET(flags, TRANSACTION_MATTERS), FLAGS_SET(flags, TRANSACTION_CONFLICTS))) + if (!job_dependency_new(by, job, FLAGS_SET(flags, TRANSACTION_MATTERS), FLAGS_SET(flags, TRANSACTION_CONFLICTS))) return -ENOMEM; } else { /* If the job has no parent job, it is the anchor job. */ assert(!tr->anchor_job); - tr->anchor_job = ret; + tr->anchor_job = job; } if (!is_new || FLAGS_SET(flags, TRANSACTION_IGNORE_REQUIREMENTS) || type == JOB_NOP) @@ -1016,9 +1016,9 @@ int transaction_add_job_and_dependencies( Unit *dep; /* If we are following some other unit, make sure we add all dependencies of everybody following. */ - if (unit_following_set(ret->unit, &following) > 0) + if (unit_following_set(job->unit, &following) > 0) SET_FOREACH(dep, following) { - r = transaction_add_job_and_dependencies(tr, type, dep, ret, flags & TRANSACTION_IGNORE_ORDER, e); + r = transaction_add_job_and_dependencies(tr, type, dep, job, flags & TRANSACTION_IGNORE_ORDER, e); if (r < 0) { log_unit_full_errno(dep, r == -ERFKILL ? LOG_INFO : LOG_WARNING, r, "Cannot add dependency job, ignoring: %s", @@ -1029,8 +1029,8 @@ int transaction_add_job_and_dependencies( /* Finally, recursively add in all dependencies. */ if (IN_SET(type, JOB_START, JOB_RESTART)) { - UNIT_FOREACH_DEPENDENCY(dep, ret->unit, UNIT_ATOM_PULL_IN_START) { - r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, TRANSACTION_MATTERS | (flags & TRANSACTION_IGNORE_ORDER), e); + UNIT_FOREACH_DEPENDENCY(dep, job->unit, UNIT_ATOM_PULL_IN_START) { + r = transaction_add_job_and_dependencies(tr, JOB_START, dep, job, TRANSACTION_MATTERS | (flags & TRANSACTION_IGNORE_ORDER), e); if (r < 0) { if (r != -EBADR) /* job type not applicable */ goto fail; @@ -1039,8 +1039,8 @@ int transaction_add_job_and_dependencies( } } - UNIT_FOREACH_DEPENDENCY(dep, ret->unit, UNIT_ATOM_PULL_IN_START_IGNORED) { - r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, flags & TRANSACTION_IGNORE_ORDER, e); + UNIT_FOREACH_DEPENDENCY(dep, job->unit, UNIT_ATOM_PULL_IN_START_IGNORED) { + r = transaction_add_job_and_dependencies(tr, JOB_START, dep, job, flags & TRANSACTION_IGNORE_ORDER, e); if (r < 0) { /* unit masked, job type not applicable and unit not found are not considered * as errors. */ @@ -1052,8 +1052,8 @@ int transaction_add_job_and_dependencies( } } - UNIT_FOREACH_DEPENDENCY(dep, ret->unit, UNIT_ATOM_PULL_IN_VERIFY) { - r = transaction_add_job_and_dependencies(tr, JOB_VERIFY_ACTIVE, dep, ret, TRANSACTION_MATTERS | (flags & TRANSACTION_IGNORE_ORDER), e); + UNIT_FOREACH_DEPENDENCY(dep, job->unit, UNIT_ATOM_PULL_IN_VERIFY) { + r = transaction_add_job_and_dependencies(tr, JOB_VERIFY_ACTIVE, dep, job, TRANSACTION_MATTERS | (flags & TRANSACTION_IGNORE_ORDER), e); if (r < 0) { if (r != -EBADR) /* job type not applicable */ goto fail; @@ -1062,8 +1062,8 @@ int transaction_add_job_and_dependencies( } } - UNIT_FOREACH_DEPENDENCY(dep, ret->unit, UNIT_ATOM_PULL_IN_STOP) { - r = transaction_add_job_and_dependencies(tr, JOB_STOP, dep, ret, TRANSACTION_MATTERS | TRANSACTION_CONFLICTS | (flags & TRANSACTION_IGNORE_ORDER), e); + UNIT_FOREACH_DEPENDENCY(dep, job->unit, UNIT_ATOM_PULL_IN_STOP) { + r = transaction_add_job_and_dependencies(tr, JOB_STOP, dep, job, TRANSACTION_MATTERS | TRANSACTION_CONFLICTS | (flags & TRANSACTION_IGNORE_ORDER), e); if (r < 0) { if (r != -EBADR) /* job type not applicable */ goto fail; @@ -1072,8 +1072,8 @@ int transaction_add_job_and_dependencies( } } - UNIT_FOREACH_DEPENDENCY(dep, ret->unit, UNIT_ATOM_PULL_IN_STOP_IGNORED) { - r = transaction_add_job_and_dependencies(tr, JOB_STOP, dep, ret, flags & TRANSACTION_IGNORE_ORDER, e); + UNIT_FOREACH_DEPENDENCY(dep, job->unit, UNIT_ATOM_PULL_IN_STOP_IGNORED) { + r = transaction_add_job_and_dependencies(tr, JOB_STOP, dep, job, flags & TRANSACTION_IGNORE_ORDER, e); if (r < 0) { log_unit_warning(dep, "Cannot add dependency job, ignoring: %s", @@ -1086,7 +1086,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, job->unit, is_stop ? UNIT_ATOM_PROPAGATE_STOP : UNIT_ATOM_PROPAGATE_RESTART) { /* We propagate RESTART only as TRY_RESTART, in order not to start dependencies that * are not around. */ JobType nt; @@ -1095,7 +1095,7 @@ int transaction_add_job_and_dependencies( if (nt == JOB_NOP) continue; - r = transaction_add_job_and_dependencies(tr, nt, dep, ret, TRANSACTION_MATTERS | (flags & TRANSACTION_IGNORE_ORDER), e); + r = transaction_add_job_and_dependencies(tr, nt, dep, job, TRANSACTION_MATTERS | (flags & TRANSACTION_IGNORE_ORDER), e); if (r < 0) { if (r != -EBADR) /* job type not applicable */ return r; @@ -1108,7 +1108,7 @@ int transaction_add_job_and_dependencies( * all other dependencies are processed, i.e. we're the anchor job or already in the recursion * that handles it. */ if (!by || FLAGS_SET(flags, TRANSACTION_PROCESS_PROPAGATE_STOP_GRACEFUL)) - UNIT_FOREACH_DEPENDENCY(dep, ret->unit, UNIT_ATOM_PROPAGATE_STOP_GRACEFUL) { + UNIT_FOREACH_DEPENDENCY(dep, job->unit, UNIT_ATOM_PROPAGATE_STOP_GRACEFUL) { JobType nt; Job *j; @@ -1118,7 +1118,7 @@ int transaction_add_job_and_dependencies( if (nt == JOB_NOP) continue; - r = transaction_add_job_and_dependencies(tr, nt, dep, ret, TRANSACTION_MATTERS | (flags & TRANSACTION_IGNORE_ORDER) | TRANSACTION_PROCESS_PROPAGATE_STOP_GRACEFUL, e); + r = transaction_add_job_and_dependencies(tr, nt, dep, job, TRANSACTION_MATTERS | (flags & TRANSACTION_IGNORE_ORDER) | TRANSACTION_PROCESS_PROPAGATE_STOP_GRACEFUL, e); if (r < 0) { if (r != -EBADR) /* job type not applicable */ return r; @@ -1129,7 +1129,7 @@ int transaction_add_job_and_dependencies( } if (type == JOB_RELOAD) - transaction_add_propagate_reload_jobs(tr, ret->unit, ret, flags & TRANSACTION_IGNORE_ORDER); + transaction_add_propagate_reload_jobs(tr, job->unit, job, flags & TRANSACTION_IGNORE_ORDER); /* JOB_VERIFY_ACTIVE requires no dependency handling */ @@ -1140,7 +1140,7 @@ fail: log_unit_debug_errno(unit, r, "Cannot add dependency job to transaction, deleting job %s/%s again: %s", unit->id, job_type_to_string(type), bus_error_message(e, r)); - transaction_delete_job(tr, ret, /* delete_dependencies= */ false); + transaction_delete_job(tr, job, /* delete_dependencies= */ false); return r; }