chiark / gitweb /
gc: remove a lot of unused code
[elogind.git] / src / job.c
index 2b422b48773918235fee6e9f0a138099c9bc338b..d7082153de533e8bda5009bf11b561bfb5c39469 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -93,7 +93,7 @@ void job_free(Job *j) {
         free(j);
 }
 
-JobDependency* job_dependency_new(Job *subject, Job *object, bool matters) {
+JobDependency* job_dependency_new(Job *subject, Job *object, bool matters, bool conflicts) {
         JobDependency *l;
 
         assert(object);
@@ -109,6 +109,7 @@ JobDependency* job_dependency_new(Job *subject, Job *object, bool matters) {
         l->subject = subject;
         l->object = object;
         l->matters = matters;
+        l->conflicts = conflicts;
 
         if (subject)
                 LIST_PREPEND(JobDependency, subject, subject->subject_list, l);
@@ -133,30 +134,6 @@ void job_dependency_free(JobDependency *l) {
         free(l);
 }
 
-void job_dependency_delete(Job *subject, Job *object, bool *matters) {
-        JobDependency *l;
-
-        assert(object);
-
-        LIST_FOREACH(object, l, object->object_list) {
-                assert(l->object == object);
-
-                if (l->subject == subject)
-                        break;
-        }
-
-        if (!l) {
-                if (matters)
-                        *matters = false;
-                return;
-        }
-
-        if (matters)
-                *matters = l->matters;
-
-        job_dependency_free(l);
-}
-
 void job_dump(Job *j, FILE*f, const char *prefix) {
         assert(j);
         assert(f);
@@ -485,6 +462,8 @@ int job_finish_and_invalidate(Job *j, bool success) {
 
                 j->state = JOB_WAITING;
                 j->type = JOB_START;
+
+                job_add_to_run_queue(j);
                 return 0;
         }
 
@@ -531,6 +510,14 @@ int job_finish_and_invalidate(Job *j, bool success) {
                                      other->meta.job->type == JOB_VERIFY_ACTIVE ||
                                      other->meta.job->type == JOB_RELOAD_OR_START))
                                         job_finish_and_invalidate(other->meta.job, false);
+
+                        SET_FOREACH(other, u->meta.dependencies[UNIT_CONFLICTED_BY], i)
+                                if (!other->meta.ignore_dependency_failure &&
+                                    other->meta.job &&
+                                    (other->meta.job->type == JOB_START ||
+                                     other->meta.job->type == JOB_VERIFY_ACTIVE ||
+                                     other->meta.job->type == JOB_RELOAD_OR_START))
+                                        job_finish_and_invalidate(other->meta.job, false);
                 }
         }