|
Crinit -- Configurable Rootfs Init
|
Implementation of functions related to a single task. More...
#include "task.h"#include <stdlib.h>#include "common.h"#include "confmap.h"#include "globopt.h"#include "logio.h"
Functions | |
| static int | crinitTaskSetFromConfKvList (crinitTask_t *tgt, const crinitConfKvList_t *src, crinitTaskType_t type, char *importList) |
| static int | crinitCopyCommandBlock (char *name, size_t cmdsSize, crinitTaskCmd_t *origCmds, crinitTaskCmd_t **outCmds) |
| int | crinitTaskCreateFromConfKvList (crinitTask_t **out, const crinitConfKvList_t *in) |
| int | crinitTaskCopy (crinitTask_t *out, const crinitTask_t *orig) |
| int | crinitTaskDup (crinitTask_t **out, const crinitTask_t *orig) |
| void | crinitFreeTask (crinitTask_t *t) |
| void | crinitDestroyTask (crinitTask_t *t) |
| int | crinitTaskMergeInclude (crinitTask_t *tgt, const char *src, char *importList) |
Implementation of functions related to a single task.
|
static |
Helper function to copy command blocks.
| name | Name of task (for error messages, etc.) |
| cmdsSize | Number of elements in command block |
| origCmds | Source command block |
| outCmds | Destination command block |
| 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. |
|
inlinestatic |
Helper function to go through an crinitConfKvList_t and apply all contained settings to a target task.
Will call appropriate config handlers (see confhdl.h).
| tgt | The target task to be modified. |
| src | The list of config parameters from a task config file. |
| type | The crinitTaskType_t of the source task configuration file, i.e. if it is a regular task or an include file. Relevant for checking include safety of options and for importList behavior. |
| importList | A comma-separated list of option names to be used from src. If NULL, all are used. Only relevant if type == CRINIT_TASK_TYPE_INCLUDE. |