1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

Introduce CONF_PATHS_USR_STRV to mirror CONF_PATHS_STRV

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-01-02 13:12:18 +01:00
parent e0b8a238df
commit f7767d76bb
2 changed files with 19 additions and 24 deletions

View File

@ -66,12 +66,20 @@
"/usr/lib/" n "\0" \
_CONF_PATHS_SPLIT_USR_NULSTR(n)
#define CONF_PATHS_USR(n) \
"/etc/" n, \
"/run/" n, \
"/usr/local/lib/" n, \
"/usr/lib/" n
#define CONF_PATHS(n) \
CONF_PATHS_USR(n) \
_CONF_PATHS_SPLIT_USR(n)
#define CONF_PATHS_USR_STRV(n) \
STRV_MAKE(CONF_PATHS_USR(n))
#define CONF_PATHS_STRV(n) \
STRV_MAKE( \
"/etc/" n, \
"/run/" n, \
"/usr/local/lib/" n, \
"/usr/lib/" n \
_CONF_PATHS_SPLIT_USR(n))
STRV_MAKE(CONF_PATHS(n))
#define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL)

View File

@ -15,6 +15,7 @@
#include "alloc-util.h"
#include "conf-files.h"
#include "conf-parser.h"
#include "def.h"
#include "dirent-util.h"
#include "extract-word.h"
#include "fd-util.h"
@ -2821,40 +2822,26 @@ static int split_pattern_into_name_and_instances(const char *pattern, char **out
}
static int presets_find_config(UnitFileScope scope, const char *root_dir, char ***files) {
int r;
const char* const* dirs;
assert(scope >= 0);
assert(scope < _UNIT_FILE_SCOPE_MAX);
assert(files);
switch (scope) {
case UNIT_FILE_SYSTEM:
r = conf_files_list(files, ".preset", root_dir, 0,
"/etc/systemd/system-preset",
"/run/systemd/system-preset",
"/usr/local/lib/systemd/system-preset",
"/usr/lib/systemd/system-preset",
#if HAVE_SPLIT_USR
"/lib/systemd/system-preset",
#endif
NULL);
dirs = (const char* const*) CONF_PATHS_STRV("systemd/system-preset");
break;
case UNIT_FILE_GLOBAL:
case UNIT_FILE_USER:
r = conf_files_list(files, ".preset", root_dir, 0,
"/etc/systemd/user-preset",
"/run/systemd/user-preset",
"/usr/local/lib/systemd/user-preset",
"/usr/lib/systemd/user-preset",
NULL);
dirs = (const char* const*) CONF_PATHS_USR_STRV("systemd/user-preset");
break;
default:
assert_not_reached("Invalid unit file scope");
}
return r;
return conf_files_list_strv(files, ".preset", root_dir, 0, dirs);
}
static int read_presets(UnitFileScope scope, const char *root_dir, Presets *presets) {