'\" t .TH "UDEV_DEVICE_HAS_TAG" "3" "" "systemd 256.7" "udev_device_has_tag" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" udev_device_has_tag, udev_device_has_current_tag, udev_device_get_devlinks_list_entry, udev_device_get_properties_list_entry, udev_device_get_tags_list_entry, udev_device_get_current_tags_list_entry, udev_device_get_sysattr_list_entry, udev_device_get_property_value, udev_device_get_sysattr_value, udev_device_set_sysattr_value \- Retrieve or set device attributes .SH "SYNOPSIS" .sp .ft B .nf #include .fi .ft .HP \w'int\ udev_device_has_tag('u .BI "int udev_device_has_tag(struct\ udev_device\ *" "udev_device" ", const\ char\ *" "tag" ");" .HP \w'int\ udev_device_has_current_tag('u .BI "int udev_device_has_current_tag(struct\ udev_device\ *" "udev_device" ", const\ char\ *" "tag" ");" .HP \w'struct\ udev_list_entry\ *udev_device_get_devlinks_list_entry('u .BI "struct udev_list_entry *udev_device_get_devlinks_list_entry(struct\ udev_device\ *" "udev_device" ");" .HP \w'struct\ udev_list_entry\ *udev_device_get_properties_list_entry('u .BI "struct udev_list_entry *udev_device_get_properties_list_entry(struct\ udev_device\ *" "udev_device" ");" .HP \w'struct\ udev_list_entry\ *udev_device_get_tags_list_entry('u .BI "struct udev_list_entry *udev_device_get_tags_list_entry(struct\ udev_device\ *" "udev_device" ");" .HP \w'struct\ udev_list_entry\ *udev_device_get_current_tags_list_entry('u .BI "struct udev_list_entry *udev_device_get_current_tags_list_entry(struct\ udev_device\ *" "udev_device" ");" .HP \w'struct\ udev_list_entry\ *udev_device_get_sysattr_list_entry('u .BI "struct udev_list_entry *udev_device_get_sysattr_list_entry(struct\ udev_device\ *" "udev_device" ");" .HP \w'const\ char\ *udev_device_get_property_value('u .BI "const char *udev_device_get_property_value(struct\ udev_device\ *" "udev_device" ", const\ char\ *" "key" ");" .HP \w'const\ char\ *udev_device_get_sysattr_value('u .BI "const char *udev_device_get_sysattr_value(struct\ udev_device\ *" "udev_device" ", const\ char\ *" "sysattr" ");" .HP \w'int\ udev_device_set_sysattr_value('u .BI "int udev_device_set_sysattr_value(struct\ udev_device\ *" "udev_device" ", const\ char\ *" "sysattr" ", const\ char\ *" "value" ");" .SH "DESCRIPTION" .PP \fBudev_device_has_tag()\fR returns a valuer larger than zero if the specified device object has the indicated tag assigned to it, and zero otherwise\&. See \fBudev\fR(7) for details on the tags concept\&. \fBudev_device_has_current_tag()\fR executes a similar check, however only determines whether the indicated tag was set as result of the most recent event seen for the device\&. Tags are "sticky", i\&.e\&. once set for a device they remain on the device until the device is unplugged, even if the rules run for later events of the same device do not set them anymore\&. Any tag for which \fBudev_device_has_current_tag()\fR returns true will hence also return true when passed to \fBudev_device_has_tag()\fR, but the opposite might not be true, in case a tag is no longer configured by the rules applied to the most recent device even\&. .PP \fBudev_device_get_tags_list_entry()\fR returns a udev_list_entry object, encapsulating a list of tags set for the specified device\&. Similar, \fBudev_device_get_current_tags_list_entry()\fR returns a list of tags set for the specified device as effect of the most recent device event seen (see above for details on the difference)\&. .SH "RETURN VALUE" .PP On success, \fBudev_device_has_tag()\fR and \fBudev_device_has_current_tag()\fR return positive or \fB0\fR, depending on whether the device has the given tag or not\&. On failure, a negative error code is returned\&. .PP On success, \fBudev_device_get_devlinks_list_entry()\fR, \fBudev_device_get_properties_list_entry()\fR, \fBudev_device_get_tags_list_entry()\fR, \fBudev_device_get_current_tags_list_entry()\fR and \fBudev_device_get_sysattr_list_entry()\fR return a pointer to the first entry of the retrieved list\&. If that list is empty, or if an error occurred, \fBNULL\fR is returned\&. .PP On success, \fBudev_device_get_property_value()\fR and \fBudev_device_get_sysattr_value()\fR return a pointer to a constant string of the requested value\&. On error, \fBNULL\fR is returned\&. Attributes that may contain \fBNUL\fR bytes should not be retrieved with \fBudev_device_get_sysattr_value()\fR; instead, read them directly from the files within the device\*(Aqs syspath\&. .PP On success, \fBudev_device_set_sysattr_value()\fR returns an integer greater than, or equal to, \fB0\fR\&. On failure, a negative error code is returned\&. Values that contain \fBNUL\fR bytes should not be set with this function; instead, write them directly to the files within the device\*(Aqs syspath\&. .SH "HISTORY" .PP \fBudev_device_get_devlinks_list_entry()\fR, \fBudev_device_get_properties_list_entry()\fR, \fBudev_device_get_tags_list_entry()\fR, \fBudev_device_get_sysattr_list_entry()\fR, \fBudev_device_get_property_value()\fR, \fBudev_device_has_tag()\fR, \fBudev_device_get_sysattr_value()\fR, and \fBudev_device_set_sysattr_value()\fR were added in version 221\&. .PP \fBudev_device_has_current_tag()\fR and \fBudev_device_get_current_tags_list_entry()\fR were added in version 247\&. .SH "SEE ALSO" .PP \fBudev\fR(7), \fBudev_new\fR(3), \fBudev_device_new_from_syspath\fR(3), \fBudev_device_get_syspath\fR(3), \fBudev_enumerate_new\fR(3), \fBudev_monitor_new_from_netlink\fR(3), \fBudev_list_entry\fR(3), \fBsystemd\fR(1)