[systemd-commits] 7 commits - src/core src/shared units/plymouth-quit.service units/plymouth-quit-wait.service

Michal Schmidt michich at kemper.freedesktop.org
Mon May 14 05:30:21 PDT 2012


 src/core/automount.c             |   14 +++++++-
 src/core/device.c                |   12 ++++++-
 src/core/job.c                   |   66 +++++++++++++++++++++++++--------------
 src/core/job.h                   |   10 ++---
 src/core/mount.c                 |   21 +++++++++++-
 src/core/service.c               |   20 ++++++++++-
 src/core/socket.c                |   20 +++++++++++
 src/core/swap.c                  |   21 +++++++++++-
 src/core/target.c                |   12 ++++++-
 src/core/unit.c                  |   24 +++++++++++---
 src/core/unit.h                  |   12 +++++--
 src/shared/util.c                |   51 +++++++++++++-----------------
 src/shared/util.h                |    1 
 units/plymouth-quit-wait.service |    2 -
 units/plymouth-quit.service      |    2 -
 15 files changed, 211 insertions(+), 77 deletions(-)

New commits:
commit 7cf82e0bb1ebafd054824d6fc7121050397824e9
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Sun May 13 23:29:19 2012 +0200

    job: info message if JOB_VERIFY_ACTIVE detects an inactive unit

diff --git a/src/core/job.c b/src/core/job.c
index c9ca60d..8d51aa3 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -607,6 +607,14 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
                 default:
                         ;
                 }
+
+        } else if (t == JOB_VERIFY_ACTIVE) {
+
+                /* When verify-active detects the unit is inactive, report it.
+                 * Most likely a DEPEND warning from a requisiting unit will
+                 * occur next and it's nice to see what was requisited. */
+                if (result == JOB_SKIPPED)
+                        unit_status_printf(u, ANSI_HIGHLIGHT_ON " INFO " ANSI_HIGHLIGHT_OFF, "%s is not active.", unit_description(u));
         }
 }
 

commit 1f136e7acffe0354c0a0639a6280c6e75a6d7739
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Sun May 13 23:28:46 2012 +0200

    job: report the status of first half of JOB_RESTART the same as JOB_STOP

diff --git a/src/core/job.c b/src/core/job.c
index 107961a..c9ca60d 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -587,7 +587,7 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
                         ;
                 }
 
-        } else if (t == JOB_STOP) {
+        } else if (t == JOB_STOP || t == JOB_RESTART) {
 
                 format = format_table->finished_stop_job[result];
                 if (!format)

commit c69182961b00707d977957cf81d5c41cfbeab429
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Sun May 13 18:18:54 2012 +0200

    unit: unit type dependent status messages
    
    Instead of generic "Starting..." and "Started" messages for all unit use
    type-dependent messages. For example, mounts will announce "Mounting..."
    and "Mounted".
    
    Add status messages to units of types that used to be entirely silent
    (automounts, sockets, targets, devices). For unit types whose jobs are
    instantaneous, report only the job completion, not the starting event.
    Socket units with non-instantaneous jobs are rare (Exec*= is not used
    often in socket units), so I chose not to print the starting messages
    for them either.
    
    This will hopefully give people better understanding of the boot.

diff --git a/src/core/automount.c b/src/core/automount.c
index c31e3d8..f190417 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -885,5 +885,17 @@ const UnitVTable automount_vtable = {
         .bus_message_handler = bus_automount_message_handler,
         .bus_invalidating_properties = bus_automount_invalidating_properties,
 
-        .shutdown = automount_shutdown
+        .shutdown = automount_shutdown,
+
+        .status_message_formats = {
+                .finished_start_job = {
+                        [JOB_DONE]       = "Set up automount %s.",
+                        [JOB_FAILED]     = "Failed to set up automount %s.",
+                        [JOB_DEPENDENCY] = "Dependency failed for %s.",
+                },
+                .finished_stop_job = {
+                        [JOB_DONE]       = "Unset automount %s.",
+                        [JOB_FAILED]     = "Failed to unset automount %s.",
+                },
+        },
 };
diff --git a/src/core/device.c b/src/core/device.c
index f2bb656..cd0a099 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -613,5 +613,15 @@ const UnitVTable device_vtable = {
         .following_set = device_following_set,
 
         .enumerate = device_enumerate,
-        .shutdown = device_shutdown
+        .shutdown = device_shutdown,
+
+        .status_message_formats = {
+                .starting_stopping = {
+                        [0] = "Expecting device %s...",
+                },
+                .finished_start_job = {
+                        [JOB_DONE]       = "Found device %s.",
+                        [JOB_TIMEOUT]    = "Timed out waiting for device %s.",
+                },
+        },
 };
diff --git a/src/core/job.c b/src/core/job.c
index 202eed1..107961a 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -550,28 +550,37 @@ int job_run_and_invalidate(Job *j) {
 }
 
 static void job_print_status_message(Unit *u, JobType t, JobResult result) {
-        assert(u);
+        const UnitStatusMessageFormats *format_table;
+        const char *format;
+
+        format_table = &UNIT_VTABLE(u)->status_message_formats;
+        if (!format_table)
+                return;
 
         if (t == JOB_START) {
 
+                format = format_table->finished_start_job[result];
+                if (!format)
+                        return;
+
                 switch (result) {
 
                 case JOB_DONE:
                         if (u->condition_result)
-                                unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON "  OK  " ANSI_HIGHLIGHT_OFF, "Started %s.", unit_description(u));
+                                unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON "  OK  " ANSI_HIGHLIGHT_OFF, format, unit_description(u));
                         break;
 
                 case JOB_FAILED:
-                        unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, "Failed to start %s.", unit_description(u));
-                        unit_status_printf(u, NULL, "See 'systemctl status %s' for details.", u->id);
+                        unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, format, unit_description(u));
+                        unit_status_printf(u, "", "See 'systemctl status %s' for details.", u->id);
                         break;
 
                 case JOB_DEPENDENCY:
-                        unit_status_printf(u, ANSI_HIGHLIGHT_YELLOW_ON "DEPEND" ANSI_HIGHLIGHT_OFF, "Dependency failed. Aborted start of %s.", unit_description(u));
+                        unit_status_printf(u, ANSI_HIGHLIGHT_YELLOW_ON "DEPEND" ANSI_HIGHLIGHT_OFF, format, unit_description(u));
                         break;
 
                 case JOB_TIMEOUT:
-                        unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, "Timed out starting %s.", unit_description(u));
+                        unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format, unit_description(u));
                         break;
 
                 default:
@@ -580,15 +589,19 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
 
         } else if (t == JOB_STOP) {
 
+                format = format_table->finished_stop_job[result];
+                if (!format)
+                        return;
+
                 switch (result) {
 
                 case JOB_TIMEOUT:
-                        unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, "Timed out stopping %s.", unit_description(u));
+                        unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format, unit_description(u));
                         break;
 
                 case JOB_DONE:
                 case JOB_FAILED:
-                        unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON "  OK  " ANSI_HIGHLIGHT_OFF, "Stopped %s.", unit_description(u));
+                        unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON "  OK  " ANSI_HIGHLIGHT_OFF, format, unit_description(u));
                         break;
 
                 default:
@@ -607,34 +620,34 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive) {
         assert(j->installed);
         assert(j->type < _JOB_TYPE_MAX_IN_TRANSACTION);
 
+        u = j->unit;
+        t = j->type;
+
+        j->result = result;
+
+        log_debug("Job %s/%s finished, result=%s", u->id, job_type_to_string(t), job_result_to_string(result));
+
+        job_print_status_message(u, t, result);
+
         job_add_to_dbus_queue(j);
 
         /* Patch restart jobs so that they become normal start jobs */
-        if (result == JOB_DONE && j->type == JOB_RESTART) {
+        if (result == JOB_DONE && t == JOB_RESTART) {
 
                 job_change_type(j, JOB_START);
                 j->state = JOB_WAITING;
 
                 job_add_to_run_queue(j);
 
-                u = j->unit;
                 goto finish;
         }
 
-        j->result = result;
-
-        log_debug("Job %s/%s finished, result=%s", j->unit->id, job_type_to_string(j->type), job_result_to_string(result));
-
         if (result == JOB_FAILED)
                 j->manager->n_failed_jobs ++;
 
-        u = j->unit;
-        t = j->type;
         job_uninstall(j);
         job_free(j);
 
-        job_print_status_message(u, t, result);
-
         /* Fail depending jobs on failure */
         if (result != JOB_DONE && recursive) {
 
diff --git a/src/core/job.h b/src/core/job.h
index 2e10143..3208e6c 100644
--- a/src/core/job.h
+++ b/src/core/job.h
@@ -34,11 +34,6 @@ typedef enum JobState JobState;
 typedef enum JobMode JobMode;
 typedef enum JobResult JobResult;
 
-#include "manager.h"
-#include "unit.h"
-#include "hashmap.h"
-#include "list.h"
-
 /* Be careful when changing the job types! Adjust job_merging_table[] accordingly! */
 enum JobType {
         JOB_START,                  /* if a unit does not support being started, we'll just wait until it becomes active */
@@ -107,6 +102,11 @@ enum JobResult {
         _JOB_RESULT_INVALID = -1
 };
 
+#include "manager.h"
+#include "unit.h"
+#include "hashmap.h"
+#include "list.h"
+
 struct JobDependency {
         /* Encodes that the 'subject' job needs the 'object' job in
          * some way. This structure is used only while building a transaction. */
diff --git a/src/core/mount.c b/src/core/mount.c
index 01e9d78..aa81cc6 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1911,7 +1911,6 @@ const UnitVTable mount_vtable = {
 
         .no_alias = true,
         .no_instances = true,
-        .show_status = true,
 
         .init = mount_init,
         .load = mount_load,
@@ -1945,5 +1944,23 @@ const UnitVTable mount_vtable = {
         .bus_invalidating_properties =  bus_mount_invalidating_properties,
 
         .enumerate = mount_enumerate,
-        .shutdown = mount_shutdown
+        .shutdown = mount_shutdown,
+
+        .status_message_formats = {
+                .starting_stopping = {
+                        [0] = "Mounting %s...",
+                        [1] = "Unmounting %s...",
+                },
+                .finished_start_job = {
+                        [JOB_DONE]       = "Mounted %s.",
+                        [JOB_FAILED]     = "Failed to mount %s.",
+                        [JOB_DEPENDENCY] = "Dependency failed for %s.",
+                        [JOB_TIMEOUT]    = "Timed out mounting %s.",
+                },
+                .finished_stop_job = {
+                        [JOB_DONE]       = "Unmounted %s.",
+                        [JOB_FAILED]     = "Failed unmounting %s.",
+                        [JOB_TIMEOUT]    = "Timed out unmounting %s.",
+                },
+        },
 };
diff --git a/src/core/service.c b/src/core/service.c
index e9a7000..28049a3 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -3780,7 +3780,6 @@ const UnitVTable service_vtable = {
                 "Unit\0"
                 "Service\0"
                 "Install\0",
-        .show_status = true,
 
         .init = service_init,
         .done = service_done,
@@ -3826,6 +3825,23 @@ const UnitVTable service_vtable = {
         .bus_invalidating_properties =  bus_service_invalidating_properties,
 
 #ifdef HAVE_SYSV_COMPAT
-        .enumerate = service_enumerate
+        .enumerate = service_enumerate,
 #endif
+        .status_message_formats = {
+                .starting_stopping = {
+                        [0] = "Starting %s...",
+                        [1] = "Stopping %s...",
+                },
+                .finished_start_job = {
+                        [JOB_DONE]       = "Started %s.",
+                        [JOB_FAILED]     = "Failed to start %s.",
+                        [JOB_DEPENDENCY] = "Dependency failed for %s.",
+                        [JOB_TIMEOUT]    = "Timed out starting %s.",
+                },
+                .finished_stop_job = {
+                        [JOB_DONE]       = "Stopped %s.",
+                        [JOB_FAILED]     = "Stopped (with error) %s.",
+                        [JOB_TIMEOUT]    = "Timed out stopping %s.",
+                },
+        },
 };
diff --git a/src/core/socket.c b/src/core/socket.c
index 37e85d5..2be1647 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -2220,5 +2220,23 @@ const UnitVTable socket_vtable = {
 
         .bus_interface = "org.freedesktop.systemd1.Socket",
         .bus_message_handler = bus_socket_message_handler,
-        .bus_invalidating_properties =  bus_socket_invalidating_properties
+        .bus_invalidating_properties =  bus_socket_invalidating_properties,
+
+        .status_message_formats = {
+                /*.starting_stopping = {
+                        [0] = "Starting socket %s...",
+                        [1] = "Stopping socket %s...",
+                },*/
+                .finished_start_job = {
+                        [JOB_DONE]       = "Listening on %s.",
+                        [JOB_FAILED]     = "Failed to listen on %s.",
+                        [JOB_DEPENDENCY] = "Dependency failed for %s.",
+                        [JOB_TIMEOUT]    = "Timed out starting %s.",
+                },
+                .finished_stop_job = {
+                        [JOB_DONE]       = "Closed %s.",
+                        [JOB_FAILED]     = "Failed stopping %s.",
+                        [JOB_TIMEOUT]    = "Timed out stopping %s.",
+                },
+        },
 };
diff --git a/src/core/swap.c b/src/core/swap.c
index a7e2126..ba4413b 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -1378,7 +1378,6 @@ const UnitVTable swap_vtable = {
 
         .no_alias = true,
         .no_instances = true,
-        .show_status = true,
 
         .init = swap_init,
         .load = swap_load,
@@ -1414,5 +1413,23 @@ const UnitVTable swap_vtable = {
         .following_set = swap_following_set,
 
         .enumerate = swap_enumerate,
-        .shutdown = swap_shutdown
+        .shutdown = swap_shutdown,
+
+        .status_message_formats = {
+                .starting_stopping = {
+                        [0] = "Activating swap %s...",
+                        [1] = "Deactivating swap %s...",
+                },
+                .finished_start_job = {
+                        [JOB_DONE]       = "Activated swap %s.",
+                        [JOB_FAILED]     = "Failed to activate swap %s.",
+                        [JOB_DEPENDENCY] = "Dependency failed for %s.",
+                        [JOB_TIMEOUT]    = "Timed out activating swap %s.",
+                },
+                .finished_stop_job = {
+                        [JOB_DONE]       = "Deactivated swap %s.",
+                        [JOB_FAILED]     = "Failed deactivating swap %s.",
+                        [JOB_TIMEOUT]    = "Timed out deactivating swap %s.",
+                },
+        },
 };
diff --git a/src/core/target.c b/src/core/target.c
index f99b2a5..a912f44 100644
--- a/src/core/target.c
+++ b/src/core/target.c
@@ -220,5 +220,15 @@ const UnitVTable target_vtable = {
         .sub_state_to_string = target_sub_state_to_string,
 
         .bus_interface = "org.freedesktop.systemd1.Target",
-        .bus_message_handler = bus_target_message_handler
+        .bus_message_handler = bus_target_message_handler,
+
+        .status_message_formats = {
+                .finished_start_job = {
+                        [JOB_DONE]       = "Reached target %s.",
+                        [JOB_DEPENDENCY] = "Dependency failed for %s.",
+                },
+                .finished_stop_job = {
+                        [JOB_DONE]       = "Stopped target %s.",
+                },
+        },
 };
diff --git a/src/core/unit.c b/src/core/unit.c
index ddcfad5..200d196 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -930,6 +930,21 @@ bool unit_condition_test(Unit *u) {
         return u->condition_result;
 }
 
+static void unit_status_print_starting_stopping(Unit *u, bool stopping) {
+        const UnitStatusMessageFormats *format_table;
+        const char *format;
+
+        format_table = &UNIT_VTABLE(u)->status_message_formats;
+        if (!format_table)
+                return;
+
+        format = format_table->starting_stopping[stopping];
+        if (!format)
+                return;
+
+        unit_status_printf(u, "", format, unit_description(u));
+}
+
 /* Errors:
  *         -EBADR:     This unit type does not support starting.
  *         -EALREADY:  Unit is already started.
@@ -969,6 +984,8 @@ int unit_start(Unit *u) {
                 return unit_start(following);
         }
 
+        unit_status_print_starting_stopping(u, false);
+
         /* If it is stopped, but we cannot start it, then fail */
         if (!UNIT_VTABLE(u)->start)
                 return -EBADR;
@@ -981,7 +998,6 @@ int unit_start(Unit *u) {
 
         unit_add_to_dbus_queue(u);
 
-        unit_status_printf(u, "", "Starting %s...", unit_description(u));
         return UNIT_VTABLE(u)->start(u);
 }
 
@@ -1018,12 +1034,13 @@ int unit_stop(Unit *u) {
                 return unit_stop(following);
         }
 
+        unit_status_print_starting_stopping(u, true);
+
         if (!UNIT_VTABLE(u)->stop)
                 return -EBADR;
 
         unit_add_to_dbus_queue(u);
 
-        unit_status_printf(u, "", "Stopping %s...", unit_description(u));
         return UNIT_VTABLE(u)->stop(u);
 }
 
@@ -2544,9 +2561,6 @@ void unit_status_printf(Unit *u, const char *status, const char *format, ...) {
         assert(u);
         assert(format);
 
-        if (!UNIT_VTABLE(u)->show_status)
-                return;
-
         if (!manager_get_show_status(u->manager))
                 return;
 
diff --git a/src/core/unit.h b/src/core/unit.h
index 3392089..e8e6b09 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -32,6 +32,7 @@ typedef enum UnitLoadState UnitLoadState;
 typedef enum UnitActiveState UnitActiveState;
 typedef enum UnitDependency UnitDependency;
 typedef struct UnitRef UnitRef;
+typedef struct UnitStatusMessageFormats UnitStatusMessageFormats;
 
 #include "set.h"
 #include "util.h"
@@ -266,6 +267,12 @@ struct UnitRef {
         LIST_FIELDS(UnitRef, refs);
 };
 
+struct UnitStatusMessageFormats {
+        const char *starting_stopping[2];
+        const char *finished_start_job[_JOB_RESULT_MAX];
+        const char *finished_stop_job[_JOB_RESULT_MAX];
+};
+
 #include "service.h"
 #include "timer.h"
 #include "socket.h"
@@ -392,6 +399,8 @@ struct UnitVTable {
         /* The interface name */
         const char *bus_interface;
 
+        UnitStatusMessageFormats status_message_formats;
+
         /* Can units of this type have multiple names? */
         bool no_alias:1;
 
@@ -400,9 +409,6 @@ struct UnitVTable {
 
         /* Exclude from automatic gc */
         bool no_gc:1;
-
-        /* Show status updates on the console */
-        bool show_status:1;
 };
 
 extern const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX];

commit 9ab7a8d2a30f440c008d127113419030e4572cb4
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Mon May 14 12:50:33 2012 +0200

    unit: print the color status marks on the left
    
    The alignment of the "[  OK  ]" and "[FAILED]" status marks to the right
    side of the terminal makes it difficult to link them with the messages
    on the left if your console is wide.
    
    I considered the options:
     1. Align them to the 80th column regardless of the console width.
        Disadvantage - either:
        - truncating messages needlessly, not using available space; or
        - If the message is long, write the mark over it. => ugly
     2. Write them to the 80th column for short messages,
        and further to the right for longer ones.
        Disadvantage:
        - jagged look
     3. Write the marks on the left, before the message.
        Disadvantage:
        - Breaks tradition from RHL.
        Advantages:
        + slightly simpler code
        + Will annoy holy-traditionalists.
    
    I chose option 3.
    BTW, Debian now uses similar marks on the left with its makefile-style
    boot.
    
    Special values of the "status" argument to status_vprintf are:
      NULL - no status mark, no message indentation
      ""   - no status mark, message indented as if the mark was there

diff --git a/src/core/unit.c b/src/core/unit.c
index 6894857..ddcfad5 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -981,7 +981,7 @@ int unit_start(Unit *u) {
 
         unit_add_to_dbus_queue(u);
 
-        unit_status_printf(u, NULL, "Starting %s...", unit_description(u));
+        unit_status_printf(u, "", "Starting %s...", unit_description(u));
         return UNIT_VTABLE(u)->start(u);
 }
 
@@ -1023,7 +1023,7 @@ int unit_stop(Unit *u) {
 
         unit_add_to_dbus_queue(u);
 
-        unit_status_printf(u, NULL, "Stopping %s...", unit_description(u));
+        unit_status_printf(u, "", "Stopping %s...", unit_description(u));
         return UNIT_VTABLE(u)->stop(u);
 }
 
diff --git a/src/shared/util.c b/src/shared/util.c
index c9899fb..d6af927 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3329,15 +3329,15 @@ cpu_set_t* cpu_set_malloc(unsigned *ncpus) {
 }
 
 void status_vprintf(const char *status, bool ellipse, const char *format, va_list ap) {
-        char *s = NULL, *spaces = NULL, *e;
-        int fd = -1, c;
-        size_t emax, sl, left;
+        char *s = NULL;
+        static const char status_indent[] = "         "; /* "[" STATUS "] " */
+        int fd = -1;
         struct iovec iovec[5];
         int n = 0;
 
         assert(format);
 
-        /* This independent of logging, as status messages are
+        /* This is independent of logging, as status messages are
          * optional and go exclusively to the console. */
 
         if (vasprintf(&s, format, ap) < 0)
@@ -3348,15 +3348,19 @@ void status_vprintf(const char *status, bool ellipse, const char *format, va_lis
                 goto finish;
 
         if (ellipse) {
+                char *e;
+                size_t emax, sl;
+                int c;
+
                 c = fd_columns(fd);
                 if (c <= 0)
                         c = 80;
 
-                if (status) {
-                        sl = 2 + 6 + 1; /* " [" status "]" */
-                        emax = (size_t) c > sl ? c - sl - 1 : 0;
-                } else
-                        emax = c - 1;
+                sl = status ? strlen(status_indent) : 0;
+
+                emax = c - sl - 1;
+                if (emax < 3)
+                        emax = 3;
 
                 e = ellipsize(s, emax, 75);
                 if (e) {
@@ -3366,34 +3370,23 @@ void status_vprintf(const char *status, bool ellipse, const char *format, va_lis
         }
 
         zero(iovec);
-        IOVEC_SET_STRING(iovec[n++], s);
 
-        if (ellipse) {
-                sl = strlen(s);
-                left = emax > sl ? emax - sl : 0;
-                if (left > 0) {
-                        spaces = malloc(left);
-                        if (spaces) {
-                                memset(spaces, ' ', left);
-                                iovec[n].iov_base = spaces;
-                                iovec[n].iov_len = left;
-                                n++;
-                        }
-                }
+        if (status) {
+                if (!isempty(status)) {
+                        IOVEC_SET_STRING(iovec[n++], "[");
+                        IOVEC_SET_STRING(iovec[n++], status);
+                        IOVEC_SET_STRING(iovec[n++], "] ");
+                } else
+                        IOVEC_SET_STRING(iovec[n++], status_indent);
         }
 
-        if (status) {
-                IOVEC_SET_STRING(iovec[n++], " [");
-                IOVEC_SET_STRING(iovec[n++], status);
-                IOVEC_SET_STRING(iovec[n++], "]\n");
-        } else
-                IOVEC_SET_STRING(iovec[n++], "\n");
+        IOVEC_SET_STRING(iovec[n++], s);
+        IOVEC_SET_STRING(iovec[n++], "\n");
 
         writev(fd, iovec, n);
 
 finish:
         free(s);
-        free(spaces);
 
         if (fd >= 0)
                 close_nointr_nofail(fd);

commit 5f23d5b149513d98bb90df8cb912b6f567bed89f
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Mon May 14 12:23:23 2012 +0200

    job: change red [ABORT] status to yellow [DEPEND]
    
    The red "[ABORT]" for a dependency failure is too scary.
    It suggests a crash. And it suggests a problem with the unit itself.
    Change it to a yellow "[DEPEND]" message. The color communicates the
    level of seriousness better.

diff --git a/src/core/job.c b/src/core/job.c
index 90091c2..202eed1 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -567,7 +567,7 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
                         break;
 
                 case JOB_DEPENDENCY:
-                        unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " ABORT" ANSI_HIGHLIGHT_OFF, "Dependency failed. Aborted start of %s.", unit_description(u));
+                        unit_status_printf(u, ANSI_HIGHLIGHT_YELLOW_ON "DEPEND" ANSI_HIGHLIGHT_OFF, "Dependency failed. Aborted start of %s.", unit_description(u));
                         break;
 
                 case JOB_TIMEOUT:
diff --git a/src/shared/util.h b/src/shared/util.h
index 272ab48..f1bcb8a 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -73,6 +73,7 @@ typedef struct dual_timestamp {
 #define ANSI_HIGHLIGHT_ON "\x1B[1;39m"
 #define ANSI_HIGHLIGHT_RED_ON "\x1B[1;31m"
 #define ANSI_HIGHLIGHT_GREEN_ON "\x1B[1;32m"
+#define ANSI_HIGHLIGHT_YELLOW_ON "\x1B[1;33m"
 #define ANSI_HIGHLIGHT_OFF "\x1B[0m"
 
 usec_t now(clockid_t clock);

commit 66aa6f7fbb16f441b28196c46a8c3fd60ed39d1b
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Sat May 12 21:06:27 2012 +0200

    job: only jobs on the runqueue can be run

diff --git a/src/core/job.c b/src/core/job.c
index 301d83a..90091c2 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -470,11 +470,10 @@ int job_run_and_invalidate(Job *j) {
         assert(j);
         assert(j->installed);
         assert(j->type < _JOB_TYPE_MAX_IN_TRANSACTION);
+        assert(j->in_run_queue);
 
-        if (j->in_run_queue) {
-                LIST_REMOVE(Job, run_queue, j->manager->run_queue, j);
-                j->in_run_queue = false;
-        }
+        LIST_REMOVE(Job, run_queue, j->manager->run_queue, j);
+        j->in_run_queue = false;
 
         if (j->state != JOB_WAITING)
                 return 0;

commit 7c99edf85b8245ccf3446a85781f200f030779ad
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Sat May 12 22:01:27 2012 +0200

    units: do not quit plymouth too early

diff --git a/units/plymouth-quit-wait.service b/units/plymouth-quit-wait.service
index 55a95ef..3801c88 100644
--- a/units/plymouth-quit-wait.service
+++ b/units/plymouth-quit-wait.service
@@ -7,7 +7,7 @@
 
 [Unit]
 Description=Wait for Plymouth Boot Screen to Quit
-After=rc-local.service plymouth-start.service
+After=rc-local.service plymouth-start.service systemd-user-sessions.service
 
 [Service]
 ExecStart=-/bin/plymouth --wait
diff --git a/units/plymouth-quit.service b/units/plymouth-quit.service
index b68b016..8b4860f 100644
--- a/units/plymouth-quit.service
+++ b/units/plymouth-quit.service
@@ -7,7 +7,7 @@
 
 [Unit]
 Description=Terminate Plymouth Boot Screen
-After=rc-local.service plymouth-start.service
+After=rc-local.service plymouth-start.service systemd-user-sessions.service
 
 [Service]
 ExecStart=-/bin/plymouth quit



More information about the systemd-commits mailing list