Lines Matching refs:event

57         UdevEvent *event;  in udev_event_new()  local
61 event = new(UdevEvent, 1); in udev_event_new()
62 if (!event) in udev_event_new()
65 *event = (UdevEvent) { in udev_event_new()
77 return event; in udev_event_new()
80 UdevEvent *udev_event_free(UdevEvent *event) { in udev_event_free() argument
81 if (!event) in udev_event_free()
84 sd_device_unref(event->dev); in udev_event_free()
85 sd_device_unref(event->dev_db_clone); in udev_event_free()
86 sd_netlink_unref(event->rtnl); in udev_event_free()
87 ordered_hashmap_free_free_key(event->run_list); in udev_event_free()
88 ordered_hashmap_free_free_free(event->seclabel_list); in udev_event_free()
89 free(event->program_result); in udev_event_free()
90 free(event->name); in udev_event_free()
92 return mfree(event); in udev_event_free()
237 UdevEvent *event, in udev_event_subst_format() argument
244 sd_device *parent, *dev = event->dev; in udev_event_subst_format()
272 if (!event->dev_parent) in udev_event_subst_format()
274 r = sd_device_get_sysname(event->dev_parent, &val); in udev_event_subst_format()
280 if (!event->dev_parent) in udev_event_subst_format()
282 r = sd_device_get_driver(event->dev_parent, &val); in udev_event_subst_format()
303 if (!event->program_result) in udev_event_subst_format()
315 strpcpy_full(&s, l, event->program_result, &truncated); in udev_event_subst_format()
320 p = skip_leading_chars(event->program_result, NULL); in udev_event_subst_format()
360 … (void) device_get_sysattr_value_maybe_from_netlink(dev, &event->rtnl, attr, &val); in udev_event_subst_format()
363 if (!val && event->dev_parent && event->dev_parent != dev) in udev_event_subst_format()
364 … (void) device_get_sysattr_value_maybe_from_netlink(event->dev_parent, &event->rtnl, attr, &val); in udev_event_subst_format()
402 if (event->name) in udev_event_subst_format()
403 strpcpy_full(&s, l, event->name, &truncated); in udev_event_subst_format()
459 UdevEvent *event, in udev_event_apply_format() argument
470 assert(event); in udev_event_apply_format()
471 assert(event->dev); in udev_event_apply_format()
484 … log_device_warning_errno(event->dev, r, "Invalid format string, ignoring: %s", src); in udev_event_apply_format()
497 subst_len = udev_event_subst_format(event, type, attr, dest, size, &t); in udev_event_apply_format()
499 log_device_warning_errno(event->dev, subst_len, in udev_event_apply_format()
766 UdevEvent *event, in udev_event_spawn() argument
782 assert(event); in udev_event_spawn()
783 assert(event->dev); in udev_event_spawn()
789 return log_device_error_errno(event->dev, errno, in udev_event_spawn()
794 return log_device_error_errno(event->dev, errno, in udev_event_spawn()
799 return log_device_error_errno(event->dev, r, "Failed to split command: %m"); in udev_event_spawn()
802 return log_device_error_errno(event->dev, SYNTHETIC_ERRNO(EINVAL), in udev_event_spawn()
816 r = device_get_properties_strv(event->dev, &envp); in udev_event_spawn()
818 return log_device_error_errno(event->dev, r, "Failed to get device properties"); in udev_event_spawn()
820 log_device_debug(event->dev, "Starting '%s'", cmd); in udev_event_spawn()
824 return log_device_error_errno(event->dev, r, in udev_event_spawn()
833 DEVICE_TRACE_POINT(spawn_exec, event->dev, cmd); in udev_event_spawn()
844 .device = event->dev, in udev_event_spawn()
851 .event_birth_usec = event->birth_usec, in udev_event_spawn()
859 return log_device_error_errno(event->dev, r, in udev_event_spawn()
871 static int rename_netif(UdevEvent *event) { in rename_netif() argument
877 assert(event); in rename_netif()
879 if (!event->name) in rename_netif()
882 dev = ASSERT_PTR(event->dev); in rename_netif()
886 r = sd_device_get_sysname(event->dev_db_clone, &oldname); in rename_netif()
890 if (streq(event->name, oldname)) in rename_netif()
903 !ifname_valid(event->name)) { in rename_netif()
904 … log_device_warning(dev, "Invalid network interface name, ignoring: %s", event->name); in rename_netif()
908 r = rtnl_get_link_info(&event->rtnl, ifindex, NULL, &flags, NULL, NULL, NULL); in rename_netif()
914 oldname, event->name); in rename_netif()
923 r = device_rename(dev, event->name); in rename_netif()
925 …og_device_warning_errno(dev, r, "Failed to update properties with new name '%s': %m", event->name); in rename_netif()
930 r = device_add_property(event->dev_db_clone, "ID_RENAMING", "1"); in rename_netif()
932 …return log_device_warning_errno(event->dev_db_clone, r, "Failed to add 'ID_RENAMING' property: %m"… in rename_netif()
934 r = device_update_db(event->dev_db_clone); in rename_netif()
936 …return log_device_debug_errno(event->dev_db_clone, r, "Failed to update database under /run/udev/d… in rename_netif()
938 r = rtnl_set_link_name(&event->rtnl, ifindex, event->name); in rename_netif()
941 ifindex, oldname, event->name); in rename_netif()
943 …ice_debug(dev, "Network interface %i is renamed from '%s' to '%s'", ifindex, oldname, event->name); in rename_netif()
948 static int update_devnode(UdevEvent *event) { in update_devnode() argument
949 sd_device *dev = event->dev; in update_devnode()
958 if (!uid_is_valid(event->uid)) { in update_devnode()
959 r = device_get_devnode_uid(dev, &event->uid); in update_devnode()
964 if (!gid_is_valid(event->gid)) { in update_devnode()
965 r = device_get_devnode_gid(dev, &event->gid); in update_devnode()
970 if (event->mode == MODE_INVALID) { in update_devnode()
971 r = device_get_devnode_mode(dev, &event->mode); in update_devnode()
978 …r = udev_node_apply_permissions(dev, apply_mac, event->mode, event->uid, event->gid, event->seclab… in update_devnode()
982 return udev_node_update(dev, event->dev_db_clone); in update_devnode()
986 UdevEvent *event, in event_execute_rules_on_remove() argument
993 sd_device *dev = event->dev; in event_execute_rules_on_remove()
1010 r = udev_rules_apply_to_event(rules, event, timeout_usec, timeout_signal, properties_list); in event_execute_rules_on_remove()
1048 UdevEvent *event, in udev_event_execute_rules() argument
1059 assert(event); in udev_event_execute_rules()
1062 dev = event->dev; in udev_event_execute_rules()
1069 …return event_execute_rules_on_remove(event, inotify_fd, timeout_usec, timeout_signal, properties_l… in udev_event_execute_rules()
1072 (void) udev_watch_end(inotify_fd, event->dev); in udev_event_execute_rules()
1074 r = device_clone_with_db(dev, &event->dev_db_clone); in udev_event_execute_rules()
1078 r = copy_all_tags(dev, event->dev_db_clone); in udev_event_execute_rules()
1083 r = udev_event_on_move(event->dev); in udev_event_execute_rules()
1090 r = udev_rules_apply_to_event(rules, event, timeout_usec, timeout_signal, properties_list); in udev_event_execute_rules()
1096 r = rename_netif(event); in udev_event_execute_rules()
1100 r = update_devnode(event); in udev_event_execute_rules()
1105 r = device_ensure_usec_initialized(dev, event->dev_db_clone); in udev_event_execute_rules()
1110 r = device_tag_index(dev, event->dev_db_clone, true); in udev_event_execute_rules()
1123 void udev_event_execute_run(UdevEvent *event, usec_t timeout_usec, int timeout_signal) { in udev_event_execute_run() argument
1128 ORDERED_HASHMAP_FOREACH_KEY(val, command, event->run_list) { in udev_event_execute_run()
1132 log_device_debug(event->dev, "Running built-in command \"%s\"", command); in udev_event_execute_run()
1133 r = udev_builtin_run(event->dev, &event->rtnl, builtin_cmd, command, false); in udev_event_execute_run()
1135 …log_device_debug_errno(event->dev, r, "Failed to run built-in command \"%s\", ignoring: %m", comma… in udev_event_execute_run()
1137 if (event->exec_delay_usec > 0) { in udev_event_execute_run()
1138 log_device_debug(event->dev, "Delaying execution of \"%s\" for %s.", in udev_event_execute_run()
1139 … command, FORMAT_TIMESPAN(event->exec_delay_usec, USEC_PER_SEC)); in udev_event_execute_run()
1140 (void) usleep(event->exec_delay_usec); in udev_event_execute_run()
1143 log_device_debug(event->dev, "Running command \"%s\"", command); in udev_event_execute_run()
1145 … r = udev_event_spawn(event, timeout_usec, timeout_signal, false, command, NULL, 0, NULL); in udev_event_execute_run()
1147 … log_device_warning_errno(event->dev, r, "Failed to execute '%s', ignoring: %m", command); in udev_event_execute_run()
1149 … log_device_debug(event->dev, "Command \"%s\" returned %d (error), ignoring.", command, r); in udev_event_execute_run()
1154 int udev_event_process_inotify_watch(UdevEvent *event, int inotify_fd) { in udev_event_process_inotify_watch() argument
1157 assert(event); in udev_event_process_inotify_watch()
1160 dev = event->dev; in udev_event_process_inotify_watch()
1167 if (event->inotify_watch) in udev_event_process_inotify_watch()