From: Mike Yuan Date: Wed, 12 Nov 2025 00:32:11 +0000 (+0100) Subject: Revert "sd_path_lookup*() add new type SD_PATH_SEARCH_SYSCTL" X-Git-Tag: v259-rc1~44^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=14a9fb7a8e35562746090d3ecbf6696558354149;p=thirdparty%2Fsystemd.git Revert "sd_path_lookup*() add new type SD_PATH_SEARCH_SYSCTL" --- diff --git a/man/sd_path_lookup.xml b/man/sd_path_lookup.xml index 8fe04ae8af8..fc6bac640c9 100644 --- a/man/sd_path_lookup.xml +++ b/man/sd_path_lookup.xml @@ -76,7 +76,6 @@ SD_PATH_SEARCH_CONFIGURATION_FACTORY, SD_PATH_SEARCH_STATE_FACTORY, SD_PATH_SEARCH_CONFIGURATION, - SD_PATH_SEARCH_SYSCTL, SD_PATH_SYSTEMD_UTIL, SD_PATH_SYSTEMD_SYSTEM_UNIT, diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c index e3877fff4a9..00969971353 100644 --- a/src/libsystemd/sd-path/sd-path.c +++ b/src/libsystemd/sd-path/sd-path.c @@ -683,11 +683,7 @@ static int get_search(uint64_t type, char ***ret) { *ret = TAKE_PTR(l); return 0; - } - - case SD_PATH_SEARCH_SYSCTL: - return strv_from_nulstr(ret, CONF_PATHS_NULSTR("sysctl.d")); - } + }} return -EOPNOTSUPP; } diff --git a/src/path/path-tool.c b/src/path/path-tool.c index 92dbd3496b0..3dc31832b38 100644 --- a/src/path/path-tool.c +++ b/src/path/path-tool.c @@ -66,7 +66,6 @@ static const char* const path_table[_SD_PATH_MAX] = { [SD_PATH_SEARCH_CONFIGURATION_FACTORY] = "search-configuration-factory", [SD_PATH_SEARCH_STATE_FACTORY] = "search-state-factory", [SD_PATH_SEARCH_CONFIGURATION] = "search-configuration", - [SD_PATH_SEARCH_SYSCTL] = "search-sysctl", [SD_PATH_SYSTEMD_UTIL] = "systemd-util", diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c index e90d6c37992..d761c7375a2 100644 --- a/src/sysctl/sysctl.c +++ b/src/sysctl/sysctl.c @@ -4,8 +4,6 @@ #include #include -#include "sd-path.h" - #include "alloc-util.h" #include "build.h" #include "conf-files.h" @@ -281,10 +279,10 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool return 0; } -static int parse_file(OrderedHashmap **sysctl_options, const char *path, bool ignore_enoent, const char **search_paths) { +static int parse_file(OrderedHashmap **sysctl_options, const char *path, bool ignore_enoent) { return conf_file_read( /* root = */ NULL, - search_paths, + (const char**) CONF_PATHS_STRV("sysctl.d"), path, parse_line, sysctl_options, @@ -307,7 +305,7 @@ static int read_credential_lines(OrderedHashmap **sysctl_options) { if (!j) return log_oom(); - return parse_file(sysctl_options, j, /* ignore_enoent= */ true, /* search_paths= */ NULL); + return parse_file(sysctl_options, j, /* ignore_enoent= */ true); } static int cat_config(char **files) { @@ -442,13 +440,8 @@ static int parse_argv(int argc, char *argv[]) { static int run(int argc, char *argv[]) { _cleanup_ordered_hashmap_free_ OrderedHashmap *sysctl_options = NULL; - _cleanup_strv_free_ char **search_paths = NULL; int r; - r = sd_path_lookup_strv(SD_PATH_SEARCH_SYSCTL, /* suffix= */ NULL, &search_paths); - if (r < 0) - return log_error_errno(r, "Failed to get sysctl.d/ search paths: %m"); - r = parse_argv(argc, argv); if (r <= 0) return r; @@ -465,12 +458,12 @@ static int run(int argc, char *argv[]) { /* Use (argument):n, where n==1 for the first positional arg */ RET_GATHER(r, parse_line("(argument)", ++pos, *arg, /* invalid_config = */ NULL, &sysctl_options)); else - RET_GATHER(r, parse_file(&sysctl_options, *arg, /* ignore_enoent= */ false, (const char**) search_paths)); + RET_GATHER(r, parse_file(&sysctl_options, *arg, false)); } } else { _cleanup_strv_free_ char **files = NULL; - r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) search_paths); + r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) CONF_PATHS_STRV("sysctl.d")); if (r < 0) return log_error_errno(r, "Failed to enumerate sysctl.d files: %m"); @@ -478,7 +471,7 @@ static int run(int argc, char *argv[]) { return cat_config(files); STRV_FOREACH(f, files) - RET_GATHER(r, parse_file(&sysctl_options, *f, /* ignore_enoent= */ true, /* search_paths= */ NULL)); + RET_GATHER(r, parse_file(&sysctl_options, *f, true)); RET_GATHER(r, read_credential_lines(&sysctl_options)); } diff --git a/src/systemd/sd-path.h b/src/systemd/sd-path.h index 3199996011a..eb42e31a689 100644 --- a/src/systemd/sd-path.h +++ b/src/systemd/sd-path.h @@ -129,8 +129,6 @@ __extension__ enum { SD_PATH_USER_CREDENTIAL_STORE_ENCRYPTED, SD_PATH_USER_SEARCH_CREDENTIAL_STORE_ENCRYPTED, - SD_PATH_SEARCH_SYSCTL, - _SD_PATH_MAX, _SD_PATH_INVALID = UINT64_MAX };