diff --git a/man/udev.xml b/man/udev.xml index 74aab8e024..c82a3998f4 100644 --- a/man/udev.xml +++ b/man/udev.xml @@ -45,20 +45,18 @@ Rules Files - The udev rules are read from the files located in the - system rules directory /usr/lib/udev/rules.d, - the volatile runtime directory /run/udev/rules.d - and the local administration directory /etc/udev/rules.d. - All rules files are collectively sorted and processed in lexical order, - regardless of the directories in which they live. However, files with - identical filenames replace each other. Files in /etc - have the highest priority, files in /run take precedence - over files with the same name in /usr/lib. This can be - used to override a system-supplied rules file with a local file if needed; - a symlink in /etc with the same name as a rules file in - /usr/lib, pointing to /dev/null, - disables the rules file entirely. Rule files must have the extension - .rules; other extensions are ignored. + The udev rules are read from the files located in the system rules directories + /usr/lib/udev/rules.d and /usr/local/lib/udev/rules.d, the + volatile runtime directory /run/udev/rules.d and the local administration + directory /etc/udev/rules.d. All rules files are collectively sorted and + processed in lexical order, regardless of the directories in which they live. However, files with + identical filenames replace each other. Files in /etc have the highest priority, + files in /run take precedence over files with the same name under + /usr. This can be used to override a system-supplied rules file with a local + file if needed; a symlink in /etc with the same name as a rules file in + /usr/lib, pointing to /dev/null, disables the rules file + entirely. Rule files must have the extension .rules; other extensions are + ignored. Every line in the rules file contains at least one key-value pair. Except for empty lines or lines beginning with #, which are ignored. diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 8603c75cb6..a38853df00 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -15,6 +15,7 @@ #include "alloc-util.h" #include "conf-files.h" +#include "def.h" #include "device-private.h" #include "device-util.h" #include "dirent-util.h" @@ -41,6 +42,7 @@ #include "util.h" #define PREALLOC_TOKEN 2048 +#define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d") struct uid_gid { unsigned name_off; @@ -50,13 +52,6 @@ struct uid_gid { }; }; -static const char* const rules_dirs[] = { - "/etc/udev/rules.d", - "/run/udev/rules.d", - UDEVLIBEXECDIR "/rules.d", - NULL -}; - struct UdevRules { usec_t dirs_ts_usec; ResolveNameTiming resolve_name_timing; @@ -1609,7 +1604,7 @@ int udev_rules_new(UdevRules **ret_rules, ResolveNameTiming resolve_name_timing) udev_rules_check_timestamp(rules); - r = conf_files_list_strv(&files, ".rules", NULL, 0, rules_dirs); + r = conf_files_list_strv(&files, ".rules", NULL, 0, RULES_DIRS); if (r < 0) return log_error_errno(r, "Failed to enumerate rules files: %m"); @@ -1661,7 +1656,7 @@ bool udev_rules_check_timestamp(UdevRules *rules) { if (!rules) return false; - return paths_check_timestamp(rules_dirs, &rules->dirs_ts_usec, true); + return paths_check_timestamp(RULES_DIRS, &rules->dirs_ts_usec, true); } static bool match_key(UdevRules *rules, struct token *token, const char *val) {