mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-28 06:35:34 +07:00
job: job_new() can find the manager from the unit
This commit is contained in:
parent
75778e21df
commit
668ad332a4
@ -33,18 +33,17 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "dbus-job.h"
|
#include "dbus-job.h"
|
||||||
|
|
||||||
Job* job_new(Manager *m, JobType type, Unit *unit) {
|
Job* job_new(Unit *unit, JobType type) {
|
||||||
Job *j;
|
Job *j;
|
||||||
|
|
||||||
assert(m);
|
|
||||||
assert(type < _JOB_TYPE_MAX);
|
assert(type < _JOB_TYPE_MAX);
|
||||||
assert(unit);
|
assert(unit);
|
||||||
|
|
||||||
if (!(j = new0(Job, 1)))
|
if (!(j = new0(Job, 1)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
j->manager = m;
|
j->manager = unit->manager;
|
||||||
j->id = m->current_job_id++;
|
j->id = j->manager->current_job_id++;
|
||||||
j->type = type;
|
j->type = type;
|
||||||
j->unit = unit;
|
j->unit = unit;
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ struct Job {
|
|||||||
bool ignore_order:1;
|
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_uninstall(Job *j);
|
||||||
void job_free(Job *job);
|
void job_free(Job *job);
|
||||||
void job_dump(Job *j, FILE*f, const char *prefix);
|
void job_dump(Job *j, FILE*f, const char *prefix);
|
||||||
|
@ -763,7 +763,7 @@ static Job* transaction_add_one_job(Transaction *tr, JobType type, Unit *unit, b
|
|||||||
if (unit->job && unit->job->type == type)
|
if (unit->job && unit->job->type == type)
|
||||||
j = unit->job;
|
j = unit->job;
|
||||||
else {
|
else {
|
||||||
j = job_new(unit->manager, type, unit);
|
j = job_new(unit, type);
|
||||||
if (!j)
|
if (!j)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user