Skip to content

Commit bcde742

Browse files
committed
conf-parser: turn three bool function params into a flags fields
This makes things more readable and fixes some issues with incorrect flag propagation between the various flavours of config_parse().
1 parent 92b5e60 commit bcde742

File tree

21 files changed

+88
-91
lines changed

21 files changed

+88
-91
lines changed

src/core/load-dropin.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,11 @@ int unit_load_dropin(Unit *u) {
154154
return log_oom();
155155
}
156156

157-
STRV_FOREACH(f, u->dropin_paths) {
158-
config_parse(u->id, *f, NULL,
159-
UNIT_VTABLE(u)->sections,
160-
config_item_perf_lookup, load_fragment_gperf_lookup,
161-
false, false, false, u);
162-
}
157+
STRV_FOREACH(f, u->dropin_paths)
158+
(void) config_parse(u->id, *f, NULL,
159+
UNIT_VTABLE(u)->sections,
160+
config_item_perf_lookup, load_fragment_gperf_lookup,
161+
0, u);
163162

164163
u->dropin_mtime = now(CLOCK_REALTIME);
165164

src/core/load-fragment.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4450,7 +4450,7 @@ static int load_from_path(Unit *u, const char *path) {
44504450
r = config_parse(u->id, filename, f,
44514451
UNIT_VTABLE(u)->sections,
44524452
config_item_perf_lookup, load_fragment_gperf_lookup,
4453-
false, true, false, u);
4453+
CONFIG_PARSE_ALLOW_INCLUDE, u);
44544454
if (r < 0)
44554455
return r;
44564456
}

src/core/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ static int parse_config_file(void) {
768768
CONF_PATHS_NULSTR("systemd/system.conf.d") :
769769
CONF_PATHS_NULSTR("systemd/user.conf.d");
770770

771-
config_parse_many_nulstr(fn, conf_dirs_nulstr, "Manager\0", config_item_table_lookup, items, false, NULL);
771+
(void) config_parse_many_nulstr(fn, conf_dirs_nulstr, "Manager\0", config_item_table_lookup, items, CONFIG_PARSE_WARN, NULL);
772772

773773
/* Traditionally "0" was used to turn off the default unit timeouts. Fix this up so that we used USEC_INFINITY
774774
* like everywhere else. */

src/coredump/coredump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static int parse_config(void) {
147147
CONF_PATHS_NULSTR("systemd/coredump.conf.d"),
148148
"Coredump\0",
149149
config_item_table_lookup, items,
150-
false, NULL);
150+
CONFIG_PARSE_WARN, NULL);
151151
}
152152

153153
static inline uint64_t storage_size_max(void) {

src/journal-remote/journal-remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ static int parse_config(void) {
12541254
return config_parse_many_nulstr(PKGSYSCONFDIR "/journal-remote.conf",
12551255
CONF_PATHS_NULSTR("systemd/journal-remote.conf.d"),
12561256
"Remote\0", config_item_table_lookup, items,
1257-
false, NULL);
1257+
CONFIG_PARSE_WARN, NULL);
12581258
}
12591259

12601260
static void help(void) {

src/journal-remote/journal-upload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ static int parse_config(void) {
543543
return config_parse_many_nulstr(PKGSYSCONFDIR "/journal-upload.conf",
544544
CONF_PATHS_NULSTR("systemd/journal-upload.conf.d"),
545545
"Upload\0", config_item_table_lookup, items,
546-
false, NULL);
546+
CONFIG_PARSE_WARN, NULL);
547547
}
548548

549549
static void help(void) {

src/journal/journald-server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ static int server_parse_config_file(Server *s) {
13981398
CONF_PATHS_NULSTR("systemd/journald.conf.d"),
13991399
"Journal\0",
14001400
config_item_perf_lookup, journald_gperf_lookup,
1401-
false, s);
1401+
CONFIG_PARSE_WARN, s);
14021402
}
14031403

14041404
static int server_dispatch_sync(sd_event_source *es, usec_t t, void *userdata) {

src/login/logind.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ static int manager_parse_config_file(Manager *m) {
10721072
CONF_PATHS_NULSTR("systemd/logind.conf.d"),
10731073
"Login\0",
10741074
config_item_perf_lookup, logind_gperf_lookup,
1075-
false, m);
1075+
CONFIG_PARSE_WARN, m);
10761076
}
10771077

10781078
static int manager_dispatch_reload_signal(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {

src/network/netdev/netdev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ static int netdev_load_one(Manager *manager, const char *filename) {
630630
r = config_parse_many(filename, network_dirs, dropin_dirname,
631631
"Match\0NetDev\0",
632632
config_item_perf_lookup, network_netdev_gperf_lookup,
633-
true, netdev_raw);
633+
CONFIG_PARSE_WARN, netdev_raw);
634634
if (r < 0)
635635
return r;
636636

@@ -671,7 +671,7 @@ static int netdev_load_one(Manager *manager, const char *filename) {
671671
r = config_parse(NULL, filename, file,
672672
NETDEV_VTABLE(netdev)->sections,
673673
config_item_perf_lookup, network_netdev_gperf_lookup,
674-
false, false, false, netdev);
674+
CONFIG_PARSE_WARN, netdev);
675675
if (r < 0)
676676
return r;
677677

src/network/networkd-conf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ int manager_parse_config_file(Manager *m) {
3535
CONF_PATHS_NULSTR("systemd/networkd.conf.d"),
3636
"DHCP\0",
3737
config_item_perf_lookup, networkd_gperf_lookup,
38-
false, m);
38+
CONFIG_PARSE_WARN, m);
3939
}
4040

4141
static const char* const duid_type_table[_DUID_TYPE_MAX] = {

0 commit comments

Comments
 (0)