]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machined: change check_gc to may_gc everywhere 8175/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 15 Feb 2018 12:15:45 +0000 (13:15 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 15 Feb 2018 13:09:40 +0000 (14:09 +0100)
src/machine/machine.c
src/machine/machine.h
src/machine/machined.c

index 7375d83a44502d388dbb93ec7a6adfd008721691..4bacf91d26537173b5a9b9c91787e120a1552a1b 100644 (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;
+                return false;
 
         if (drop_not_started && !m->started)
-                return false;
+                return true;
 
         if (m->scope_job && manager_job_is_active(m->manager, m->scope_job))
-                return true;
+                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) {
index 1ee82ffe814452c919de4c2455e0bfb9993fce77..1ef5dcdb89c99209c03a961d0d56be1b1814a596 100644 (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);
index 34b2024043a2c86538db1c0ea0a12705cd8fd13c..9fb67882e12e0c3c65424e12ab8d02a79970d00f 100644 (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);
                 }