diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-11-13 10:37:05 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-11-13 14:00:32 +0100 |
commit | 66f737b415e61f150c49480a74344877a63ac016 (patch) | |
tree | 00d874cf87db399e74d4d6f9b4f2252621454904 /src/udev/udev.h | |
parent | 705727fd7687e16737b79f2f66410c2e1d502e37 (diff) | |
download | systemd-66f737b415e61f150c49480a74344877a63ac016.tar.gz |
udev: do not pass timeout_warn_usec around, calculate it on demand
It was always set to one third of timeout_usec, so let's simplify things by
calculating it using a helper function right before it is used.
Before 9d9264ba39f797d20100c8acfda3df895ab5aaa2, udevd.c would avoid setting
timeout_warn_usec to 0, using 1 instead. This wasn't necessary, because when
timeout_warn_usec is finally used in spawn_wait(), it is ignored if
timeout_usec is 0 or timeout_warn_usec is 0. So there was no need to handle
this case specially.
Diffstat (limited to 'src/udev/udev.h')
-rw-r--r-- | src/udev/udev.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/udev/udev.h b/src/udev/udev.h index 5c6ca6bf9f..f61d90e71a 100644 --- a/src/udev/udev.h +++ b/src/udev/udev.h @@ -62,13 +62,17 @@ struct udev_rules *udev_rules_new(ResolveNameTiming resolve_name_timing); struct udev_rules *udev_rules_unref(struct udev_rules *rules); bool udev_rules_check_timestamp(struct udev_rules *rules); int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, - usec_t timeout_usec, usec_t timeout_warn_usec, + usec_t timeout_usec, Hashmap *properties_list); int udev_rules_apply_static_dev_perms(struct udev_rules *rules); ResolveNameTiming resolve_name_timing_from_string(const char *s) _pure_; const char *resolve_name_timing_to_string(ResolveNameTiming i) _const_; +static inline usec_t udev_warn_timeout(usec_t timeout_usec) { + return DIV_ROUND_UP(timeout_usec, 3); +} + /* udev-event.c */ struct udev_event *udev_event_new(sd_device *dev, usec_t exec_delay_usec, sd_netlink *rtnl); struct udev_event *udev_event_free(struct udev_event *event); @@ -77,14 +81,13 @@ ssize_t udev_event_apply_format(struct udev_event *event, bool replace_whitespace); int udev_event_spawn(struct udev_event *event, usec_t timeout_usec, - usec_t timeout_warn_usec, bool accept_failure, const char *cmd, char *result, size_t ressize); int udev_event_execute_rules(struct udev_event *event, - usec_t timeout_usec, usec_t timeout_warn_usec, + usec_t timeout_usec, Hashmap *properties_list, struct udev_rules *rules); -void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec); +void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec); /* Cleanup functions */ DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_event*, udev_event_free); |