Lines Matching refs:device

230         _cleanup_(sd_device_unrefp) sd_device *device = NULL;  in device_monitor_event_handler()
235 if (device_monitor_receive_device(m, &device) <= 0) in device_monitor_event_handler()
239 return m->callback(m, device, m->userdata); in device_monitor_event_handler()
354 static int check_subsystem_filter(sd_device_monitor *m, sd_device *device) { in check_subsystem_filter() argument
359 assert(device); in check_subsystem_filter()
364 r = sd_device_get_subsystem(device, &subsystem); in check_subsystem_filter()
368 r = sd_device_get_devtype(device, &devtype); in check_subsystem_filter()
383 static bool check_tag_filter(sd_device_monitor *m, sd_device *device) { in check_tag_filter() argument
387 assert(device); in check_tag_filter()
393 if (sd_device_has_tag(device, tag) > 0) in check_tag_filter()
399 static int passes_filter(sd_device_monitor *m, sd_device *device) { in passes_filter() argument
403 assert(device); in passes_filter()
405 r = check_subsystem_filter(m, device); in passes_filter()
409 if (!check_tag_filter(m, device)) in passes_filter()
412 if (!device_match_sysattr(device, m->match_sysattr_filter, m->nomatch_sysattr_filter)) in passes_filter()
415 return device_match_parent(device, m->match_parent_filter, m->nomatch_parent_filter); in passes_filter()
419 _cleanup_(sd_device_unrefp) sd_device *device = NULL; in device_monitor_receive_device()
511 r = device_new_from_nulstr(&device, (uint8_t*) &buf.raw[bufpos], buflen - bufpos); in device_monitor_receive_device()
516 device_set_is_initialized(device); in device_monitor_receive_device()
519 r = passes_filter(m, device); in device_monitor_receive_device()
521 …return log_device_debug_errno(device, r, "sd-device-monitor: Failed to check received device passi… in device_monitor_receive_device()
523 … log_device_debug(device, "sd-device-monitor: Received device does not pass filter, ignoring"); in device_monitor_receive_device()
525 *ret = TAKE_PTR(device); in device_monitor_receive_device()
549 sd_device *device) { in device_monitor_send_device() argument
575 assert(device); in device_monitor_send_device()
577 r = device_get_properties_nulstr(device, (const uint8_t **) &buf, &blen); in device_monitor_send_device()
579 …return log_device_debug_errno(device, r, "sd-device-monitor: Failed to get device properties: %m"); in device_monitor_send_device()
581 log_device_debug_errno(device, SYNTHETIC_ERRNO(EINVAL), in device_monitor_send_device()
585 r = sd_device_get_subsystem(device, &val); in device_monitor_send_device()
587 … return log_device_debug_errno(device, r, "sd-device-monitor: Failed to get device subsystem: %m"); in device_monitor_send_device()
590 if (sd_device_get_devtype(device, &val) >= 0) in device_monitor_send_device()
595 FOREACH_DEVICE_TAG(device, val) in device_monitor_send_device()
619 log_device_debug(device, "sd-device-monitor: Passed to netlink monitor"); in device_monitor_send_device()
622 …return log_device_debug_errno(device, errno, "sd-device-monitor: Failed to send device to netlink … in device_monitor_send_device()
625 log_device_debug(device, "sd-device-monitor: Passed %zi byte to netlink monitor", count); in device_monitor_send_device()
793 _public_ int sd_device_monitor_filter_add_match_parent(sd_device_monitor *m, sd_device *device, int… in sd_device_monitor_filter_add_match_parent() argument
799 assert_return(device, -EINVAL); in sd_device_monitor_filter_add_match_parent()
801 r = sd_device_get_syspath(device, &syspath); in sd_device_monitor_filter_add_match_parent()