diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-11-13 11:33:32 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-11-13 14:35:36 +0100 |
commit | a14e7af16216170bd5d181acafef10254a47f3ae (patch) | |
tree | 5dd1b043e6355d1c579af44cd8ae4b8b792c7f9c | |
parent | udev: move ResolveNameTiming definition and parsers to udev-util.h (diff) | |
download | systemd-a14e7af16216170bd5d181acafef10254a47f3ae.tar.xz systemd-a14e7af16216170bd5d181acafef10254a47f3ae.zip |
udev: also allow resolve_names= to be specified in udev.conf
-rw-r--r-- | man/udev.conf.xml | 13 | ||||
-rw-r--r-- | src/shared/udev-util.c | 15 | ||||
-rw-r--r-- | src/shared/udev-util.h | 5 | ||||
-rw-r--r-- | src/udev/udev.conf | 1 | ||||
-rw-r--r-- | src/udev/udevd.c | 2 |
5 files changed, 31 insertions, 5 deletions
diff --git a/man/udev.conf.xml b/man/udev.conf.xml index 7b7cae16b2..23a4595fa9 100644 --- a/man/udev.conf.xml +++ b/man/udev.conf.xml @@ -87,6 +87,19 @@ </listitem> </varlistentry> + <varlistentry> + <term><varname>resolve_names=</varname></term> + + <listitem> + <para>Specifes when systemd-udevd should resolve names of users and groups. When set to + <option>early</option> (the default), names will be resolved when the rules are parsed. + When set to <option>late</option>, names will be resolved for every event. When set to + <option>never</option>, names will never be resolved and all devices will be owned by + root.</para> + + <para>This is the same as the <option>--resolve-names=</option> option.</para> + </listitem> + </varlistentry> </variablelist> <para> diff --git a/src/shared/udev-util.c b/src/shared/udev-util.c index a85a33d3ae..959217c511 100644 --- a/src/shared/udev-util.c +++ b/src/shared/udev-util.c @@ -23,9 +23,10 @@ DEFINE_STRING_TABLE_LOOKUP(resolve_name_timing, ResolveNameTiming); int udev_parse_config_full( unsigned *ret_children_max, usec_t *ret_exec_delay_usec, - usec_t *ret_event_timeout_usec) { + usec_t *ret_event_timeout_usec, + ResolveNameTiming *ret_resolve_name_timing) { - _cleanup_free_ char *log_val = NULL, *children_max = NULL, *exec_delay = NULL, *event_timeout = NULL; + _cleanup_free_ char *log_val = NULL, *children_max = NULL, *exec_delay = NULL, *event_timeout = NULL, *resolve_names = NULL; int r; r = parse_env_file(NULL, "/etc/udev/udev.conf", NEWLINE, @@ -78,5 +79,15 @@ int udev_parse_config_full( log_notice_errno(r, "/etc/udev/udev.conf: failed to set parse event_timeout=%s, ignoring: %m", event_timeout); } + if (ret_resolve_name_timing && resolve_names) { + ResolveNameTiming t; + + t = resolve_name_timing_from_string(resolve_names); + if (t < 0) + log_notice("/etc/udev/udev.conf: failed to set parse resolve_names=%s, ignoring.", resolve_names); + else + *ret_resolve_name_timing = t; + } + return 0; } diff --git a/src/shared/udev-util.h b/src/shared/udev-util.h index b1913daf86..be08fe1ff8 100644 --- a/src/shared/udev-util.h +++ b/src/shared/udev-util.h @@ -17,8 +17,9 @@ const char *resolve_name_timing_to_string(ResolveNameTiming i) _const_; int udev_parse_config_full( unsigned *ret_children_max, usec_t *ret_exec_delay_usec, - usec_t *ret_event_timeout_usec); + usec_t *ret_event_timeout_usec, + ResolveNameTiming *ret_resolve_name_timing); static inline int udev_parse_config(void) { - return udev_parse_config_full(NULL, NULL, NULL); + return udev_parse_config_full(NULL, NULL, NULL, NULL); } diff --git a/src/udev/udev.conf b/src/udev/udev.conf index 3395a8b7ea..7deb7715be 100644 --- a/src/udev/udev.conf +++ b/src/udev/udev.conf @@ -7,3 +7,4 @@ #children_max= #exec_delay= #event_timeout=180 +#resolve_names=early diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 9b316c80db..922fecb897 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1703,7 +1703,7 @@ int main(int argc, char *argv[]) { int r; log_set_target(LOG_TARGET_AUTO); - udev_parse_config_full(&arg_children_max, &arg_exec_delay_usec, &arg_event_timeout_usec); + udev_parse_config_full(&arg_children_max, &arg_exec_delay_usec, &arg_event_timeout_usec, &arg_resolve_name_timing); log_parse_environment(); log_open(); |