MEDIUM: cfgparse: add KWF_DISCOVERY keyword flag

This commit is a part of the series to add a support of discovery mode in the
configuration parser and in initialization sequence.

So, let's add here KWF_DISCOVERY flag to distinguish the keywords,
which should be parsed in "discovery" mode and which are needed for master
process, from all others. Keywords, that should be parsed in "discovery" mode
have its dedicated parser funtions. Let's tag these functions with
KWF_DISCOVERY flag in keywords list. Like this, only these keyword parsers
might be called during the first configuration read in discovery mode.
This commit is contained in:
Valentine Krasnobaeva 2024-08-09 18:46:20 +02:00 committed by Willy Tarreau
parent 6769745fe5
commit f9123e2183
3 changed files with 11 additions and 10 deletions

View File

@ -49,6 +49,7 @@ enum kw_mod {
enum cfg_keyword_flags {
KWF_EXPERIMENTAL = 0x1,
KWF_MATCH_PREFIX = 0x2,
KWF_DISCOVERY = 0x4,
};
struct cfg_keyword {

View File

@ -1521,15 +1521,15 @@ static struct cfg_kw_list cfg_kws = {ILH, {
{ CFG_GLOBAL, "force-cfg-parser-pause", cfg_parse_global_parser_pause, KWF_EXPERIMENTAL },
{ CFG_GLOBAL, "harden.reject-privileged-ports.tcp", cfg_parse_reject_privileged_ports },
{ CFG_GLOBAL, "harden.reject-privileged-ports.quic", cfg_parse_reject_privileged_ports },
{ CFG_GLOBAL, "master-worker", cfg_parse_global_master_worker },
{ CFG_GLOBAL, "daemon", cfg_parse_global_mode } ,
{ CFG_GLOBAL, "quiet", cfg_parse_global_mode },
{ CFG_GLOBAL, "zero-warning", cfg_parse_global_mode },
{ CFG_GLOBAL, "noepoll", cfg_parse_global_disable_poller },
{ CFG_GLOBAL, "nokqueue", cfg_parse_global_disable_poller },
{ CFG_GLOBAL, "noevports", cfg_parse_global_disable_poller },
{ CFG_GLOBAL, "nopoll", cfg_parse_global_disable_poller },
{ CFG_GLOBAL, "pidfile", cfg_parse_global_pidfile },
{ CFG_GLOBAL, "master-worker", cfg_parse_global_master_worker, KWF_DISCOVERY },
{ CFG_GLOBAL, "daemon", cfg_parse_global_mode, KWF_DISCOVERY } ,
{ CFG_GLOBAL, "quiet", cfg_parse_global_mode, KWF_DISCOVERY },
{ CFG_GLOBAL, "zero-warning", cfg_parse_global_mode, KWF_DISCOVERY },
{ CFG_GLOBAL, "noepoll", cfg_parse_global_disable_poller, KWF_DISCOVERY },
{ CFG_GLOBAL, "nokqueue", cfg_parse_global_disable_poller, KWF_DISCOVERY },
{ CFG_GLOBAL, "noevports", cfg_parse_global_disable_poller, KWF_DISCOVERY },
{ CFG_GLOBAL, "nopoll", cfg_parse_global_disable_poller, KWF_DISCOVERY },
{ CFG_GLOBAL, "pidfile", cfg_parse_global_pidfile, KWF_DISCOVERY },
{ CFG_GLOBAL, "expose-deprecated-directives", cfg_parse_global_non_std_directives },
{ CFG_GLOBAL, "expose-experimental-directives", cfg_parse_global_non_std_directives },
{ CFG_GLOBAL, "tune.runqueue-depth", cfg_parse_global_tune_opts },

View File

@ -843,7 +843,7 @@ void mworker_create_master_cli(void)
}
static struct cfg_kw_list mworker_kws = {{ }, {
{ CFG_GLOBAL, "mworker-max-reloads", mworker_parse_global_max_reloads },
{ CFG_GLOBAL, "mworker-max-reloads", mworker_parse_global_max_reloads, KWF_DISCOVERY },
{ 0, NULL, NULL },
}};