From ead3a3fc87590d91795397cfa82783a3282cdef2 Mon Sep 17 00:00:00 2001 From: Richard Phibel Date: Mon, 8 Aug 2022 15:40:46 +0200 Subject: [PATCH] config-parser: Add list of drop-in files as return argument of config_parse_many This will be used to save the list of drop-in files for each partition --- src/core/main.c | 1 + src/journal/journald-server.c | 2 +- src/network/netdev/netdev.c | 3 ++- src/network/networkd-network.c | 3 ++- src/resolve/resolved-dnssd.c | 1 + src/shared/conf-parser.c | 12 ++++++++++-- src/shared/conf-parser.h | 3 ++- src/udev/net/link-config.c | 3 ++- 8 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index 467e1dd57c..9ad208fdfc 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -691,6 +691,7 @@ static int parse_config_file(void) { config_item_table_lookup, items, CONFIG_PARSE_WARN, NULL, + NULL, NULL); /* Traditionally "0" was used to turn off the default unit timeouts. Fix this up so that we use diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 954e154f57..e7afbd3eb3 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1746,7 +1746,7 @@ static int server_parse_config_file(Server *s) { dropin_dirname, "Journal\0", config_item_perf_lookup, journald_gperf_lookup, - CONFIG_PARSE_WARN, s, NULL); + CONFIG_PARSE_WARN, s, NULL, NULL); if (r < 0) return r; diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c index e9fadfddde..464f47f2cf 100644 --- a/src/network/netdev/netdev.c +++ b/src/network/netdev/netdev.c @@ -789,6 +789,7 @@ int netdev_load_one(Manager *manager, const char *filename) { config_item_perf_lookup, network_netdev_gperf_lookup, CONFIG_PARSE_WARN, netdev_raw, + NULL, NULL); if (r < 0) return r; /* config_parse_many() logs internally. */ @@ -823,7 +824,7 @@ int netdev_load_one(Manager *manager, const char *filename) { NETDEV_VTABLE(netdev)->sections, config_item_perf_lookup, network_netdev_gperf_lookup, CONFIG_PARSE_WARN, - netdev, NULL); + netdev, NULL, NULL); if (r < 0) return r; /* config_parse_many() logs internally. */ diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 4faa43b327..61b900ada2 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -550,7 +550,8 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi config_item_perf_lookup, network_network_gperf_lookup, CONFIG_PARSE_WARN, network, - &network->stats_by_path); + &network->stats_by_path, + NULL); if (r < 0) return r; /* config_parse_many() logs internally. */ diff --git a/src/resolve/resolved-dnssd.c b/src/resolve/resolved-dnssd.c index 84193eacc1..464892a8fe 100644 --- a/src/resolve/resolved-dnssd.c +++ b/src/resolve/resolved-dnssd.c @@ -93,6 +93,7 @@ static int dnssd_service_load(Manager *manager, const char *filename) { config_item_perf_lookup, resolved_dnssd_gperf_lookup, CONFIG_PARSE_WARN, service, + NULL, NULL); if (r < 0) return r; diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 765ccec501..887ae0dd61 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -588,7 +588,8 @@ int config_parse_many( const void *table, ConfigParseFlags flags, void *userdata, - Hashmap **ret_stats_by_path) { + Hashmap **ret_stats_by_path, + char ***ret_dropin_files) { _cleanup_strv_free_ char **files = NULL; int r; @@ -602,7 +603,14 @@ int config_parse_many( if (r < 0) return r; - return config_parse_many_files(conf_files, files, sections, lookup, table, flags, userdata, ret_stats_by_path); + r = config_parse_many_files(conf_files, files, sections, lookup, table, flags, userdata, ret_stats_by_path); + if (r < 0) + return r; + + if (ret_dropin_files) + *ret_dropin_files = TAKE_PTR(files); + + return 0; } static int dropins_get_stats_by_path( diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h index bd57575af1..32f2498b53 100644 --- a/src/shared/conf-parser.h +++ b/src/shared/conf-parser.h @@ -112,7 +112,8 @@ int config_parse_many( const void *table, ConfigParseFlags flags, void *userdata, - Hashmap **ret_stats_by_path); /* possibly NULL */ + Hashmap **ret_stats_by_path, /* possibly NULL */ + char ***ret_drop_in_files); /* possibly NULL */ int config_get_stats_by_path( const char *suffix, diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 693f5cd3a6..3863808fb0 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -264,7 +264,8 @@ int link_load_one(LinkConfigContext *ctx, const char *filename) { "Link\0" "SR-IOV\0", config_item_perf_lookup, link_config_gperf_lookup, - CONFIG_PARSE_WARN, config, &stats_by_path); + CONFIG_PARSE_WARN, config, &stats_by_path, + NULL); if (r < 0) return r; /* config_parse_many() logs internally. */