Crinit -- Configurable Rootfs Init
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 
14 #define CRINIT_CONFIG_KEYSTR_TASKS "TASKS"
15 #define CRINIT_CONFIG_KEYSTR_INCLUDES "INCLUDES"
16 #define CRINIT_CONFIG_KEYSTR_TASKDIR_SYMLINKS \
17  "TASKDIR_FOLLOW_SYMLINKS"
19 #define CRINIT_CONFIG_KEYSTR_DEBUG "DEBUG"
20 #define CRINIT_CONFIG_KEYSTR_TASKDIR "TASKDIR"
21 #define CRINIT_CONFIG_KEYSTR_INCLDIR "INCLUDEDIR"
22 #define CRINIT_CONFIG_KEYSTR_SHDGRACEP \
23  "SHUTDOWN_GRACE_PERIOD_US"
24 #define CRINIT_CONFIG_KEYSTR_USE_SYSLOG "USE_SYSLOG"
25 #define CRINIT_CONFIG_KEYSTR_USE_ELOS "USE_ELOS"
26 #define CRINIT_CONFIG_KEYSTR_ELOS_SERVER "ELOS_SERVER"
27 #define CRINIT_CONFIG_KEYSTR_ELOS_PORT "ELOS_PORT"
28 #define CRINIT_CONFIG_KEYSTR_INCL_SUFFIX "INCLUDE_SUFFIX"
29 #define CRINIT_CONFIG_KEYSTR_TASK_FILE_SUFFIX \
30  "TASK_FILE_SUFFIX"
31 
32 #define CRINIT_CONFIG_KEYSTR_COMMAND "COMMAND"
33 #define CRINIT_CONFIG_KEYSTR_DEPENDS "DEPENDS"
34 #define CRINIT_CONFIG_KEYSTR_ENV_SET "ENV_SET"
35 #define CRINIT_CONFIG_KEYSTR_FILTER_DEFINE "FILTER_DEFINE"
36 #define CRINIT_CONFIG_KEYSTR_INCLUDE "INCLUDE"
37 #define CRINIT_CONFIG_KEYSTR_IOREDIR "IO_REDIRECT"
38 #define CRINIT_CONFIG_KEYSTR_NAME "NAME"
39 #define CRINIT_CONFIG_KEYSTR_PROVIDES "PROVIDES"
40 #define CRINIT_CONFIG_KEYSTR_RESPAWN "RESPAWN"
41 #define CRINIT_CONFIG_KEYSTR_RESPAWN_RETRIES \
42  "RESPAWN_RETRIES"
43 
44 #define CRINIT_CONFIG_DEFAULT_TASK_FILE_SUFFIX ".crinit"
45 #define CRINIT_CONFIG_KEYSTR_INCL_FILE_SUFFIX \
46  "INCL_FILE_SUFFIX"
47 #define CRINIT_CONFIG_DEFAULT_INCL_FILE_SUFFIX ".crincl"
48 #define CRINIT_CONFIG_DEFAULT_DEBUG false
49 #define CRINIT_CONFIG_DEFAULT_TASKDIR "/etc/crinit"
50 #define CRINIT_CONFIG_DEFAULT_TASKDIR_SYMLINKS true
51 
52 #define CRINIT_CONFIG_DEFAULT_INCLDIR "/etc/crinit"
53 #define CRINIT_CONFIG_DEFAULT_SHDGRACEP 100000uLL
54 #define CRINIT_CONFIG_DEFAULT_USE_SYSLOG false
55 #define CRINIT_CONFIG_DEFAULT_USE_ELOS false
56 #define CRINIT_CONFIG_DEFAULT_ELOS_SERVER "127.0.0.1"
57 #define CRINIT_CONFIG_DEFAULT_ELOS_PORT 54321
58 #define CRINIT_CONFIG_DEFAULT_INCL_SUFFIX ".crincl"
59 
60 #define CRINIT_CONFIG_STDOUT_NAME "STDOUT"
61 #define CRINIT_CONFIG_STDERR_NAME "STDERR"
62 #define CRINIT_CONFIG_STDIN_NAME "STDIN"
63 
65 typedef enum crinitConfigs_t {
90 
92 
96 typedef struct crinitConfKvList_t {
98  char *key;
99  char *val;
101 
117 int crinitParseConf(crinitConfKvList_t **confList, const char *filename);
118 
125 void crinitFreeConfList(crinitConfKvList_t *confList);
126 
133 void crinitFreeArgvArray(char **inArgv);
134 
147 int crinitLoadSeriesConf(crinitFileSeries_t *series, const char *filename);
148 
149 #endif /* __CONFPARSE_H__ */
int crinitParseConf(crinitConfKvList_t **confList, const char *filename)
Definition: confparse.c:40
void crinitFreeConfList(crinitConfKvList_t *confList)
Definition: confparse.c:152
void crinitFreeArgvArray(char **inArgv)
Definition: confparse.c:166
crinitConfigType_t
Definition: confparse.h:91
@ CRINIT_CONFIG_TYPE_SERIES
Definition: confparse.h:91
@ CRINIT_CONFIG_TYPE_TASK
Definition: confparse.h:91
crinitConfigs_t
Definition: confparse.h:65
@ CRINIT_CONFIGS_SIZE
Definition: confparse.h:88
@ CRINIT_CONFIG_DEBUG
Definition: confparse.h:67
@ CRINIT_CONFIG_INCLUDE
Definition: confparse.h:73
@ CRINIT_CONFIG_COMMAND
Definition: confparse.h:66
@ CRINIT_CONFIG_TASKS
Definition: confparse.h:85
@ CRINIT_CONFIG_USE_ELOS
Definition: confparse.h:87
@ CRINIT_CONFIG_TASKDIR_FOLLOW_SYMLINKS
Definition: confparse.h:84
@ CRINIT_CONFIG_NAME
Definition: confparse.h:77
@ CRINIT_CONFIG_FILTER_DEFINE
Definition: confparse.h:72
@ CRINIT_CONFIG_TASKDIR
Definition: confparse.h:83
@ CRINIT_CONFIG_RESPAWN
Definition: confparse.h:79
@ CRINIT_CONFIG_ELOS_SERVER
Definition: confparse.h:70
@ CRINIT_CONFIG_USE_SYSLOG
Definition: confparse.h:86
@ CRINIT_CONFIG_PROVIDES
Definition: confparse.h:78
@ CRINIT_CONFIG_DEPENDS
Definition: confparse.h:68
@ CRINIT_CONFIG_RESPAWN_RETRIES
Definition: confparse.h:80
@ CRINIT_CONFIG_ELOS_PORT
Definition: confparse.h:69
@ CRINIT_CONFIG_INCLUDE_SUFFIX
Definition: confparse.h:74
@ CRINIT_CONFIG_IOREDIR
Definition: confparse.h:76
@ CRINIT_CONFIG_INCLUDEDIR
Definition: confparse.h:75
@ CRINIT_CONFIG_TASK_FILE_SUFFIX
Definition: confparse.h:82
@ CRINIT_CONFIG_SHDGRACEP
Definition: confparse.h:81
@ CRINIT_CONFIG_ENV_SET
Definition: confparse.h:71
struct crinitConfKvList_t crinitConfKvList_t
int crinitLoadSeriesConf(crinitFileSeries_t *series, const char *filename)
Definition: confparse.c:209
Header defining functions related to the handling of a series of filenames within a directory.
Definition: confparse.h:96
struct crinitConfKvList_t * next
Pointer to next element.
Definition: confparse.h:97
char * key
string with "KEY"
Definition: confparse.h:98
char * val
string with "VALUE"
Definition: confparse.h:99
Definition: fseries.h:21