]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/udev/udev-event.h
udev: modernize udev-rules.c
[thirdparty/systemd.git] / src / udev / udev-event.h
similarity index 66%
rename from src/udev/udev.h
rename to src/udev/udev-event.h
index 2fb49dc974cd1ca67454a7333d51d6f1f23ffac3..9f5e104bd4283b654f124941271638b6e54a7719 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "hashmap.h"
 #include "macro.h"
+#include "udev-rules.h"
 #include "udev-util.h"
 #include "util.h"
 
@@ -32,38 +33,21 @@ typedef struct UdevEvent {
         sd_netlink *rtnl;
         unsigned builtin_run;
         unsigned builtin_ret;
-        bool inotify_watch;
-        bool inotify_watch_final;
-        bool group_set;
-        bool group_final;
-        bool owner_set;
-        bool owner_final;
-        bool mode_set;
-        bool mode_final;
-        bool name_final;
-        bool devlink_final;
-        bool run_final;
+        UdevRuleEscapeType esc:8;
+        bool inotify_watch:1;
+        bool inotify_watch_final:1;
+        bool group_final:1;
+        bool owner_final:1;
+        bool mode_final:1;
+        bool name_final:1;
+        bool devlink_final:1;
+        bool run_final:1;
 } UdevEvent;
 
-/* udev-rules.c */
-typedef struct UdevRules UdevRules;
-
-int udev_rules_new(UdevRules **ret_rules, ResolveNameTiming resolve_name_timing);
-UdevRules *udev_rules_free(UdevRules *rules);
-
-bool udev_rules_check_timestamp(UdevRules *rules);
-int udev_rules_apply_to_event(UdevRules *rules, UdevEvent *event,
-                              usec_t timeout_usec,
-                              Hashmap *properties_list);
-int udev_rules_apply_static_dev_perms(UdevRules *rules);
-
-static inline usec_t udev_warn_timeout(usec_t timeout_usec) {
-        return DIV_ROUND_UP(timeout_usec, 3);
-}
-
-/* udev-event.c */
 UdevEvent *udev_event_new(sd_device *dev, usec_t exec_delay_usec, sd_netlink *rtnl);
 UdevEvent *udev_event_free(UdevEvent *event);
+DEFINE_TRIVIAL_CLEANUP_FUNC(UdevEvent*, udev_event_free);
+
 ssize_t udev_event_apply_format(UdevEvent *event,
                                 const char *src, char *dest, size_t size,
                                 bool replace_whitespace);
@@ -77,6 +61,6 @@ int udev_event_execute_rules(UdevEvent *event,
                              UdevRules *rules);
 void udev_event_execute_run(UdevEvent *event, usec_t timeout_usec);
 
-/* Cleanup functions */
-DEFINE_TRIVIAL_CLEANUP_FUNC(UdevEvent*, udev_event_free);
-DEFINE_TRIVIAL_CLEANUP_FUNC(UdevRules*, udev_rules_free);
+static inline usec_t udev_warn_timeout(usec_t timeout_usec) {
+        return DIV_ROUND_UP(timeout_usec, 3);
+}