[systemd-commits] 2 commits - src/core src/shared src/test

Lennart Poettering lennart at kemper.freedesktop.org
Wed Mar 12 14:30:43 PDT 2014


 src/core/manager.c   |   23 +++--------------------
 src/shared/macro.h   |    9 +++++----
 src/test/test-util.c |    1 -
 3 files changed, 8 insertions(+), 25 deletions(-)

New commits:
commit 0851062751fe5083326308b9901527fc4b234919
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Mar 12 22:27:13 2014 +0100

    manager: use system state enum where appropriate

diff --git a/src/core/manager.c b/src/core/manager.c
index f618bed..ce5888e 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -2414,23 +2414,6 @@ int manager_reload(Manager *m) {
         return r;
 }
 
-static bool manager_is_booting_or_shutting_down(Manager *m) {
-        Unit *u;
-
-        assert(m);
-
-        /* Is the initial job still around? */
-        if (manager_get_job(m, m->default_unit_job_id))
-                return true;
-
-        /* Is there a job for the shutdown target? */
-        u = manager_get_unit(m, SPECIAL_SHUTDOWN_TARGET);
-        if (u)
-                return !!u->job;
-
-        return false;
-}
-
 bool manager_is_reloading_or_reexecuting(Manager *m) {
         assert(m);
 
@@ -2804,6 +2787,9 @@ static bool manager_get_show_status(Manager *m) {
         if (m->no_console_output)
                 return false;
 
+        if (!IN_SET(manager_state(m), MANAGER_STARTING, MANAGER_STOPPING))
+                return false;
+
         if (m->show_status > 0)
                 return true;
 
@@ -2824,9 +2810,6 @@ void manager_status_printf(Manager *m, bool ephemeral, const char *status, const
         if (ephemeral && m->n_on_console > 0)
                 return;
 
-        if (!manager_is_booting_or_shutting_down(m))
-                return;
-
         va_start(ap, format);
         status_vprintf(status, true, ephemeral, format, ap);
         va_end(ap);

commit dc36d78e116a7ce4a119a527299785025c925679
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Mar 12 22:26:22 2014 +0100

    macro: make sure we can use IN_SET() also with complex function calls as first argument

diff --git a/src/shared/macro.h b/src/shared/macro.h
index 08a036b..d53b07f 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -324,13 +324,14 @@ do {                                                                    \
 #define SET_FLAG(v, flag, b) \
         (v) = (b) ? ((v) | (flag)) : ((v) & ~(flag))
 
-#define IN_SET(x, ...)                                                  \
+#define IN_SET(x, y, ...)                                               \
         ({                                                              \
-                const typeof(x) _x = (x);                               \
+                const typeof(y) _y = (y);                               \
+                const typeof(_y) _x = (x);                              \
                 unsigned _i;                                            \
                 bool _found = false;                                    \
-                for (_i = 0; _i < sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
-                        if (((const typeof(_x)[]) { __VA_ARGS__ })[_i] == _x) { \
+                for (_i = 0; _i < 1 + sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
+                        if (((const typeof(_x)[]) { _y, __VA_ARGS__ })[_i] == _x) { \
                                 _found = true;                          \
                                 break;                                  \
                         }                                               \
diff --git a/src/test/test-util.c b/src/test/test-util.c
index 1de06db..229f492 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -574,7 +574,6 @@ static void test_fstab_node_to_udev_node(void) {
         assert_se(streq(n, "/dev/disk/by-partuuid/037b9d94-148e-4ee4-8d38-67bfe15bb535"));
         free(n);
 
-
         n = fstab_node_to_udev_node("PONIES=awesome");
         puts(n);
         assert_se(streq(n, "PONIES=awesome"));



More information about the systemd-commits mailing list