libudev-device.c revision f4ac4d1a82e2c468761fffa333323841ad886221
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering This file is part of systemd.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2008-2012 Kay Sievers <kay@vrfy.org>
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2015 Tom Gundersen <teg@jklm.no>
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is free software; you can redistribute it and/or modify it
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is distributed in the hope that it will be useful, but
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Lesser General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * SECTION:libudev-device
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * @short_description: kernel sys devices
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * Representation of kernel sys devices. Devices are uniquely identified
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * by their syspath, every device has exactly one path in the kernel sys
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * filesystem. Devices usually belong to a kernel subsystem, and have
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * a unique name inside that subsystem.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * udev_device_get_seqnum:
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * @udev_device: udev device
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * This is only valid if the device was received through a monitor. Devices read from
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * sys do not have a sequence number.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * Returns: the kernel event sequence number, or 0 if there is no sequence number available.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering_public_ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering unsigned long long ret;
if (r == -ENOENT)
errno = -r;
errno = -r;
return ret;
errno = -r;
return makedev(0, 0);
return devnum;
const char *driver;
errno = -r;
return NULL;
return driver;
const char *devtype;
errno = -r;
return NULL;
return devtype;
const char *subsystem;
errno = -r;
return NULL;
return subsystem;
_public_ const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key)
errno = -r;
return NULL;
return value;
if (!udev_device) {
return NULL;
return udev_device;
if (!udev_device)
return NULL;
errno = -r;
return NULL;
return udev_device;
_public_ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum)
if (!udev_device)
return NULL;
errno = -r;
return NULL;
return udev_device;
if (!udev_device)
return NULL;
errno = -r;
return NULL;
return udev_device;
_public_ struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname)
if (!udev_device)
return NULL;
errno = -r;
return NULL;
return udev_device;
if (!udev_device)
return NULL;
errno = -r;
return NULL;
return udev_device;
if (!parent)
return NULL;
errno = -r;
return NULL;
return parent;
_public_ struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype)
errno = -r;
return NULL;
return udev_device;
return NULL;
if (udev_device)
return udev_device;
return NULL;
const char *devpath;
errno = -r;
return NULL;
return devpath;
const char *syspath;
errno = -r;
return NULL;
return syspath;
const char *sysname;
errno = -r;
return NULL;
return sysname;
const char *sysnum;
errno = -r;
return NULL;
return sysnum;
const char *devnode;
errno = -r;
return NULL;
return devnode;
_public_ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device)
const char *devlink;
_public_ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device)
if (r < 0 && r != -ENOENT) {
errno = -r;
return NULL;
return action;
_public_ unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device)
return ts;
_public_ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr)
const char *value;
errno = -r;
return NULL;
return value;
_public_ int udev_device_set_sysattr_value(struct udev_device *udev_device, const char *sysattr, char *value)
_public_ struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device)
const char *sysattr;
int r, initialized;
errno = -r;
return initialized;
const char *tag;