diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/dropin.c | 11 | ||||
-rw-r--r-- | src/shared/dropin.h | 26 |
2 files changed, 22 insertions, 15 deletions
diff --git a/src/shared/dropin.c b/src/shared/dropin.c index 06cf3de620..3944ccec44 100644 --- a/src/shared/dropin.c +++ b/src/shared/dropin.c @@ -173,7 +173,7 @@ static int iterate_dir( return 0; } -int unit_file_process_dir( +static int unit_file_process_dir( const char *original_root, Set *unit_path_cache, const char *unit_path, @@ -221,6 +221,8 @@ int unit_file_find_dropin_paths( const char *original_root, char **lookup_path, Set *unit_path_cache, + const char *dir_suffix, + const char *file_suffix, Set *names, char ***paths) { @@ -235,16 +237,17 @@ int unit_file_find_dropin_paths( char **p; STRV_FOREACH(p, lookup_path) - unit_file_process_dir(original_root, unit_path_cache, *p, t, ".d", + unit_file_process_dir(original_root, unit_path_cache, + *p, t, dir_suffix, _UNIT_DEPENDENCY_INVALID, NULL, NULL, &strv); } if (strv_isempty(strv)) return 0; - r = conf_files_list_strv(&ans, ".conf", NULL, (const char**) strv); + r = conf_files_list_strv(&ans, file_suffix, NULL, (const char**) strv); if (r < 0) - return log_warning_errno(r, "Failed to get list of configuration files: %m"); + return log_warning_errno(r, "Failed to sort the list of configuration files: %m"); *paths = ans; ans = NULL; diff --git a/src/shared/dropin.h b/src/shared/dropin.h index 761b250886..22cd2fa229 100644 --- a/src/shared/dropin.h +++ b/src/shared/dropin.h @@ -44,20 +44,24 @@ typedef int (*dependency_consumer_t)(UnitDependency dependency, const char* filepath, void *arg); -int unit_file_process_dir( - const char *original_root, - Set * unit_path_cache, - const char *unit_path, - const char *name, - const char *suffix, - UnitDependency dependency, - dependency_consumer_t consumer, - void *arg, - char ***strv); - int unit_file_find_dropin_paths( const char *original_root, char **lookup_path, Set *unit_path_cache, + const char *dir_suffix, + const char *file_suffix, Set *names, char ***paths); + +static inline int unit_file_find_dropin_conf_paths( + const char *original_root, + char **lookup_path, + Set *unit_path_cache, + Set *names, + char ***paths) { + return unit_file_find_dropin_paths(original_root, + lookup_path, + unit_path_cache, + ".d", ".conf", + names, paths); +} |