1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

machined: change check_gc to may_gc everywhere

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-02-15 13:15:45 +01:00
parent 5c093a2368
commit 554ce41f61
3 changed files with 10 additions and 10 deletions

View File

@ -486,22 +486,22 @@ int machine_finalize(Machine *m) {
return 0;
}
bool machine_check_gc(Machine *m, bool drop_not_started) {
bool machine_may_gc(Machine *m, bool drop_not_started) {
assert(m);
if (m->class == MACHINE_HOST)
return true;
if (drop_not_started && !m->started)
return false;
if (m->scope_job && manager_job_is_active(m->manager, m->scope_job))
if (drop_not_started && !m->started)
return true;
if (m->scope_job && manager_job_is_active(m->manager, m->scope_job))
return false;
if (m->unit && manager_unit_is_active(m->manager, m->unit))
return true;
return false;
return false;
return true;
}
void machine_add_to_gc_queue(Machine *m) {

View File

@ -85,7 +85,7 @@ struct Machine {
Machine* machine_new(Manager *manager, MachineClass class, const char *name);
void machine_free(Machine *m);
bool machine_check_gc(Machine *m, bool drop_not_started);
bool machine_may_gc(Machine *m, bool drop_not_started);
void machine_add_to_gc_queue(Machine *m);
int machine_start(Machine *m, sd_bus_message *properties, sd_bus_error *error);
int machine_stop(Machine *m);

View File

@ -292,14 +292,14 @@ void manager_gc(Manager *m, bool drop_not_started) {
machine->in_gc_queue = false;
/* First, if we are not closing yet, initiate stopping */
if (!machine_check_gc(machine, drop_not_started) &&
if (machine_may_gc(machine, drop_not_started) &&
machine_get_state(machine) != MACHINE_CLOSING)
machine_stop(machine);
/* Now, the stop probably made this referenced
* again, but if it didn't, then it's time to let it
* go entirely. */
if (!machine_check_gc(machine, drop_not_started)) {
if (machine_may_gc(machine, drop_not_started)) {
machine_finalize(machine);
machine_free(machine);
}