summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2012-04-18 01:39:20 +0200
committerMichal Schmidt <mschmidt@redhat.com>2012-04-20 17:12:27 +0200
commit668ad332a404736474749cbcc8404af3e4447170 (patch)
treea92eca0b9a7a099637ba093668c13579cb22f5b1
parent75778e21dfeee51036d24501e39ea7398fabe502 (diff)
job: job_new() can find the manager from the unit
-rw-r--r--src/core/job.c7
-rw-r--r--src/core/job.h2
-rw-r--r--src/core/transaction.c2
3 files changed, 5 insertions, 6 deletions
diff --git a/src/core/job.c b/src/core/job.c
index 543f37d0db..bfb6b7443a 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -33,18 +33,17 @@
#include "log.h"
#include "dbus-job.h"
-Job* job_new(Manager *m, JobType type, Unit *unit) {
+Job* job_new(Unit *unit, JobType type) {
Job *j;
- assert(m);
assert(type < _JOB_TYPE_MAX);
assert(unit);
if (!(j = new0(Job, 1)))
return NULL;
- j->manager = m;
- j->id = m->current_job_id++;
+ j->manager = unit->manager;
+ j->id = j->manager->current_job_id++;
j->type = type;
j->unit = unit;
diff --git a/src/core/job.h b/src/core/job.h
index e25fc26235..35c213d740 100644
--- a/src/core/job.h
+++ b/src/core/job.h
@@ -137,7 +137,7 @@ struct Job {
bool ignore_order:1;
};
-Job* job_new(Manager *m, JobType type, Unit *unit);
+Job* job_new(Unit *unit, JobType type);
void job_uninstall(Job *j);
void job_free(Job *job);
void job_dump(Job *j, FILE*f, const char *prefix);
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 8fa89a7be3..1344e2fb96 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -763,7 +763,7 @@ static Job* transaction_add_one_job(Transaction *tr, JobType type, Unit *unit, b
if (unit->job && unit->job->type == type)
j = unit->job;
else {
- j = job_new(unit->manager, type, unit);
+ j = job_new(unit, type);
if (!j)
return NULL;
}