Crinit -- Configurable Rootfs Init
|
Header defining the data structures belonging to a single task and related functions. More...
Go to the source code of this file.
Classes | |
struct | crinitTaskCmd_t |
struct | crinitTaskDep_t |
struct | crinitTaskPrv_t |
struct | crinitTask_t |
Macros | |
#define | CRINIT_TASK_OPT_RESPAWN (1 << 0) |
RESPAWN task option bitmask. More... | |
#define | CRINIT_TASK_OPT_RESPAWN_DEFAULT false |
Default value for RESPAWN option. More... | |
#define | CRINIT_TASK_EVENT_RUNNING "spawn" |
Dependency event that fires when a task reaches the RUNNING state. More... | |
#define | CRINIT_TASK_EVENT_DONE "wait" |
Dependency event that fires when a task reaches the DONE state. More... | |
#define | CRINIT_TASK_EVENT_FAILED "fail" |
Dependency event that fires when a task reaches the FAILED state. More... | |
#define | CRINIT_TASK_EVENT_NOTIFY_SUFFIX "-notified" |
Dependency event suffix to indicate the event needs to be generated by sd-notify. More... | |
#define | crinitTaskForEachDep(task, dep) for ((dep) = (task)->deps; (dep) != (task)->deps + (task)->depsSize; (dep)++) |
Typedefs | |
typedef unsigned long | crinitTaskOpts_t |
Type to store Task option bitmask. More... | |
typedef enum crinitTaskType_t | crinitTaskType_t |
typedef struct crinitTaskCmd_t | crinitTaskCmd_t |
typedef struct crinitTaskDep_t | crinitTaskDep_t |
typedef struct crinitTaskPrv_t | crinitTaskPrv_t |
typedef struct crinitTask_t | crinitTask_t |
Enumerations | |
enum | crinitTaskType_t { CRINIT_TASK_TYPE_STANDARD , CRINIT_TASK_TYPE_INCLUDE } |
Functions | |
int | crinitTaskCreateFromConfKvList (crinitTask_t **out, const crinitConfKvList_t *in) |
void | crinitFreeTask (crinitTask_t *t) |
void | crinitDestroyTask (crinitTask_t *t) |
int | crinitTaskDup (crinitTask_t **out, const crinitTask_t *orig) |
int | crinitTaskCopy (crinitTask_t *out, const crinitTask_t *orig) |
int | crinitTaskMergeInclude (crinitTask_t *tgt, const char *src, char *importList) |
Header defining the data structures belonging to a single task and related functions.
#define CRINIT_TASK_EVENT_DONE "wait" |
Dependency event that fires when a task reaches the DONE state.
#define CRINIT_TASK_EVENT_FAILED "fail" |
Dependency event that fires when a task reaches the FAILED state.
#define CRINIT_TASK_EVENT_NOTIFY_SUFFIX "-notified" |
Dependency event suffix to indicate the event needs to be generated by sd-notify.
#define CRINIT_TASK_EVENT_RUNNING "spawn" |
Dependency event that fires when a task reaches the RUNNING state.
#define CRINIT_TASK_OPT_RESPAWN (1 << 0) |
RESPAWN task option bitmask.
#define CRINIT_TASK_OPT_RESPAWN_DEFAULT false |
Default value for RESPAWN option.
#define crinitTaskForEachDep | ( | task, | |
dep | |||
) | for ((dep) = (task)->deps; (dep) != (task)->deps + (task)->depsSize; (dep)++) |
Given a crinitTask_t, iterate over all dependencies of this task.
task | Pointer to the task. |
dep | Pointer to the current dependency. |
typedef struct crinitTask_t crinitTask_t |
Type to store a single task.
typedef struct crinitTaskCmd_t crinitTaskCmd_t |
Type to store a single command within a task.
typedef struct crinitTaskDep_t crinitTaskDep_t |
Type to store a single dependency within a task.
typedef unsigned long crinitTaskOpts_t |
Type to store Task option bitmask.
typedef struct crinitTaskPrv_t crinitTaskPrv_t |
Type to store a single provided feature within a task.
typedef enum crinitTaskType_t crinitTaskType_t |
enum crinitTaskType_t |
void crinitDestroyTask | ( | crinitTask_t * | t | ) |
Frees memory for internal members of an crinitTask_t.
t | The task whose members shall be freed. |
void crinitFreeTask | ( | crinitTask_t * | t | ) |
Frees memory associated with an crinitTask created by crinitTaskCreateFromConfKvList() or crinitTaskDup().
Uses crinitDestroyTask() internally and then frees the given pointer.
t | Pointer to the crinitTask to free. |
int crinitTaskCopy | ( | crinitTask_t * | out, |
const crinitTask_t * | orig | ||
) |
Copies the conents from one task to another.
out | Pointer to copy of orig. |
orig | The original task to copy. |
int crinitTaskCreateFromConfKvList | ( | crinitTask_t ** | out, |
const crinitConfKvList_t * | in | ||
) |
Given an crinitConfKvList_t created from a task config, build an equivalent crinitTask.
The crinitTask returned via out is dynamically allocated and should be freed using crinitFreeTask if no longer needed.
out | The return pointer for the newly created task. |
in | The crinitConfKvList_t from which to build the task. |
int crinitTaskDup | ( | crinitTask_t ** | out, |
const crinitTask_t * | orig | ||
) |
Duplicates an crinitTask.
The copy returned via out is dynamically allocated and should be freed using crinitFreeTask() if no longer needed.
out | Double pointer to return a dynamically allocated copy of orig. |
orig | The original task to copy. |
int crinitTaskMergeInclude | ( | crinitTask_t * | tgt, |
const char * | src, | ||
char * | importList | ||
) |
Merges the options set in a given include file into the target crinitTask_t.
Uses the same parser handlers as regular task files but will fail if configuration options are encountered where crinitConfigMapping_t::includeSafe is false
. Optionally a comma-separated importList can be specified. If given, only the configuration options in the list will be merged. If not given, everything in the include file will be imported.
tgt | The target crinitTask_t which will be modified. |
src | Name of the include file to parse/merge (filename without leading path and ending). |
importList | A comma-separated list which configs to merge from the include file. NULL means everything. |