Let's make our finished checks a bit more readable. Checking the
timestamp is not entirely obvious, hence let's abstract that a bit by
adding a macro that shows what we are doing here, not how we doing it.
This is particularly useful if we want to change the definition of
"finished" later on, in particular, when we try to fix #7023.
assert(reply);
assert(m);
- if (dual_timestamp_is_set(m->timestamps + MANAGER_TIMESTAMP_FINISH))
+ if (MANAGER_IS_FINISHED(m))
d = 1.0;
else
d = 1.0 - ((double) hashmap_size(m->jobs) / (double) m->n_installed_jobs);
/* This is no longer the first boot */
manager_set_first_boot(m, false);
- if (dual_timestamp_is_set(m->timestamps + MANAGER_TIMESTAMP_FINISH))
+ if (MANAGER_IS_FINISHED(m))
return;
dual_timestamp_get(m->timestamps + MANAGER_TIMESTAMP_FINISH);
assert(m);
/* Did we ever finish booting? If not then we are still starting up */
- if (!dual_timestamp_is_set(m->timestamps + MANAGER_TIMESTAMP_FINISH)) {
+ if (!MANAGER_IS_FINISHED(m)) {
u = manager_get_unit(m, SPECIAL_BASIC_TARGET);
if (!u || !UNIT_IS_ACTIVE_OR_RELOADING(unit_active_state(u)))
#define MANAGER_IS_RELOADING(m) ((m)->n_reloading > 0)
+#define MANAGER_IS_FINISHED(m) (dual_timestamp_is_set((m)->timestamps + MANAGER_TIMESTAMP_FINISH))
+
int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **m);
Manager* manager_free(Manager *m);