Crinit -- Configurable Rootfs Init
Loading...
Searching...
No Matches
confparse.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
6#ifndef __CONFPARSE_H__
7#define __CONFPARSE_H__
8
9#include <stdbool.h>
10#include <sys/types.h>
11
12#include "fseries.h"
13
15#define CRINIT_CONFIG_KEYSTR_TASKS "TASKS"
17#define CRINIT_CONFIG_KEYSTR_INCLUDES "INCLUDES"
19#define CRINIT_CONFIG_KEYSTR_TASKDIR_SYMLINKS "TASKDIR_FOLLOW_SYMLINKS"
21#define CRINIT_CONFIG_KEYSTR_DEBUG "DEBUG"
23#define CRINIT_CONFIG_KEYSTR_TASKDIR "TASKDIR"
24#ifdef ENABLE_CAPABILITIES
26#define CRINIT_CONFIG_KEYSTR_DEFAULTCAPS "DEFAULTCAPS"
27#endif
29#define CRINIT_CONFIG_KEYSTR_INCLDIR "INCLUDEDIR"
31#define CRINIT_CONFIG_KEYSTR_SHDGRACEP "SHUTDOWN_GRACE_PERIOD_US"
33#define CRINIT_CONFIG_KEYSTR_USE_SYSLOG "USE_SYSLOG"
35#define CRINIT_CONFIG_KEYSTR_USE_ELOS "USE_ELOS"
37#define CRINIT_CONFIG_KEYSTR_ELOS_SERVER "ELOS_SERVER"
39#define CRINIT_CONFIG_KEYSTR_ELOS_PORT "ELOS_PORT"
41#define CRINIT_CONFIG_KEYSTR_ELOS_EVENT_POLL_INTERVAL "ELOS_EVENT_POLL_INTERVAL"
43#define CRINIT_CONFIG_KEYSTR_LAUNCHER_CMD "LAUNCHER_CMD"
45#define CRINIT_CONFIG_KEYSTR_INCL_SUFFIX "INCLUDE_SUFFIX"
47#define CRINIT_CONFIG_KEYSTR_TASK_FILE_SUFFIX "TASK_FILE_SUFFIX"
48
50#define CRINIT_CONFIG_KEYSTR_SIGKEYDIR "sigkeydir"
52#define CRINIT_CONFIG_KEYSTR_SIGNATURES "signatures"
53
55#define CRINIT_CONFIG_KEYSTR_COMMAND "COMMAND"
56#ifdef ENABLE_CAPABILITIES
58#define CRINIT_CONFIG_KEYSTR_CAP_CLEAR "CAPABILITY_CLEAR"
60#define CRINIT_CONFIG_KEYSTR_CAP_SET "CAPABILITY_SET"
61#endif
63#define CRINIT_CONFIG_KEYSTR_DEPENDS "DEPENDS"
65#define CRINIT_CONFIG_KEYSTR_TRIGGER "TRIGGER"
67#define CRINIT_CONFIG_KEYSTR_TRIGGER_REARM "TRIGGER_REARM"
69#define CRINIT_CONFIG_KEYSTR_ENV_SET "ENV_SET"
71#define CRINIT_CONFIG_KEYSTR_FILTER_DEFINE "FILTER_DEFINE"
73#define CRINIT_CONFIG_KEYSTR_INCLUDE "INCLUDE"
75#define CRINIT_CONFIG_KEYSTR_IOREDIR "IO_REDIRECT"
77#define CRINIT_CONFIG_KEYSTR_NAME "NAME"
79#define CRINIT_CONFIG_KEYSTR_PROVIDES "PROVIDES"
81#define CRINIT_CONFIG_KEYSTR_RESPAWN "RESPAWN"
83#define CRINIT_CONFIG_KEYSTR_RESPAWN_RETRIES "RESPAWN_RETRIES"
85#define CRINIT_CONFIG_KEYSTR_STOP_COMMAND "STOP_COMMAND"
87#define CRINIT_CONFIG_KEYSTR_USER "USER"
89#define CRINIT_CONFIG_KEYSTR_GROUP "GROUP"
90#ifdef ENABLE_CGROUP
92#define CRINIT_CONFIG_KEYSTR_CGROUP_NAME "CGROUP_NAME"
94#define CRINIT_CONFIG_KEYSTR_CGROUP_PARAMS "CGROUP_PARAMS"
96#define CRINIT_CONFIG_KEYSTR_CGROUP_ROOT_NAME "CGROUP_ROOT_NAME"
98#define CRINIT_CONFIG_KEYSTR_CGROUP_ROOT_PARAMS "CGROUP_ROOT_PARAMS"
100#define CRINIT_CONFIG_KEYSTR_CGROUP_GLOBAL_NAME "CGROUP_GLOBAL_NAME"
102#define CRINIT_CONFIG_KEYSTR_CGROUP_GLOBAL_PARAMS "CGROUP_GLOBAL_PARAMS"
103#endif
104
106#define CRINIT_CONFIG_DEFAULT_TASK_FILE_SUFFIX ".crinit"
108#define CRINIT_CONFIG_KEYSTR_INCL_FILE_SUFFIX "INCL_FILE_SUFFIX"
110#define CRINIT_CONFIG_DEFAULT_INCL_FILE_SUFFIX ".crincl"
112#define CRINIT_CONFIG_DEFAULT_DEBUG false
114#define CRINIT_CONFIG_DEFAULT_TASKDIR_SYMLINKS true
115#ifndef CRINIT_LAUNCHER_COMMAND_DEFAULT
116#define CRINIT_CONFIG_DEFAULT_LAUNCHER_CMD "/usr/bin/crinit-launch"
117#else
119#define CRINIT_CONFIG_DEFAULT_LAUNCHER_CMD CRINIT_LAUNCHER_COMMAND_DEFAULT
120#endif
121
122#ifdef ENABLE_CAPABILITIES
125#ifndef CRINIT_CONFIG_DEFAULT_DEFAULTCAPS
126#define CRINIT_CONFIG_DEFAULT_DEFAULTCAPS ""
127#endif
128#endif
130#define CRINIT_CONFIG_DEFAULT_SHDGRACEP 100000uLL
132#define CRINIT_CONFIG_DEFAULT_USE_SYSLOG false
134#define CRINIT_CONFIG_DEFAULT_USE_ELOS false
136#define CRINIT_CONFIG_DEFAULT_ELOS_SERVER "127.0.0.1"
138#define CRINIT_CONFIG_DEFAULT_ELOS_PORT 54321
140#define CRINIT_CONFIG_DEFAULT_INCL_SUFFIX ".crincl"
141
142#define CRINIT_CONFIG_DEFAULT_SIGNATURES false
143
145#define CRINIT_CONFIG_STDOUT_NAME "STDOUT"
147#define CRINIT_CONFIG_STDERR_NAME "STDERR"
149#define CRINIT_CONFIG_STDIN_NAME "STDIN"
150
201
208
217
235int crinitParseConf(crinitConfKvList_t **confList, const char *filename);
236
244
251void crinitFreeArgvArray(char **inArgv);
252
263int crinitLoadSeriesConf(const char *filename);
264
274
275#endif /* __CONFPARSE_H__ */
int crinitLoadTasks(crinitFileSeries_t *series)
Definition confparse.c:287
int crinitParseConf(crinitConfKvList_t **confList, const char *filename)
Definition confparse.c:44
int crinitLoadSeriesConf(const char *filename)
Definition confparse.c:233
crinitConfigType
Definition confparse.h:203
@ CRINIT_CONFIG_TYPE_SERIES
Configurations set from the series file.
Definition confparse.h:204
@ CRINIT_CONFIG_TYPE_KCMDLINE
Configurations set from the Kernel command line.
Definition confparse.h:206
@ CRINIT_CONFIG_TYPE_TASK
Configurations set from a task file.
Definition confparse.h:205
void crinitFreeConfList(crinitConfKvList_t *confList)
Definition confparse.c:210
enum crinitConfigs crinitConfigs_t
void crinitFreeArgvArray(char **inArgv)
Definition confparse.c:224
crinitConfigs
Definition confparse.h:152
@ CRINIT_CONFIG_SIGNATURES
Definition confparse.h:175
@ CRINIT_CONFIGS_SIZE
Definition confparse.h:199
@ CRINIT_CONFIG_DEBUG
Definition confparse.h:154
@ CRINIT_CONFIG_INCLUDE
Definition confparse.h:165
@ CRINIT_CONFIG_USER
Definition confparse.h:185
@ CRINIT_CONFIG_COMMAND
Definition confparse.h:153
@ CRINIT_CONFIG_TRIGGER_REARM
Definition confparse.h:182
@ CRINIT_CONFIG_ELOS_EVENT_POLL_INTERVAL
Definition confparse.h:159
@ CRINIT_CONFIG_TASKS
Definition confparse.h:180
@ CRINIT_CONFIG_TRIGGER
Definition confparse.h:181
@ CRINIT_CONFIG_USE_ELOS
Definition confparse.h:184
@ CRINIT_CONFIG_TASKDIR_FOLLOW_SYMLINKS
Definition confparse.h:179
@ CRINIT_CONFIG_NAME
Definition confparse.h:169
@ CRINIT_CONFIG_FILTER_DEFINE
Definition confparse.h:163
@ CRINIT_CONFIG_TASKDIR
Definition confparse.h:178
@ CRINIT_CONFIG_RESPAWN
Definition confparse.h:171
@ CRINIT_CONFIG_ELOS_SERVER
Definition confparse.h:161
@ CRINIT_CONFIG_USE_SYSLOG
Definition confparse.h:183
@ CRINIT_CONFIG_PROVIDES
Definition confparse.h:170
@ CRINIT_CONFIG_DEPENDS
Definition confparse.h:158
@ CRINIT_CONFIG_LAUNCHER_CMD
Definition confparse.h:186
@ CRINIT_CONFIG_RESPAWN_RETRIES
Definition confparse.h:172
@ CRINIT_CONFIG_GROUP
Definition confparse.h:164
@ CRINIT_CONFIG_ELOS_PORT
Definition confparse.h:160
@ CRINIT_CONFIG_INCLUDE_SUFFIX
Definition confparse.h:166
@ CRINIT_CONFIG_STOP_COMMAND
Definition confparse.h:176
@ CRINIT_CONFIG_SIGKEYDIR
Definition confparse.h:174
@ CRINIT_CONFIG_IOREDIR
Definition confparse.h:168
@ CRINIT_CONFIG_INCLUDEDIR
Definition confparse.h:167
@ CRINIT_CONFIG_TASK_FILE_SUFFIX
Definition confparse.h:177
@ CRINIT_CONFIG_SHDGRACEP
Definition confparse.h:173
@ CRINIT_CONFIG_ENV_SET
Definition confparse.h:162
enum crinitConfigType crinitConfigType_t
struct crinitConfKvList crinitConfKvList_t
Header defining functions related to the handling of a series of filenames within a directory.
Definition confparse.h:212
char * key
string with "KEY"
Definition confparse.h:214
struct crinitConfKvList * next
Pointer to next element.
Definition confparse.h:213
char * val
string with "VALUE"
Definition confparse.h:215
Definition fseries.h:21