Home
last modified time | relevance | path

Searched refs:device (Results 1 – 25 of 266) sorted by relevance

1234567891011

/systemd-251/src/libsystemd/sd-device/
Ddevice-private.c31 int device_add_property(sd_device *device, const char *key, const char *value) { in device_add_property() argument
34 assert(device); in device_add_property()
37 r = device_add_property_aux(device, key, value, false); in device_add_property()
42 r = device_add_property_aux(device, key, value, true); in device_add_property()
50 int device_add_propertyf(sd_device *device, const char *key, const char *format, ...) { in device_add_propertyf() argument
55 assert(device); in device_add_propertyf()
59 return device_add_property(device, key, NULL); in device_add_propertyf()
68 return device_add_property(device, key, value); in device_add_propertyf()
71 void device_set_devlink_priority(sd_device *device, int priority) { in device_set_devlink_priority() argument
72 assert(device); in device_set_devlink_priority()
[all …]
Dsd-device.c39 sd_device *device; in device_new_aux() local
43 device = new(sd_device, 1); in device_new_aux()
44 if (!device) in device_new_aux()
47 *device = (sd_device) { in device_new_aux()
56 *ret = device; in device_new_aux()
60 static sd_device *device_free(sd_device *device) { in device_free() argument
61 assert(device); in device_free()
63 sd_device_unref(device->parent); in device_free()
64 free(device->syspath); in device_free()
65 free(device->sysname); in device_free()
[all …]
Ddevice-util.h13 #define FOREACH_DEVICE_PROPERTY(device, key, value) \ argument
14 for (key = sd_device_get_property_first(device, &(value)); \
16 key = sd_device_get_property_next(device, &(value)))
18 #define FOREACH_DEVICE_TAG(device, tag) \ argument
19 for (tag = sd_device_get_tag_first(device); \
21 tag = sd_device_get_tag_next(device))
23 #define FOREACH_DEVICE_CURRENT_TAG(device, tag) \ argument
24 for (tag = sd_device_get_current_tag_first(device); \
26 tag = sd_device_get_current_tag_next(device))
28 #define FOREACH_DEVICE_SYSATTR(device, attr) \ argument
[all …]
Ddevice-private.h20 int device_get_property_bool(sd_device *device, const char *key);
21 int device_get_device_id(sd_device *device, const char **ret);
22 int device_get_devlink_priority(sd_device *device, int *ret);
23 int device_get_watch_handle(sd_device *device);
24 int device_get_devnode_mode(sd_device *device, mode_t *ret);
25 int device_get_devnode_uid(sd_device *device, uid_t *ret);
26 int device_get_devnode_gid(sd_device *device, gid_t *ret);
28 int device_cache_sysattr_value(sd_device *device, const char *key, char *value);
29 int device_get_cached_sysattr_value(sd_device *device, const char *key, const char **ret_value);
31 void device_seal(sd_device *device);
[all …]
Dtest-sd-device-monitor.c54 static void test_send_receive_one(sd_device *device, bool subsystem_filter, bool tag_filter, bool u… in test_send_receive_one() argument
58 … log_device_info(device, "/* %s(subsystem_filter=%s, tag_filter=%s, use_bpf=%s) */", __func__, in test_send_receive_one()
61 assert_se(sd_device_get_syspath(device, &syspath) >= 0); in test_send_receive_one()
73 assert_se(sd_device_get_subsystem(device, &subsystem) >= 0); in test_send_receive_one()
74 (void) sd_device_get_devtype(device, &devtype); in test_send_receive_one()
79 FOREACH_DEVICE_TAG(device, tag) in test_send_receive_one()
85 assert_se(device_monitor_send_device(monitor_server, monitor_client, device) >= 0); in test_send_receive_one()
89 static void test_subsystem_filter(sd_device *device) { in test_subsystem_filter() argument
95 log_device_info(device, "/* %s */", __func__); in test_subsystem_filter()
97 assert_se(sd_device_get_syspath(device, &syspath) >= 0); in test_subsystem_filter()
[all …]
Ddevice-enumerator.c342 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
[all …]
Ddevice-internal.h100 int device_add_property_aux(sd_device *device, const char *key, const char *value, bool db);
101 static inline int device_add_property_internal(sd_device *device, const char *key, const char *valu… in device_add_property_internal() argument
102 return device_add_property_aux(device, key, value, false); in device_add_property_internal()
105 int device_set_syspath(sd_device *device, const char *_syspath, bool verify);
106 int device_set_ifindex(sd_device *device, const char *ifindex);
107 int device_set_devmode(sd_device *device, const char *devmode);
108 int device_set_devname(sd_device *device, const char *devname);
109 int device_set_devtype(sd_device *device, const char *devtype);
110 int device_set_devnum(sd_device *device, const char *major, const char *minor);
111 int device_set_subsystem(sd_device *device, const char *subsystem);
[all …]
Ddevice-monitor.c230 _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()
[all …]
Ddevice-util.c8 static bool device_match_sysattr_value(sd_device *device, const char *sysattr, const char *match_va… in device_match_sysattr_value() argument
11 assert(device); in device_match_sysattr_value()
14 if (sd_device_get_sysattr_value(device, sysattr, &value) < 0) in device_match_sysattr_value()
26 bool device_match_sysattr(sd_device *device, Hashmap *match_sysattr, Hashmap *nomatch_sysattr) { in device_match_sysattr() argument
30 assert(device); in device_match_sysattr()
33 if (!device_match_sysattr_value(device, sysattr, value)) in device_match_sysattr()
37 if (device_match_sysattr_value(device, sysattr, value)) in device_match_sysattr()
43 bool device_match_parent(sd_device *device, Set *match_parent, Set *nomatch_parent) { in device_match_parent() argument
46 assert(device); in device_match_parent()
48 if (sd_device_get_syspath(device, &syspath) < 0) in device_match_parent()
/systemd-251/src/backlight/
Dbacklight.c47 static int find_pci_or_platform_parent(sd_device *device, sd_device **ret) { in find_pci_or_platform_parent() argument
52 assert(device); in find_pci_or_platform_parent()
55 r = sd_device_get_parent(device, &parent); in find_pci_or_platform_parent()
131 static int validate_device(sd_device *device) { in validate_device() argument
137 assert(device); in validate_device()
148 r = sd_device_get_subsystem(device, &subsystem); in validate_device()
154 r = sd_device_get_sysattr_value(device, "type", &v); in validate_device()
160 r = find_pci_or_platform_parent(device, &parent); in validate_device()
184 if (same_device(device, other) > 0) in validate_device()
201 (void) sd_device_get_sysname(device, &device_sysname); in validate_device()
[all …]
/systemd-251/src/systemd/
Dsd-device.h53 typedef int (*sd_device_monitor_handler_t)(sd_device_monitor *m, sd_device *device, void *userdata);
57 sd_device *sd_device_ref(sd_device *device);
58 sd_device *sd_device_unref(sd_device *device);
73 int sd_device_get_syspath(sd_device *device, const char **ret);
74 int sd_device_get_subsystem(sd_device *device, const char **ret);
75 int sd_device_get_devtype(sd_device *device, const char **ret);
76 int sd_device_get_devnum(sd_device *device, dev_t *devnum);
77 int sd_device_get_ifindex(sd_device *device, int *ifindex);
78 int sd_device_get_driver(sd_device *device, const char **ret);
79 int sd_device_get_devpath(sd_device *device, const char **ret);
[all …]
/systemd-251/src/libudev/
Dlibudev-device.c49 sd_device *device; member
85 if (sd_device_get_seqnum(udev_device->device, &seqnum) < 0) in udev_device_get_seqnum()
105 r = sd_device_get_devnum(udev_device->device, &devnum); in udev_device_get_devnum()
128 r = sd_device_get_driver(udev_device->device, &driver); in udev_device_get_driver()
149 r = sd_device_get_devtype(udev_device->device, &devtype); in udev_device_get_devtype()
173 r = sd_device_get_subsystem(udev_device->device, &subsystem); in udev_device_get_subsystem()
195 r = sd_device_get_property_value(udev_device->device, key, &value); in udev_device_get_property_value()
202 struct udev_device *udev_device_new(struct udev *udev, sd_device *device) { in udev_device_new() argument
206 assert(device); in udev_device_new()
231 .device = sd_device_ref(device), in udev_device_new()
[all …]
Dtest-libudev.c21 static void print_device(struct udev_device *device) { in print_device() argument
27 log_info("*** device: %p ***", device); in print_device()
28 str = udev_device_get_action(device); in print_device()
32 str = udev_device_get_syspath(device); in print_device()
35 str = udev_device_get_sysname(device); in print_device()
38 str = udev_device_get_sysnum(device); in print_device()
42 str = udev_device_get_devpath(device); in print_device()
45 str = udev_device_get_subsystem(device); in print_device()
49 str = udev_device_get_devtype(device); in print_device()
53 str = udev_device_get_driver(device); in print_device()
[all …]
/systemd-251/src/udev/
Dudev-netlink.c123 static int cache_unsigned(sd_device *device, const char *attr, uint64_t val) { in cache_unsigned() argument
127 assert(device); in cache_unsigned()
130 if (device_get_cached_sysattr_value(device, attr, NULL) != -ESTALE) in cache_unsigned()
136 r = device_cache_sysattr_value(device, attr, str); in cache_unsigned()
144 static int cache_hw_addr(sd_device *device, const char *attr, const struct hw_addr_data *hw_addr) { in cache_hw_addr() argument
148 assert(device); in cache_hw_addr()
152 if (device_get_cached_sysattr_value(device, attr, NULL) != -ESTALE) in cache_hw_addr()
159 r = device_cache_sysattr_value(device, attr, hw_addr_to_string(hw_addr, str)); in cache_hw_addr()
167 static int cache_binary(sd_device *device, const char *attr, size_t len, const uint8_t *data) { in cache_binary() argument
171 assert(device); in cache_binary()
[all …]
Dudevadm-info.c86 static int print_all_attributes(sd_device *device, bool is_parent) { in print_all_attributes() argument
92 assert(device); in print_all_attributes()
95 (void) sd_device_get_devpath(device, &value); in print_all_attributes()
99 (void) sd_device_get_sysname(device, &value); in print_all_attributes()
103 (void) sd_device_get_subsystem(device, &value); in print_all_attributes()
107 (void) sd_device_get_driver(device, &value); in print_all_attributes()
110 FOREACH_DEVICE_SYSATTR(device, name) { in print_all_attributes()
116 r = sd_device_get_sysattr_value(device, name, &value); in print_all_attributes()
154 static int print_device_chain(sd_device *device) { in print_device_chain() argument
158 assert(device); in print_device_chain()
[all …]
/systemd-251/src/shared/
Dudev-util.c152 sd_device *device; member
158 sd_device_unref(d->device); in device_monitor_data_free()
161 static int device_monitor_handler(sd_device_monitor *monitor, sd_device *device, void *userdata) { in device_monitor_handler() argument
165 assert(device); in device_monitor_handler()
168 assert(!data->device); in device_monitor_handler()
183 if (device_for_action(device, SD_DEVICE_REMOVE)) in device_monitor_handler()
186 …if (data->sysname && sd_device_get_sysname(device, &sysname) >= 0 && streq(sysname, data->sysname)) in device_monitor_handler()
192 FOREACH_DEVICE_DEVLINK(device, devlink) in device_monitor_handler()
196 … if (sd_device_get_devname(device, &devlink) >= 0 && path_equal(devlink, data->devlink)) in device_monitor_handler()
203 data->device = sd_device_ref(device); in device_monitor_handler()
[all …]
Dnetif-util.c29 int net_get_type_string(sd_device *device, uint16_t iftype, char **ret) { in net_get_type_string() argument
33 if (device && in net_get_type_string()
34 sd_device_get_devtype(device, &t) >= 0 && in net_get_type_string()
56 const char *net_get_persistent_name(sd_device *device) { in net_get_persistent_name() argument
57 assert(device); in net_get_persistent_name()
63 if (sd_device_get_property_value(device, field, &name) >= 0) in net_get_persistent_name()
73 int net_get_unique_predictable_data(sd_device *device, bool use_sysname, uint64_t *ret) { in net_get_unique_predictable_data() argument
76 assert(device); in net_get_unique_predictable_data()
81 name = net_get_persistent_name(device); in net_get_unique_predictable_data()
83 (void) sd_device_get_sysname(device, &name); in net_get_unique_predictable_data()
[all …]
Dsleep-config.c191 free(se->device); in swap_entry_free()
211 assert(swap->device); in swap_device_to_device_id()
214 r = stat(swap->device, &sb); in swap_device_to_device_id()
226 return get_block_device(swap->device, ret_dev); in swap_device_to_device_id()
240 assert(swap->device); in calculate_swap_file_offset()
243 fd = open(swap->device, O_RDONLY|O_CLOEXEC|O_NOCTTY); in calculate_swap_file_offset()
245 …og_debug_errno(errno, "Failed to open swap file %s to determine on-disk offset: %m", swap->device); in calculate_swap_file_offset()
248 return log_debug_errno(errno, "Failed to stat %s: %m", swap->device); in calculate_swap_file_offset()
252 … return log_debug_errno(r, "Error checking %s for Btrfs filesystem: %m", swap->device); in calculate_swap_file_offset()
254 … log_debug("%s: detection of swap file offset on Btrfs is not supported", swap->device); in calculate_swap_file_offset()
[all …]
/systemd-251/test/units/
Dtestsuite-15.sh211 After=bar-template-after.device
216 After=yup-template-after.device
233 ln -s ../bar-template-requires.device /etc/systemd/system/bar@.service.requires/
234 ln -s ../bar-0-requires.device /etc/systemd/system/bar@0.service.requires/
235 ln -s ../bar-1-requires.device /etc/systemd/system/bar@1.service.requires/
236 ln -s ../bar-2-requires.device /etc/systemd/system/bar@2.service.requires/
237 ln -s ../bar-3-requires.device /etc/systemd/system/bar@3.service.requires/
239 ln -s ../yup-template-requires.device /etc/systemd/system/yup@.service.requires/
240 ln -s ../yup-0-requires.device /etc/systemd/system/yup@0.service.requires/
241 ln -s ../yup-1-requires.device /etc/systemd/system/yup@1.service.requires/
[all …]
Dtestsuite-70.sh15 env PASSWORD=passphrase systemd-cryptenroll --tpm2-device=auto $img
16 /usr/lib/systemd/systemd-cryptsetup attach test-volume $img - tpm2-device=auto,headless=1
21 /usr/lib/systemd/systemd-cryptsetup attach test-volume $img - tpm2-device=auto,headless=1 && { echo…
25 env PASSWORD=passphrase NEWPIN=123456 systemd-cryptenroll --tpm2-device=auto --tpm2-with-pin=true $…
26 env PIN=123456 /usr/lib/systemd/systemd-cryptsetup attach test-volume $img - tpm2-device=auto,headl…
30 env PIN=123457 /usr/lib/systemd/systemd-cryptsetup attach test-volume $img - tpm2-device=auto,headl…
34 env PIN=123456 /usr/lib/systemd/systemd-cryptsetup attach test-volume $img - tpm2-device=auto,headl…
38 env PASSWORD=passphrase systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+7 $img
39 /usr/lib/systemd/systemd-cryptsetup attach test-volume $img - tpm2-device=auto,headless=1
44 /usr/lib/systemd/systemd-cryptsetup attach test-volume $img - tpm2-device=auto,headless=1 && exit 1
/systemd-251/src/partition/
Dmakefs.c21 _cleanup_free_ char *device = NULL, *fstype = NULL, *detected = NULL; in run() local
38 device = strdup(argv[2]); in run()
39 if (!device) in run()
42 if (stat(device, &st) < 0) in run()
43 return log_error_errno(errno, "Failed to stat \"%s\": %m", device); in run()
50 … return log_error_errno(lock_fd, "Failed to lock whole block device of \"%s\": %m", device); in run()
52 log_debug("%s is not a block device, no need to lock.", device); in run()
54 r = probe_filesystem(device, &detected); in run()
56 …r_errno(r, "Ambiguous results of probing for file system on \"%s\", refusing to proceed.", device); in run()
58 return log_error_errno(r, "Failed to probe \"%s\": %m", device); in run()
[all …]
/systemd-251/docs/
DBLOCK_DEVICE_LOCKING.md12 device nodes to synchronize access for partitioning and file system formatting
21 Applications manipulating a block device can temporarily stop `systemd-udevd`
22 from processing rules on it — and thus bar it from probing the device — by
23 taking a BSD file lock on the block device node. Specifically, whenever
24 `systemd-udevd` starts processing a block device it takes a `LOCK_SH|LOCK_NB`
26 the main block device (i.e. never on any partition block device, but on the
27 device the partition belongs to). If this lock cannot be taken (i.e. `flock()`
28 returns `EAGAIN`), it refrains from processing the device. If it manages to take
29 the lock it is kept for the entire time the device is processed.
31 Note that `systemd-udevd` also watches all block device nodes it manages for
[all …]
/systemd-251/src/libsystemd/
Dmeson.build124 'sd-device/device-enumerator-private.h',
125 'sd-device/device-enumerator.c',
126 'sd-device/device-internal.h',
127 'sd-device/device-monitor-private.h',
128 'sd-device/device-monitor.c',
129 'sd-device/device-private.c',
130 'sd-device/device-private.h',
131 'sd-device/device-util.c',
132 'sd-device/device-util.h',
133 'sd-device/sd-device.c',
[all …]
/systemd-251/src/sysupdate/
Dsysupdate-partition.c19 p->device = mfree(p->device); in partition_info_destroy()
109 _cleanup_free_ char *label_copy = NULL, *device = NULL; in read_partition_info() local
174 r = fdisk_partition_to_string(p, c, FDISK_FIELD_DEVICE, &device); in read_partition_info()
190 .device = TAKE_PTR(device), in read_partition_info()
200 const char *device, in find_suitable_partition() argument
211 assert(device); in find_suitable_partition()
218 r = fdisk_assign_device(c, device, /* readonly= */ true); in find_suitable_partition()
220 return log_error_errno(r, "Failed to open device '%s': %m", device); in find_suitable_partition()
223 …og_error_errno(SYNTHETIC_ERRNO(EHWPOISON), "Disk %s has no GPT disk label, not suitable.", device); in find_suitable_partition()
266 const char *device, in patch_partition() argument
[all …]
/systemd-251/src/udev/net/
Dlink-config.c310 static int device_unsigned_attribute(sd_device *device, const char *attr, unsigned *type) { in device_unsigned_attribute() argument
314 r = sd_device_get_sysattr_value(device, attr, &s); in device_unsigned_attribute()
316 return log_device_debug_errno(device, r, "Failed to query %s: %m", attr); in device_unsigned_attribute()
320 … return log_device_warning_errno(device, r, "Failed to parse %s \"%s\": %m", attr, s); in device_unsigned_attribute()
322 log_device_debug(device, "Device has %s=%u", attr, *type); in device_unsigned_attribute()
363 sd_device_unref(link->device); in link_free()
369 int link_new(LinkConfigContext *ctx, sd_netlink **rtnl, sd_device *device, Link **ret) { in link_new() argument
375 assert(device); in link_new()
383 .device = sd_device_ref(device), in link_new()
386 r = sd_device_get_sysname(device, &link->ifname); in link_new()
[all …]

1234567891011