Lines Matching refs:tr

14 static void transaction_unlink_job(Transaction *tr, Job *j, bool delete_dependencies);
16 static void transaction_delete_job(Transaction *tr, Job *j, bool delete_dependencies) { in transaction_delete_job() argument
17 assert(tr); in transaction_delete_job()
22 transaction_unlink_job(tr, j, delete_dependencies); in transaction_delete_job()
27 static void transaction_delete_unit(Transaction *tr, Unit *u) { in transaction_delete_unit() argument
33 while ((j = hashmap_get(tr->jobs, u))) in transaction_delete_unit()
34 transaction_delete_job(tr, j, true); in transaction_delete_unit()
37 void transaction_abort(Transaction *tr) { in transaction_abort() argument
40 assert(tr); in transaction_abort()
42 while ((j = hashmap_first(tr->jobs))) in transaction_abort()
43 transaction_delete_job(tr, j, false); in transaction_abort()
45 assert(hashmap_isempty(tr->jobs)); in transaction_abort()
73 static void transaction_merge_and_delete_job(Transaction *tr, Job *j, Job *other, JobType t) { in transaction_merge_and_delete_job() argument
123 transaction_delete_job(tr, other, true); in transaction_merge_and_delete_job()
139 static int delete_one_unmergeable_job(Transaction *tr, Job *job) { in delete_one_unmergeable_job() argument
208 transaction_delete_job(tr, d, true); in delete_one_unmergeable_job()
215 static int transaction_merge_jobs(Transaction *tr, sd_bus_error *e) { in transaction_merge_jobs() argument
219 assert(tr); in transaction_merge_jobs()
223 HASHMAP_FOREACH(j, tr->jobs) { in transaction_merge_jobs()
235 r = delete_one_unmergeable_job(tr, j); in transaction_merge_jobs()
253 HASHMAP_FOREACH(j, tr->jobs) { in transaction_merge_jobs()
262 if (tr->anchor_job == k) { in transaction_merge_jobs()
263 transaction_merge_and_delete_job(tr, k, j, t); in transaction_merge_jobs()
266 transaction_merge_and_delete_job(tr, j, k, t); in transaction_merge_jobs()
276 static void transaction_drop_redundant(Transaction *tr) { in transaction_drop_redundant() argument
282 assert(tr); in transaction_drop_redundant()
289 HASHMAP_FOREACH(j, tr->jobs) { in transaction_drop_redundant()
293 if (tr->anchor_job == k || in transaction_drop_redundant()
303 transaction_delete_job(tr, j, false); in transaction_drop_redundant()
344 static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsigned generation, sd… in transaction_verify_order_one() argument
353 assert(tr); in transaction_verify_order_one()
379 … if (!delete && hashmap_get(tr->jobs, k->unit) && !unit_matters_to_anchor(k->unit, k)) in transaction_verify_order_one()
419 transaction_delete_unit(tr, delete->unit); in transaction_verify_order_one()
450 o = hashmap_get(tr->jobs, u); in transaction_verify_order_one()
463 r = transaction_verify_order_one(tr, o, j, generation, e); in transaction_verify_order_one()
476 static int transaction_verify_order(Transaction *tr, unsigned *generation, sd_bus_error *e) { in transaction_verify_order() argument
481 assert(tr); in transaction_verify_order()
489 HASHMAP_FOREACH(j, tr->jobs) { in transaction_verify_order()
490 r = transaction_verify_order_one(tr, j, NULL, g, e); in transaction_verify_order()
498 static void transaction_collect_garbage(Transaction *tr) { in transaction_collect_garbage() argument
501 assert(tr); in transaction_collect_garbage()
510 HASHMAP_FOREACH(j, tr->jobs) { in transaction_collect_garbage()
511 if (tr->anchor_job == j) in transaction_collect_garbage()
516 transaction_delete_job(tr, j, true); in transaction_collect_garbage()
530 static int transaction_is_destructive(Transaction *tr, JobMode mode, sd_bus_error *e) { in transaction_is_destructive() argument
533 assert(tr); in transaction_is_destructive()
538 HASHMAP_FOREACH(j, tr->jobs) { in transaction_is_destructive()
548tr->anchor_job->unit->id, job_type_to_string(tr->anchor_job->type), in transaction_is_destructive()
555 static void transaction_minimize_impact(Transaction *tr) { in transaction_minimize_impact() argument
558 assert(tr); in transaction_minimize_impact()
564 HASHMAP_FOREACH(head, tr->jobs) { in transaction_minimize_impact()
601 transaction_delete_job(tr, j, true); in transaction_minimize_impact()
608 Transaction *tr, in transaction_apply() argument
628 if (hashmap_get(tr->jobs, j->unit)) in transaction_apply()
638 HASHMAP_FOREACH(j, tr->jobs) { in transaction_apply()
648 while ((j = hashmap_steal_first(tr->jobs))) { in transaction_apply()
652 transaction_unlink_job(tr, j, false); in transaction_apply()
657 if (tr->anchor_job == j) in transaction_apply()
658 tr->anchor_job = installed_job; in transaction_apply()
679 HASHMAP_FOREACH(j, tr->jobs) in transaction_apply()
686 Transaction *tr, in transaction_activate() argument
696 assert(tr); in transaction_activate()
708 transaction_find_jobs_that_matter_to_anchor(tr->anchor_job, generation++); in transaction_activate()
714 transaction_minimize_impact(tr); in transaction_activate()
717 transaction_drop_redundant(tr); in transaction_activate()
723 transaction_collect_garbage(tr); in transaction_activate()
727 r = transaction_verify_order(tr, &generation, e); in transaction_activate()
742 r = transaction_merge_jobs(tr, e); in transaction_activate()
752 transaction_collect_garbage(tr); in transaction_activate()
759 transaction_drop_redundant(tr); in transaction_activate()
762 r = transaction_is_destructive(tr, mode, e); in transaction_activate()
767 r = transaction_apply(tr, m, mode, affected_jobs); in transaction_activate()
771 assert(hashmap_isempty(tr->jobs)); in transaction_activate()
790 static Job* transaction_add_one_job(Transaction *tr, JobType type, Unit *unit, bool *is_new) { in transaction_add_one_job() argument
793 assert(tr); in transaction_add_one_job()
800 f = hashmap_get(tr->jobs, unit); in transaction_add_one_job()
819 j->irreversible = tr->irreversible; in transaction_add_one_job()
823 if (hashmap_replace(tr->jobs, unit, f) < 0) { in transaction_add_one_job()
837 static void transaction_unlink_job(Transaction *tr, Job *j, bool delete_dependencies) { in transaction_unlink_job() argument
838 assert(tr); in transaction_unlink_job()
844 hashmap_replace(tr->jobs, j->unit, j->transaction_next); in transaction_unlink_job()
846 hashmap_remove_value(tr->jobs, j->unit, j); in transaction_unlink_job()
866 transaction_delete_job(tr, other, delete_dependencies); in transaction_unlink_job()
871 void transaction_add_propagate_reload_jobs(Transaction *tr, Unit *unit, Job *by, bool ignore_order,… in transaction_add_propagate_reload_jobs() argument
876 assert(tr); in transaction_add_propagate_reload_jobs()
884 … r = transaction_add_job_and_dependencies(tr, nt, dep, by, false, false, false, ignore_order, e); in transaction_add_propagate_reload_jobs()
895 Transaction *tr, in transaction_add_job_and_dependencies() argument
910 assert(tr); in transaction_add_job_and_dependencies()
962 ret = transaction_add_one_job(tr, type, unit, &is_new); in transaction_add_job_and_dependencies()
974 assert(!tr->anchor_job); in transaction_add_job_and_dependencies()
975 tr->anchor_job = ret; in transaction_add_job_and_dependencies()
985 …r = transaction_add_job_and_dependencies(tr, type, dep, ret, false, false, false, ignore_order, e); in transaction_add_job_and_dependencies()
1000 …r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, true, false, false, ignore_order… in transaction_add_job_and_dependencies()
1010 …r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, false, false, false, ignore_orde… in transaction_add_job_and_dependencies()
1022 …r = transaction_add_job_and_dependencies(tr, JOB_VERIFY_ACTIVE, dep, ret, true, false, false, igno… in transaction_add_job_and_dependencies()
1032 …r = transaction_add_job_and_dependencies(tr, JOB_STOP, dep, ret, true, true, false, ignore_order, … in transaction_add_job_and_dependencies()
1042 …r = transaction_add_job_and_dependencies(tr, JOB_STOP, dep, ret, false, false, false, ignore_order… in transaction_add_job_and_dependencies()
1073 … r = transaction_add_job_and_dependencies(tr, nt, dep, ret, true, false, false, ignore_order, e); in transaction_add_job_and_dependencies()
1084 transaction_add_propagate_reload_jobs(tr, ret->unit, ret, ignore_order, e); in transaction_add_job_and_dependencies()
1095 int transaction_add_isolate_jobs(Transaction *tr, Manager *m) { in transaction_add_isolate_jobs() argument
1100 assert(tr); in transaction_add_isolate_jobs()
1117 if (hashmap_get(tr->jobs, u)) in transaction_add_isolate_jobs()
1120 …r = transaction_add_job_and_dependencies(tr, JOB_STOP, u, tr->anchor_job, true, false, false, fals… in transaction_add_isolate_jobs()
1128 int transaction_add_triggering_jobs(Transaction *tr, Unit *u) { in transaction_add_triggering_jobs() argument
1132 assert(tr); in transaction_add_triggering_jobs()
1142 if (hashmap_get(tr->jobs, trigger)) in transaction_add_triggering_jobs()
1145 …r = transaction_add_job_and_dependencies(tr, JOB_STOP, trigger, tr->anchor_job, true, false, false… in transaction_add_triggering_jobs()
1154 Transaction *tr; in transaction_new() local
1156 tr = new0(Transaction, 1); in transaction_new()
1157 if (!tr) in transaction_new()
1160 tr->jobs = hashmap_new(NULL); in transaction_new()
1161 if (!tr->jobs) in transaction_new()
1162 return mfree(tr); in transaction_new()
1164 tr->irreversible = irreversible; in transaction_new()
1166 return tr; in transaction_new()
1169 void transaction_free(Transaction *tr) { in transaction_free() argument
1170 assert(hashmap_isempty(tr->jobs)); in transaction_free()
1171 hashmap_free(tr->jobs); in transaction_free()
1172 free(tr); in transaction_free()