chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
udev: remove remaining selinux labeling for file in /run
[elogind.git]
/
src
/
libudev
/
libudev-device.c
diff --git
a/src/libudev/libudev-device.c
b/src/libudev/libudev-device.c
index 6a2b1d039a8f72a2682a89101156ebd6f5a33393..a8277d1363dc4b039d20dd6a01bd4c1edee5f337 100644
(file)
--- a/
src/libudev/libudev-device.c
+++ b/
src/libudev/libudev-device.c
@@
-136,7
+136,9
@@
static int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex)
* udev_device_get_devnum:
* @udev_device: udev device
*
* udev_device_get_devnum:
* @udev_device: udev device
*
- * Returns: the device major/minor number.
+ * Get the device major/minor number.
+ *
+ * Returns: the dev_t number.
**/
_public_ dev_t udev_device_get_devnum(struct udev_device *udev_device)
{
**/
_public_ dev_t udev_device_get_devnum(struct udev_device *udev_device)
{
@@
-185,7
+187,9
@@
static int udev_device_set_devpath_old(struct udev_device *udev_device, const ch
* udev_device_get_driver:
* @udev_device: udev device
*
* udev_device_get_driver:
* @udev_device: udev device
*
- * Returns: the driver string, or #NULL if there is no driver attached.
+ * Get the kernel driver name.
+ *
+ * Returns: the driver name string, or #NULL if there is no driver attached.
**/
_public_ const char *udev_device_get_driver(struct udev_device *udev_device)
{
**/
_public_ const char *udev_device_get_driver(struct udev_device *udev_device)
{
@@
-440,7
+444,9
@@
int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_d
* @udev_device: udev device
* @key: property name
*
* @udev_device: udev device
* @key: property name
*
- * Returns: the value of a device property, or #NULL if there is no such property.
+ * Get the value of a given property.
+ *
+ * Returns: the property string, or #NULL if there is no such property.
**/
_public_ const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key)
{
**/
_public_ const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key)
{
@@
-479,7
+485,7
@@
int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
f = fopen(dbfile, "re");
if (f == NULL) {
f = fopen(dbfile, "re");
if (f == NULL) {
- dbg(udev_device->udev, "no db file to read %s: %m\n", dbfile);
+
udev_
dbg(udev_device->udev, "no db file to read %s: %m\n", dbfile);
return -1;
}
udev_device->is_initialized = true;
return -1;
}
udev_device->is_initialized = true;
@@
-519,7
+525,7
@@
int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
}
fclose(f);
}
fclose(f);
- dbg(udev_device->udev, "device %p filled with db file data\n", udev_device);
+
udev_
dbg(udev_device->udev, "device %p filled with db file data\n", udev_device);
return 0;
}
return 0;
}
@@
-637,7
+643,7
@@
_public_ struct udev_device *udev_device_new_from_syspath(struct udev *udev, con
/* path starts in sys */
if (!startswith(syspath, TEST_PREFIX "/sys")) {
/* path starts in sys */
if (!startswith(syspath, TEST_PREFIX "/sys")) {
- dbg(udev, "not in sys :%s\n", syspath);
+
udev_
dbg(udev, "not in sys :%s\n", syspath);
return NULL;
}
return NULL;
}
@@
-669,7
+675,7
@@
_public_ struct udev_device *udev_device_new_from_syspath(struct udev *udev, con
return NULL;
udev_device_set_syspath(udev_device, path);
return NULL;
udev_device_set_syspath(udev_device, path);
- dbg(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device));
+
udev_
dbg(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device));
return udev_device;
}
return udev_device;
}
@@
-871,7
+877,7
@@
_public_ struct udev_device *udev_device_new_from_environment(struct udev *udev)
udev_device_add_property_from_string_parse(udev_device, environ[i]);
if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) {
udev_device_add_property_from_string_parse(udev_device, environ[i]);
if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) {
- dbg(udev, "missing values, invalid device\n");
+
udev_
dbg(udev, "missing values, invalid device\n");
udev_device_unref(udev_device);
udev_device = NULL;
}
udev_device_unref(udev_device);
udev_device = NULL;
}
@@
-1016,14
+1022,15
@@
_public_ struct udev_device *udev_device_ref(struct udev_device *udev_device)
* Drop a reference of a udev device. If the refcount reaches zero,
* the resources of the device will be released.
*
* Drop a reference of a udev device. If the refcount reaches zero,
* the resources of the device will be released.
*
+ * Returns: the passed udev device if it has still an active reference, or #NULL otherwise.
**/
**/
-_public_
void
udev_device_unref(struct udev_device *udev_device)
+_public_
struct udev_device *
udev_device_unref(struct udev_device *udev_device)
{
if (udev_device == NULL)
{
if (udev_device == NULL)
- return;
+ return
NULL
;
udev_device->refcount--;
if (udev_device->refcount > 0)
udev_device->refcount--;
if (udev_device->refcount > 0)
- return;
+ return
udev_device
;
if (udev_device->parent_device != NULL)
udev_device_unref(udev_device->parent_device);
free(udev_device->syspath);
if (udev_device->parent_device != NULL)
udev_device_unref(udev_device->parent_device);
free(udev_device->syspath);
@@
-1043,6
+1050,7
@@
_public_ void udev_device_unref(struct udev_device *udev_device)
free(udev_device->envp);
free(udev_device->monitor_buf);
free(udev_device);
free(udev_device->envp);
free(udev_device->monitor_buf);
free(udev_device);
+ return NULL;
}
/**
}
/**
@@
-1081,7
+1089,9
@@
_public_ const char *udev_device_get_syspath(struct udev_device *udev_device)
* udev_device_get_sysname:
* @udev_device: udev device
*
* udev_device_get_sysname:
* @udev_device: udev device
*
- * Returns: the sys name of the device device
+ * Get the kernel device name in /sys.
+ *
+ * Returns: the name string of the device device
**/
_public_ const char *udev_device_get_sysname(struct udev_device *udev_device)
{
**/
_public_ const char *udev_device_get_sysname(struct udev_device *udev_device)
{
@@
-1094,7
+1104,9
@@
_public_ const char *udev_device_get_sysname(struct udev_device *udev_device)
* udev_device_get_sysnum:
* @udev_device: udev device
*
* udev_device_get_sysnum:
* @udev_device: udev device
*
- * Returns: the trailing number of of the device name
+ * Get the instance number of the device.
+ *
+ * Returns: the trailing number string of of the device name
**/
_public_ const char *udev_device_get_sysnum(struct udev_device *udev_device)
{
**/
_public_ const char *udev_device_get_sysnum(struct udev_device *udev_device)
{
@@
-1583,6
+1595,15
@@
_public_ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_dev
return udev_list_get_entry(&udev_device->tags_list);
}
return udev_list_get_entry(&udev_device->tags_list);
}
+/**
+ * udev_device_has_tag:
+ * @udev_device: udev device
+ * @tag: tag name
+ *
+ * Check if a given device has a certain tag associated.
+ *
+ * Returns: 1 if the tag is found. 0 otherwise.
+ **/
_public_ int udev_device_has_tag(struct udev_device *udev_device, const char *tag)
{
struct udev_list_entry *list_entry;
_public_ int udev_device_has_tag(struct udev_device *udev_device, const char *tag)
{
struct udev_list_entry *list_entry;