1UDEV_DEVICE_HAS_TAG(3) udev_device_has_tag UDEV_DEVICE_HAS_TAG(3)
2
3
4
6 udev_device_has_tag, udev_device_has_current_tag,
7 udev_device_get_devlinks_list_entry,
8 udev_device_get_properties_list_entry, udev_device_get_tags_list_entry,
9 udev_device_get_current_tags_list_entry,
10 udev_device_get_sysattr_list_entry, udev_device_get_property_value,
11 udev_device_get_sysattr_value, udev_device_set_sysattr_value - Retrieve
12 or set device attributes
13
15 #include <libudev.h>
16
17 int udev_device_has_tag(struct udev_device *udev_device,
18 const char *tag);
19
20 int udev_device_has_current_tag(struct udev_device *udev_device,
21 const char *tag);
22
23 struct udev_list_entry
24 *udev_device_get_devlinks_list_entry(struct udev_device *udev_device);
25
26 struct udev_list_entry
27 *udev_device_get_properties_list_entry(struct udev_device *udev_device);
28
29 struct udev_list_entry
30 *udev_device_get_tags_list_entry(struct udev_device *udev_device);
31
32 struct udev_list_entry
33 *udev_device_get_current_tags_list_entry(struct udev_device *udev_device);
34
35 struct udev_list_entry
36 *udev_device_get_sysattr_list_entry(struct udev_device *udev_device);
37
38 const char
39 *udev_device_get_property_value(struct udev_device *udev_device,
40 const char *key);
41
42 const char
43 *udev_device_get_sysattr_value(struct udev_device *udev_device,
44 const char *sysattr);
45
46 int udev_device_set_sysattr_value(struct udev_device *udev_device,
47 const char *sysattr,
48 const char *value);
49
51 udev_device_has_tag() returns a valuer larger than zero if the
52 specified device object has the indicated tag assigned to it, and zero
53 otherwise. See udev(7) for details on the tags concept.
54 udev_device_has_current_tag() executes a similar check, however only
55 determines whether the indicated tag was set as result of the most
56 recent event seen for the device. Tags are "sticky", i.e. once set for
57 a device they remain on the device until the device is unplugged, even
58 if the rules run for later events of the same device do not set them
59 anymore. Any tag for which udev_device_has_current_tag() returns true
60 will hence also return true when passed to udev_device_has_tag(), but
61 the opposite might not be true, in case a tag is no longer configured
62 by the rules applied to the most recent device even.
63
64 udev_device_get_tags_list_entry() returns a udev_list_entry object,
65 encapsulating a list of tags set for the specified device. Similar,
66 udev_device_get_current_tags_list_entry() returns a list of tags set
67 for the specified device as effect of the most recent device event seen
68 (see above for details on the difference).
69
71 On success, udev_device_has_tag() and udev_device_has_current_tag()
72 return positive or 0, depending on whether the device has the given tag
73 or not. On failure, a negative error code is returned.
74
75 On success, udev_device_get_devlinks_list_entry(),
76 udev_device_get_properties_list_entry(),
77 udev_device_get_tags_list_entry(),
78 udev_device_get_current_tags_list_entry() and
79 udev_device_get_sysattr_list_entry() return a pointer to the first
80 entry of the retrieved list. If that list is empty, or if an error
81 occurred, NULL is returned.
82
83 On success, udev_device_get_property_value() and
84 udev_device_get_sysattr_value() return a pointer to a constant string
85 of the requested value. On error, NULL is returned. Attributes that may
86 contain NUL bytes should not be retrieved with
87 udev_device_get_sysattr_value(); instead, read them directly from the
88 files within the device's syspath.
89
90 On success, udev_device_set_sysattr_value() returns an integer greater
91 than, or equal to, 0. On failure, a negative error code is returned.
92 Values that contain NUL bytes should not be set with this function;
93 instead, write them directly to the files within the device's syspath.
94
96 udev(7), udev_new(3), udev_device_new_from_syspath(3),
97 udev_device_get_syspath(3), udev_enumerate_new(3),
98 udev_monitor_new_from_netlink(3), udev_list_entry(3), systemd(1),
99
100
101
102systemd 248 UDEV_DEVICE_HAS_TAG(3)