From b395aac97d4b8be2f3e6232ba0412ff8203b47bb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 16 Apr 2018 21:24:13 +0200 Subject: conf-files: beef up conf-files.[ch] a bit This adds fozr new flags: - If CONF_FILES_DIRECTORY is specified conf_file_list() and friends will look for directories only. - Similar CONF_FILES_REGULAR means we'll look only for regular files. - If CONF_FILES_BASENAME is specified the resulting list will contain only the basenames of all discovered files or directories, not the full paths. - If CONF_FILES_FILTER_MASKED is specified the resulting list will have masked entries removed (i.e. those symlinked to /dev/null and suchlike) These four flags are useful for discovering portable service profile information. While we are at it, also improve a couple of other things: - More debug logging - use path_hash_ops instead of string_hash_ops when putting together the path lists --- src/basic/conf-files.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/basic/conf-files.h') diff --git a/src/basic/conf-files.h b/src/basic/conf-files.h index 2dd1b272c..78d03e6e0 100644 --- a/src/basic/conf-files.h +++ b/src/basic/conf-files.h @@ -9,7 +9,11 @@ ***/ enum { - CONF_FILES_EXECUTABLE = 1, + CONF_FILES_EXECUTABLE = 1U << 0, + CONF_FILES_REGULAR = 1U << 1, + CONF_FILES_DIRECTORY = 1U << 2, + CONF_FILES_BASENAME = 1U << 3, + CONF_FILES_FILTER_MASKED = 1U << 4, }; int conf_files_list(char ***ret, const char *suffix, const char *root, unsigned flags, const char *dir, ...); -- cgit v1.2.3