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:
parent
5c093a2368
commit
554ce41f61
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user