Lines Matching refs:device

342         sd_device *device;  in enumerator_sort_devices()  local
360 HASHMAP_FOREACH_KEY(device, syspath, enumerator->devices_by_syspath) { in enumerator_sort_devices()
364 if (sd_device_get_subsystem(device, &subsys) < 0) in enumerator_sort_devices()
370 devices[n++] = sd_device_ref(device); in enumerator_sort_devices()
381 device = hashmap_get(enumerator->devices_by_syspath, q); in enumerator_sort_devices()
382 if (device) in enumerator_sort_devices()
383 devices[n++] = sd_device_ref(device); in enumerator_sort_devices()
409 HASHMAP_FOREACH(device, enumerator->devices_by_syspath) in enumerator_sort_devices()
410 devices[n++] = sd_device_ref(device); in enumerator_sort_devices()
445 int device_enumerator_add_device(sd_device_enumerator *enumerator, sd_device *device) { in device_enumerator_add_device() argument
450 assert_return(device, -EINVAL); in device_enumerator_add_device()
452 r = sd_device_get_syspath(device, &syspath); in device_enumerator_add_device()
456 r = hashmap_ensure_put(&enumerator->devices_by_syspath, &string_hash_ops, syspath, device); in device_enumerator_add_device()
462 sd_device_ref(device); in device_enumerator_add_device()
468 static bool match_property(sd_device_enumerator *enumerator, sd_device *device) { in match_property() argument
473 assert(device); in match_property()
481 FOREACH_DEVICE_PROPERTY(device, property_dev, value_dev) { in match_property()
499 static bool match_tag(sd_device_enumerator *enumerator, sd_device *device) { in match_tag() argument
503 assert(device); in match_tag()
506 if (!sd_device_has_tag(device, tag)) in match_tag()
519 static int match_initialized(sd_device_enumerator *enumerator, sd_device *device) { in match_initialized() argument
523 assert(device); in match_initialized()
528 r = sd_device_get_is_initialized(device); in match_initialized()
539 if (sd_device_get_devnum(device, NULL) >= 0) in match_initialized()
542 if (sd_device_get_ifindex(device, NULL) >= 0) in match_initialized()
553 sd_device *device, in test_matches() argument
559 assert(device); in test_matches()
563 r = match_initialized(enumerator, device); in test_matches()
568 !device_match_parent(device, enumerator->match_parent, NULL)) in test_matches()
571 if (!match_tag(enumerator, device)) in test_matches()
574 if (!match_property(enumerator, device)) in test_matches()
577 if (!device_match_sysattr(device, enumerator->match_sysattr, enumerator->nomatch_sysattr)) in test_matches()
594 sd_device *device, in enumerator_add_parent_devices() argument
600 assert(device); in enumerator_add_parent_devices()
605 k = sd_device_get_parent(device, &device); in enumerator_add_parent_devices()
613 k = sd_device_get_subsystem(device, &ss); in enumerator_add_parent_devices()
624 k = sd_device_get_sysname(device, &usn); in enumerator_add_parent_devices()
633 k = test_matches(enumerator, device, ignore_parent_match); in enumerator_add_parent_devices()
641 k = device_enumerator_add_device(enumerator, device); in enumerator_add_parent_devices()
653 int device_enumerator_add_parent_devices(sd_device_enumerator *enumerator, sd_device *device) { in device_enumerator_add_parent_devices() argument
654 return enumerator_add_parent_devices(enumerator, device, /* ignore_parent_match = */ true); in device_enumerator_add_parent_devices()
695 _cleanup_(sd_device_unrefp) sd_device *device = NULL; in enumerator_scan_dir_and_add_devices()
706 k = sd_device_new_from_syspath(&device, syspath); in enumerator_scan_dir_and_add_devices()
715 k = test_matches(enumerator, device, /* ignore_parent_match = */ false); in enumerator_scan_dir_and_add_devices()
722 k = device_enumerator_add_device(enumerator, device); in enumerator_scan_dir_and_add_devices()
729 … k = enumerator_add_parent_devices(enumerator, device, /* ignore_parent_match = */ false); in enumerator_scan_dir_and_add_devices()
792 _cleanup_(sd_device_unrefp) sd_device *device = NULL; in enumerator_scan_devices_tag()
799 k = sd_device_new_from_device_id(&device, de->d_name); in enumerator_scan_devices_tag()
808 k = sd_device_get_subsystem(device, &subsystem); in enumerator_scan_devices_tag()
819 k = sd_device_get_sysname(device, &sysname); in enumerator_scan_devices_tag()
828 if (!device_match_parent(device, enumerator->match_parent, NULL)) in enumerator_scan_devices_tag()
831 if (!match_property(enumerator, device)) in enumerator_scan_devices_tag()
834 … if (!device_match_sysattr(device, enumerator->match_sysattr, enumerator->nomatch_sysattr)) in enumerator_scan_devices_tag()
837 k = device_enumerator_add_device(enumerator, device); in enumerator_scan_devices_tag()
865 _cleanup_(sd_device_unrefp) sd_device *device = NULL; in parent_add_child()
869 r = sd_device_new_from_syspath(&device, path); in parent_add_child()
876 r = sd_device_get_subsystem(device, &subsystem); in parent_add_child()
885 r = sd_device_get_sysname(device, &sysname); in parent_add_child()
892 if (!match_property(enumerator, device)) in parent_add_child()
895 if (!device_match_sysattr(device, enumerator->match_sysattr, enumerator->nomatch_sysattr)) in parent_add_child()
898 r = device_enumerator_add_device(enumerator, device); in parent_add_child()