]>
Commit | Line | Data |
---|---|---|
e7145211 | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
0ef6f454 LP |
2 | #pragma once |
3 | ||
f0083e3d | 4 | /* |
810adae9 | 5 | * Copyright © 2003 Greg Kroah-Hartman <greg@kroah.com> |
f0083e3d GKH |
6 | */ |
7 | ||
c076a2bd | 8 | #include <sys/param.h> |
27d13af7 | 9 | #include <sys/sysmacros.h> |
07630cea | 10 | #include <sys/types.h> |
1aa1e248 | 11 | |
48a9b173 | 12 | #include "libudev.h" |
70068602 | 13 | #include "sd-device.h" |
07630cea LP |
14 | #include "sd-netlink.h" |
15 | ||
d838e145 | 16 | #include "hashmap.h" |
e9a5ef7c | 17 | #include "label.h" |
07630cea LP |
18 | #include "libudev-private.h" |
19 | #include "macro.h" | |
775f8b3c | 20 | #include "strv.h" |
07630cea | 21 | #include "util.h" |
f0083e3d | 22 | |
aa8734ff | 23 | struct udev_event { |
912541b0 KS |
24 | struct udev_device *dev; |
25 | struct udev_device *dev_parent; | |
26 | struct udev_device *dev_db; | |
27 | char *name; | |
28 | char *program_result; | |
29 | mode_t mode; | |
30 | uid_t uid; | |
31 | gid_t gid; | |
d838e145 | 32 | Hashmap *seclabel_list; |
29448498 | 33 | Hashmap *run_list; |
912541b0 | 34 | int exec_delay; |
40fe8b11 | 35 | usec_t birth_usec; |
1c4baffc | 36 | sd_netlink *rtnl; |
14cb109d YW |
37 | unsigned builtin_run; |
38 | unsigned builtin_ret; | |
912541b0 KS |
39 | bool inotify_watch; |
40 | bool inotify_watch_final; | |
1edefa4f | 41 | bool group_set; |
912541b0 | 42 | bool group_final; |
1edefa4f | 43 | bool owner_set; |
912541b0 KS |
44 | bool owner_final; |
45 | bool mode_set; | |
46 | bool mode_final; | |
47 | bool name_final; | |
48 | bool devlink_final; | |
49 | bool run_final; | |
aa8734ff | 50 | }; |
aa8734ff | 51 | |
c7521974 | 52 | /* udev-rules.c */ |
f1128767 | 53 | struct udev_rules; |
2024ed61 | 54 | struct udev_rules *udev_rules_new(int resolve_names); |
7c85d636 | 55 | struct udev_rules *udev_rules_unref(struct udev_rules *rules); |
6ada823a | 56 | bool udev_rules_check_timestamp(struct udev_rules *rules); |
d838e145 YW |
57 | int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, |
58 | usec_t timeout_usec, usec_t timeout_warn_usec, | |
9b5150b6 | 59 | Hashmap *properties_list); |
84b6ad70 | 60 | int udev_rules_apply_static_dev_perms(struct udev_rules *rules); |
f1128767 KS |
61 | |
62 | /* udev-event.c */ | |
37ed4f56 | 63 | struct udev_event *udev_event_new(struct udev_device *dev); |
c1118ceb | 64 | struct udev_event *udev_event_free(struct udev_event *event); |
e20a9171 DS |
65 | size_t udev_event_apply_format(struct udev_event *event, |
66 | const char *src, char *dest, size_t size, | |
67 | bool replace_whitespace); | |
37ed4f56 | 68 | int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, |
912541b0 | 69 | char *result, size_t maxsize, int read_value); |
2181d30a | 70 | int udev_event_spawn(struct udev_event *event, |
dd5eddd2 | 71 | usec_t timeout_usec, |
67117413 | 72 | usec_t timeout_warn_usec, |
53318514 | 73 | bool accept_failure, |
bbf35206 | 74 | const char *cmd, char *result, size_t ressize); |
eb1f9e30 YW |
75 | int udev_event_execute_rules(struct udev_event *event, |
76 | usec_t timeout_usec, usec_t timeout_warn_usec, | |
77 | Hashmap *properties_list, | |
78 | struct udev_rules *rules); | |
8314de1d | 79 | void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec); |
c7521974 | 80 | |
152d0efa | 81 | /* Cleanup functions */ |
c1118ceb | 82 | DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_event*, udev_event_free); |
152d0efa | 83 | DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_rules*, udev_rules_unref); |