summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/job.c16
-rw-r--r--src/core/job.h17
2 files changed, 18 insertions, 15 deletions
diff --git a/src/core/job.c b/src/core/job.c
index 468571ae71..49cda53f22 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -162,6 +162,7 @@ static void job_set_state(Job *j, JobState state) {
void job_uninstall(Job *j) {
Job **pj;
+ assert(j);
assert(j->installed);
job_set_state(j, JOB_WAITING);
@@ -329,14 +330,16 @@ JobDependency* job_dependency_new(Job *subject, Job *object, bool matters, bool
* this means the 'anchor' job (i.e. the one the user
* explicitly asked for) is the requester. */
- l = new0(JobDependency, 1);
+ l = new(JobDependency, 1);
if (!l)
return NULL;
- l->subject = subject;
- l->object = object;
- l->matters = matters;
- l->conflicts = conflicts;
+ *l = (JobDependency) {
+ .subject = subject,
+ .object = object,
+ .matters = matters,
+ .conflicts = conflicts,
+ };
if (subject)
LIST_PREPEND(subject, subject->subject_list, l);
@@ -494,6 +497,7 @@ JobType job_type_collapse(JobType t, Unit *u) {
return JOB_RELOAD;
default:
+ assert(t >= 0 && t < _JOB_TYPE_MAX_IN_TRANSACTION);
return t;
}
}
@@ -1243,7 +1247,7 @@ int job_deserialize(Job *j, FILE *f) {
for (;;) {
_cleanup_free_ char *l = NULL;
size_t k;
- char *v;
+ const char *v;
r = deserialize_read_line(f, &l);
if (r < 0)
diff --git a/src/core/job.h b/src/core/job.h
index 680b4a6016..7603f311f2 100644
--- a/src/core/job.h
+++ b/src/core/job.h
@@ -127,7 +127,7 @@ struct Job {
LIST_HEAD(JobDependency, object_list);
/* Used for graph algs as a "I have been here" marker */
- Job* marker;
+ Job *marker;
unsigned generation;
uint32_t id;
@@ -135,6 +135,10 @@ struct Job {
JobType type;
JobState state;
+ JobResult result;
+
+ unsigned run_queue_idx;
+
sd_event_source *timer_event_source;
usec_t begin_usec;
usec_t begin_running_usec;
@@ -149,10 +153,6 @@ struct Job {
sd_bus_track *bus_track;
char **deserialized_clients;
- JobResult result;
-
- unsigned run_queue_idx;
-
/* If the job had a specific trigger that needs to be advertised (eg: a path unit), store it. */
ActivationDetails *activation_details;
@@ -171,9 +171,12 @@ Job* job_new(Unit *unit, JobType type);
Job* job_new_raw(Unit *unit);
void job_unlink(Job *job);
Job* job_free(Job *job);
+DEFINE_TRIVIAL_CLEANUP_FUNC(Job*, job_free);
+
Job* job_install(Job *j, bool refuse_late_merge);
int job_install_deserialized(Job *j);
void job_uninstall(Job *j);
+
void job_dump(Job *j, FILE *f, const char *prefix);
int job_serialize(Job *j, FILE *f);
int job_deserialize(Job *j, FILE *f);
@@ -182,8 +185,6 @@ int job_coldplug(Job *j);
JobDependency* job_dependency_new(Job *subject, Job *object, bool matters, bool conflicts);
void job_dependency_free(JobDependency *l);
-int job_merge(Job *j, Job *other);
-
JobType job_type_lookup_merge(JobType a, JobType b) _pure_;
_pure_ static inline bool job_type_is_mergeable(JobType a, JobType b) {
@@ -231,8 +232,6 @@ void job_add_to_gc_queue(Job *j);
int job_get_before(Job *j, Job*** ret);
int job_get_after(Job *j, Job*** ret);
-DEFINE_TRIVIAL_CLEANUP_FUNC(Job*, job_free);
-
const char* job_type_to_string(JobType t) _const_;
JobType job_type_from_string(const char *s) _pure_;