Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates-src > by-pkgid > ab4b662b9827b6375ffd451bf4abd615 > files > 28

systemd-44-24.fc17.src.rpm

From 3b5680806cc525123904eacd917e749018a18e1a Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Wed, 28 Mar 2012 01:26:04 +0200
Subject: [PATCH] job: add debug prints where job type gets changed (cherry
 picked from commit
 bbd1a8374f90605319d0404ebb423795337161bd)

---
 src/job.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/job.c b/src/job.c
index d43ce8e..8e944b3 100644
--- a/src/job.c
+++ b/src/job.c
@@ -355,6 +355,14 @@ bool job_is_runnable(Job *j) {
         return true;
 }
 
+static void job_change_type(Job *j, JobType newtype) {
+        log_debug("Converting job %s/%s -> %s/%s",
+                  j->unit->id, job_type_to_string(j->type),
+                  j->unit->id, job_type_to_string(newtype));
+
+        j->type = newtype;
+}
+
 int job_run_and_invalidate(Job *j) {
         int r;
         uint32_t id;
@@ -389,11 +397,11 @@ int job_run_and_invalidate(Job *j) {
 
                 case JOB_RELOAD_OR_START:
                         if (unit_active_state(j->unit) == UNIT_ACTIVE) {
-                                j->type = JOB_RELOAD;
+                                job_change_type(j, JOB_RELOAD);
                                 r = unit_reload(j->unit);
                                 break;
                         }
-                        j->type = JOB_START;
+                        job_change_type(j, JOB_START);
                         /* fall through */
 
                 case JOB_START:
@@ -420,7 +428,7 @@ int job_run_and_invalidate(Job *j) {
                                 r = -ENOEXEC;
                                 break;
                         }
-                        j->type = JOB_RESTART;
+                        job_change_type(j, JOB_RESTART);
                         /* fall through */
 
                 case JOB_STOP:
@@ -516,12 +524,8 @@ int job_finish_and_invalidate(Job *j, JobResult result) {
         /* Patch restart jobs so that they become normal start jobs */
         if (result == JOB_DONE && j->type == JOB_RESTART) {
 
-                log_debug("Converting job %s/%s -> %s/%s",
-                          j->unit->id, job_type_to_string(j->type),
-                          j->unit->id, job_type_to_string(JOB_START));
-
+                job_change_type(j, JOB_START);
                 j->state = JOB_WAITING;
-                j->type = JOB_START;
 
                 job_add_to_run_queue(j);