1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
9 typedef struct Job Job;
10 typedef struct JobDependency JobDependency;
11 typedef enum JobType JobType;
12 typedef enum JobState JobState;
13 typedef enum JobMode JobMode;
21 JOB_START, /* if a unit does not support being started, we'll just wait until it becomes active */
26 JOB_RELOAD, /* if running reload */
27 JOB_RELOAD_OR_START, /* if running reload, if not running start */
29 /* Note that restarts are first treated like JOB_STOP, but
30 * then instead of finishing are patched to become
32 JOB_RESTART, /* if running stop, then start unconditionally */
33 JOB_TRY_RESTART, /* if running stop and then start */
36 _JOB_TYPE_INVALID = -1
43 _JOB_STATE_INVALID = -1
50 _JOB_MODE_INVALID = -1
53 struct JobDependency {
54 /* Encodes that the 'subject' job needs the 'object' job in
55 * some way. This structure is used only while building a transaction. */
61 LIST_FIELDS(JobDependency, subject);
62 LIST_FIELDS(JobDependency, object);
76 bool matters_to_anchor:1;
79 LIST_FIELDS(Job, transaction);
80 LIST_FIELDS(Job, run_queue);
82 LIST_HEAD(JobDependency, subject_list);
83 LIST_HEAD(JobDependency, object_list);
85 /* Used for graph algs as a "I have been here" marker */
91 Job* job_new(Manager *m, JobType type, Unit *unit);
92 void job_free(Job *job);
93 void job_dump(Job *j, FILE*f, const char *prefix);
95 JobDependency* job_dependency_new(Job *subject, Job *object, bool matters);
96 void job_dependency_free(JobDependency *l);
97 void job_dependency_delete(Job *subject, Job *object, bool *matters);
99 bool job_is_anchor(Job *j);
101 int job_merge(Job *j, Job *other);
103 int job_type_merge(JobType *a, JobType b);
104 bool job_type_is_mergeable(JobType a, JobType b);
105 bool job_type_is_superset(JobType a, JobType b);
106 bool job_type_is_conflicting(JobType a, JobType b);
108 void job_schedule_run(Job *j);
109 int job_run_and_invalidate(Job *j);
110 int job_finish_and_invalidate(Job *j, bool success);
112 const char* job_type_to_string(JobType t);
113 JobType job_type_from_string(const char *s);
115 const char* job_state_to_string(JobState t);
116 JobState job_state_from_string(const char *s);
118 const char* job_mode_to_string(JobMode t);
119 JobMode job_mode_from_string(const char *s);
121 char *job_dbus_path(Job *j);