diff options
author | Franck Bui <fbui@suse.com> | 2023-01-27 11:32:27 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-03-13 19:31:21 +0100 |
commit | 07e0ffc8234b8212a6509fe6dbc1811be03fc3ae (patch) | |
tree | c6e3c15a443bad9f9f6c9c2f220e3fa352cc0f35 /src/journal/journald-server.c | |
parent | Merge pull request #26781 from mrc0mmand/tests-again (diff) | |
download | systemd-07e0ffc8234b8212a6509fe6dbc1811be03fc3ae.tar.xz systemd-07e0ffc8234b8212a6509fe6dbc1811be03fc3ae.zip |
conf: replace config_parse_many_nulstr() with config_parse_config_file()
All daemons use a similar scheme to read their main config files and theirs
drop-ins. The main config files are always stored in /etc/systemd directory and
it's easy enough to construct the name of the drop-in directories based on the
name of the main config file.
Hence the new helper does that internally, which allows to reduce and simplify
the args passed previously to config_parse_many_nulstr().
Besides the overall code simplification it results:
16 files changed, 87 insertions(+), 159 deletions(-)
it allows to identify clearly the locations in the code where configuration
files are parsed.
Diffstat (limited to 'src/journal/journald-server.c')
-rw-r--r-- | src/journal/journald-server.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 3e3b6d44d6..a8958fcb0c 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1853,36 +1853,16 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat } static int server_parse_config_file(Server *s) { - int r; + const char *conf_file = "journald.conf"; assert(s); - if (s->namespace) { - const char *namespaced, *dropin_dirname; - - /* If we are running in namespace mode, load the namespace specific configuration file, and nothing else */ - namespaced = strjoina(PKGSYSCONFDIR "/journald@", s->namespace, ".conf"); - dropin_dirname = strjoina("journald@", s->namespace, ".conf.d"); - - r = config_parse_many( - STRV_MAKE_CONST(namespaced), - (const char* const*) CONF_PATHS_STRV("systemd"), - dropin_dirname, - "Journal\0", - config_item_perf_lookup, journald_gperf_lookup, - CONFIG_PARSE_WARN, s, NULL, NULL); - if (r < 0) - return r; - - return 0; - } + if (s->namespace) + conf_file = strjoina("journald@", s->namespace, ".conf"); - return config_parse_many_nulstr( - PKGSYSCONFDIR "/journald.conf", - CONF_PATHS_NULSTR("systemd/journald.conf.d"), - "Journal\0", - config_item_perf_lookup, journald_gperf_lookup, - CONFIG_PARSE_WARN, s, NULL); + return config_parse_config_file(conf_file, "Journal\0", + config_item_perf_lookup, journald_gperf_lookup, + CONFIG_PARSE_WARN, s); } static int server_dispatch_sync(sd_event_source *es, usec_t t, void *userdata) { |