#include "fileio.h"
#include "build.h"
-static const char conf_file_dirs[] =
- "/etc/binfmt.d\0"
- "/run/binfmt.d\0"
- "/usr/local/lib/binfmt.d\0"
- "/usr/lib/binfmt.d\0"
-#ifdef HAVE_SPLIT_USR
- "/lib/binfmt.d\0"
-#endif
- ;
+static const char conf_file_dirs[] = CONF_DIRS_NULSTR("binfmt");
static int delete_rule(const char *rule) {
_cleanup_free_ char *x = NULL, *fn = NULL;
static char **arg_proc_cmdline_modules = NULL;
-static const char conf_file_dirs[] =
- "/etc/modules-load.d\0"
- "/run/modules-load.d\0"
- "/usr/local/lib/modules-load.d\0"
- "/usr/lib/modules-load.d\0"
-#ifdef HAVE_SPLIT_USR
- "/lib/modules-load.d\0"
-#endif
- ;
+static const char conf_file_dirs[] = CONF_DIRS_NULSTR("modules-load");
static void systemd_kmod_log(void *data, int priority, const char *file, int line,
const char *fn, const char *format, va_list args) {
_found; \
})
+/* Return a nulstr for a standard cascade of configuration directories,
+ * suitable to pass to conf_files_list_nulstr or config_parse_many. */
+#define CONF_DIRS_NULSTR(n) \
+ "/etc/" n ".d\0" \
+ "/run/" n ".d\0" \
+ "/usr/local/lib/" n ".d\0" \
+ "/usr/lib/" n ".d\0" \
+ CONF_DIR_SPLIT_USR(n)
+
+#ifdef HAVE_SPLIT_USR
+#define CONF_DIR_SPLIT_USR(n) "/lib/" n ".d\0"
+#else
+#define CONF_DIR_SPLIT_USR(n)
+#endif
+
/* Define C11 thread_local attribute even on older gcc compiler
* version */
#ifndef thread_local
static char **arg_prefixes = NULL;
-static const char conf_file_dirs[] =
- "/etc/sysctl.d\0"
- "/run/sysctl.d\0"
- "/usr/local/lib/sysctl.d\0"
- "/usr/lib/sysctl.d\0"
-#ifdef HAVE_SPLIT_USR
- "/lib/sysctl.d\0"
-#endif
- ;
+static const char conf_file_dirs[] = CONF_DIRS_NULSTR("sysctl");
static char* normalize_sysctl(char *s) {
char *n;
static char *arg_root = NULL;
-static const char conf_file_dirs[] =
- "/etc/sysusers.d\0"
- "/run/sysusers.d\0"
- "/usr/local/lib/sysusers.d\0"
- "/usr/lib/sysusers.d\0"
-#ifdef HAVE_SPLIT_USR
- "/lib/sysusers.d\0"
-#endif
- ;
+static const char conf_file_dirs[] = CONF_DIRS_NULSTR("sysusers");
static Hashmap *users = NULL, *groups = NULL;
static Hashmap *todo_uids = NULL, *todo_gids = NULL;
static char **arg_exclude_prefixes = NULL;
static char *arg_root = NULL;
-static const char conf_file_dirs[] =
- "/etc/tmpfiles.d\0"
- "/run/tmpfiles.d\0"
- "/usr/local/lib/tmpfiles.d\0"
- "/usr/lib/tmpfiles.d\0"
-#ifdef HAVE_SPLIT_USR
- "/lib/tmpfiles.d\0"
-#endif
- ;
+static const char conf_file_dirs[] = CONF_DIRS_NULSTR("tmpfiles");
#define MAX_DEPTH 256