/src/systemd/src/udev/udev-event.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* SPDX-License-Identifier: GPL-2.0+ */ |
2 | | #pragma once |
3 | | |
4 | | /* |
5 | | * Copyright © 2003 Greg Kroah-Hartman <greg@kroah.com> |
6 | | */ |
7 | | |
8 | | #include "sd-device.h" |
9 | | #include "sd-netlink.h" |
10 | | |
11 | | #include "hashmap.h" |
12 | | #include "macro.h" |
13 | | #include "udev-rules.h" |
14 | | #include "udev-util.h" |
15 | | #include "util.h" |
16 | | |
17 | 0 | #define READ_END 0 |
18 | 0 | #define WRITE_END 1 |
19 | | |
20 | | typedef struct UdevEvent { |
21 | | sd_device *dev; |
22 | | sd_device *dev_parent; |
23 | | sd_device *dev_db_clone; |
24 | | char *name; |
25 | | char *program_result; |
26 | | mode_t mode; |
27 | | uid_t uid; |
28 | | gid_t gid; |
29 | | OrderedHashmap *seclabel_list; |
30 | | OrderedHashmap *run_list; |
31 | | usec_t exec_delay_usec; |
32 | | usec_t birth_usec; |
33 | | sd_netlink *rtnl; |
34 | | unsigned builtin_run; |
35 | | unsigned builtin_ret; |
36 | | UdevRuleEscapeType esc:8; |
37 | | bool inotify_watch:1; |
38 | | bool inotify_watch_final:1; |
39 | | bool group_final:1; |
40 | | bool owner_final:1; |
41 | | bool mode_final:1; |
42 | | bool name_final:1; |
43 | | bool devlink_final:1; |
44 | | bool run_final:1; |
45 | | } UdevEvent; |
46 | | |
47 | | UdevEvent *udev_event_new(sd_device *dev, usec_t exec_delay_usec, sd_netlink *rtnl); |
48 | | UdevEvent *udev_event_free(UdevEvent *event); |
49 | | DEFINE_TRIVIAL_CLEANUP_FUNC(UdevEvent*, udev_event_free); |
50 | | |
51 | | ssize_t udev_event_apply_format(UdevEvent *event, |
52 | | const char *src, char *dest, size_t size, |
53 | | bool replace_whitespace); |
54 | | int udev_check_format(const char *s); |
55 | | int udev_event_spawn(UdevEvent *event, |
56 | | usec_t timeout_usec, |
57 | | bool accept_failure, |
58 | | const char *cmd, char *result, size_t ressize); |
59 | | int udev_event_execute_rules(UdevEvent *event, |
60 | | usec_t timeout_usec, |
61 | | Hashmap *properties_list, |
62 | | UdevRules *rules); |
63 | | void udev_event_execute_run(UdevEvent *event, usec_t timeout_usec); |
64 | | |
65 | 0 | static inline usec_t udev_warn_timeout(usec_t timeout_usec) { |
66 | 0 | return DIV_ROUND_UP(timeout_usec, 3); |
67 | 0 | } Unexecuted instantiation: udev-rules.c:udev_warn_timeout Unexecuted instantiation: udev-event.c:udev_warn_timeout |