libudev-device.c revision cd42b50d866c35c7ffbab07920dc1323dd978a23
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * libudev - interface to udev device information
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
bdd36cfdba3ff66d25570a9ff568d69e1eb543cfTimo Sirainen * This program is free software: you can redistribute it and/or modify
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * it under the terms of the GNU General Public License as published by
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * the Free Software Foundation, either version 2 of the License, or
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * (at your option) any later version.
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * This program is distributed in the hope that it will be useful,
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * but WITHOUT ANY WARRANTY; without even the implied warranty of
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * GNU General Public License for more details.
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * You should have received a copy of the GNU General Public License
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * along with this program. If not, see <http://www.gnu.org/licenses/>.
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch unsigned long long int seqnum;
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschstatic size_t syspath_to_db_path(struct udev_device *udev_device, char *filename, size_t len)
4d955db590c3d76a631dfc5d37bcdf578a43e55aStephan Bosch /* translate to location of db file */
4d955db590c3d76a631dfc5d37bcdf578a43e55aStephan Bosch util_strlcpy(filename, udev_get_dev_path(udev_device->udev), len);
4d955db590c3d76a631dfc5d37bcdf578a43e55aStephan Bosch start = util_strlcat(filename, "/.udev/db/", len);
4d955db590c3d76a631dfc5d37bcdf578a43e55aStephan Bosch util_strlcat(filename, udev_device->devpath, len);
4d955db590c3d76a631dfc5d37bcdf578a43e55aStephan Bosch return util_path_encode(&filename[start], len - start);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschstatic int device_read_uevent_file(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch util_strlcpy(filename, udev_device->syspath, sizeof(filename));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch util_strlcat(filename, "/uevent", sizeof(filename));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch device_add_property_from_string(udev_device, line);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschstatic int device_read_db(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch syspath_to_db_path(udev_device, filename, sizeof(filename));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev_device->udev, "no db file to read %s: %s\n", filename, strerror(errno));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch target_len = readlink(filename, target, sizeof(target));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev_device->udev, "error reading db link %s: %s\n", filename, strerror(errno));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch if (asprintf(&udev_device->devname, "%s/%s", udev_get_dev_path(udev_device->udev), target) < 0)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devname);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev_device->udev, "error reading db file %s: %s\n", filename, strerror(errno));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch const char *val;
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch asprintf(&udev_device->devname, "%s/%s", udev_get_dev_path(udev_device->udev), val);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch util_strlcpy(filename, udev_get_dev_path(udev_device->udev), sizeof(filename));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch util_strlcat(filename, "/", sizeof(filename));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch util_strlcat(filename, val, sizeof(filename));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch device_set_devlink_priority(udev_device, atoi(val));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch device_set_num_fake_partitions(udev_device, atoi(val));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch device_set_ignore_remove(udev_device, atoi(val));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch device_add_property_from_string(udev_device, val);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev_device->udev, "device %p filled with db file data\n", udev_device);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschstruct udev_device *device_init(struct udev *udev)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch udev_device = malloc(sizeof(struct udev_device));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch memset(udev_device, 0x00, sizeof(struct udev_device));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch INIT_LIST_HEAD(&udev_device->properties_list);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev_device->udev, "udev_device: %p created\n", udev_device);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * udev_device_new_from_syspath:
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * @udev: udev library context
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * @syspath: sys device path including sys directory
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Create new udev device, and fill in information from the sys
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * device and the udev database entry. The sypath is the absolute
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * path to the device, including the sys mount point.
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * The initial refcount is 1, and needs to be decremented to
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * release the ressources of the udev device.
639bb36b12b9f9bb54c8bb1be50eac623622f8a0Timo Sirainen * Returns: a new udev device, or #NULL, if it does not exist
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschstruct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath)
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Bosch /* resolve possible symlink to real path */
639bb36b12b9f9bb54c8bb1be50eac623622f8a0Timo Sirainen util_resolve_sys_link(udev, path, sizeof(path));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschstruct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum)
0e702716169a158b87d08e21d1a128eb99e23fa1Phil Carmody /* /sys/dev/{block,char}/<maj>:<min> links */
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", udev_get_sys_path(udev),
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch if (util_resolve_sys_link(udev, path, sizeof(path)) == 0)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch return udev_device_new_from_syspath(udev, path);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch /* fallback to search all sys devices for the major/minor */
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch enumerate = udev_enumerate_new_from_subsystems(udev, NULL);
0e702716169a158b87d08e21d1a128eb99e23fa1Phil Carmody device_loop = udev_device_new_from_syspath(udev, udev_list_get_name(list));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch if (udev_device_get_devnum(device_loop) == devnum) {
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschstatic struct udev_device *device_new_from_parent(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch struct udev_device *udev_device_parent = NULL;
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch util_strlcpy(path, udev_device->syspath, sizeof(path));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch /* follow "device" link in deprecated sys /sys/class/ layout */
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch if (strncmp(udev_device->devpath, "/class/", 7) == 0) {
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch util_strlcpy(path, udev_device->syspath, sizeof(path));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) {
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschstruct udev_device *udev_device_get_parent(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device);
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Bosch udev_device->parent_device = device_new_from_parent(udev_device);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * udev_device_get_udev:
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * @udev_device: udev device
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Retrieve the udev library context the device was created with.
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Returns: the udev library context
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschstruct udev *udev_device_get_udev(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * udev_device_ref:
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * @udev_device: udev device
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Take a reference of a udev device.
4d955db590c3d76a631dfc5d37bcdf578a43e55aStephan Bosch * Returns: the passed udev device
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschstruct udev_device *udev_device_ref(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * udev_device_unref:
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * @udev_device: udev device
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Bosch * Drop a reference of a udev device. If the refcount reaches zero,
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * the ressources of the device will be released.
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Boschvoid udev_device_unref(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch udev_device_unref(udev_device->parent_device);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch list_cleanup(udev_device->udev, &udev_device->link_list);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch list_cleanup(udev_device->udev, &udev_device->properties_list);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch list_cleanup(udev_device->udev, &udev_device->attr_list);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev_device->udev, "udev_device: %p released\n", udev_device);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * udev_device_get_devpath:
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * @udev_device: udev device
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Retrieve the kernel devpath value of the udev device. The path
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * does not contain the sys mount point, and starts with a '/'.
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Returns: the devpath of the udev device
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschconst char *udev_device_get_devpath(struct udev_device *udev_device)
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Bosch * udev_device_get_syspath:
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Bosch * @udev_device: udev device
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Retrieve the sys path of the udev device. The path is an
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * absolute path and starts with the sys mount point.
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Bosch * Returns: the sys path of the udev device
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Boschconst char *udev_device_get_syspath(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschconst char *udev_device_get_sysname(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * udev_device_get_devnode:
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * @udev_device: udev device
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Retrieve the device node file name belonging to the udev device.
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * The path is an absolute path, and starts with the device directory.
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Returns: the device node file name of the udev device, or #NULL if no device node exists
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschconst char *udev_device_get_devnode(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * udev_device_get_subsystem:
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * @udev_device: udev device
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Retrieve the subsystem string of the udev device. The string does not
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * contain any "/".
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Returns: the subsystem name of the udev device, or #NULL if it can not be determined
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschconst char *udev_device_get_subsystem(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch /* read "subsytem" link */
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) {
f3cf2f02155c4bac23fd50f0de96c0cae9c46478Stephan Bosch /* implicit names */
72fc989c43a0dc94ec2f114b5e221beeab45519bTimo Sirainen if (strncmp(udev_device->devpath, "/module/", 8) == 0) {
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch if (strstr(udev_device->devpath, "/drivers/") != NULL) {
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Bosch if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 ||
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch strncmp(udev_device->devpath, "/class/", 7) == 0 ||
009217abb57a24a4076092e8e4e165545747839eStephan Bosch strncmp(udev_device->devpath, "/bus/", 5) == 0) {
009217abb57a24a4076092e8e4e165545747839eStephan Bosch * udev_device_get_devlinks_list:
009217abb57a24a4076092e8e4e165545747839eStephan Bosch * @udev_device: udev device
009217abb57a24a4076092e8e4e165545747839eStephan Bosch * Retrieve the list of device links pointing to the device file of
009217abb57a24a4076092e8e4e165545747839eStephan Bosch * the udev device. The next list entry can be retrieved with
009217abb57a24a4076092e8e4e165545747839eStephan Bosch * udev_list_next(), which returns #NULL if no more entries exist.
009217abb57a24a4076092e8e4e165545747839eStephan Bosch * The devlink path can be retrieved from the list entry by
009217abb57a24a4076092e8e4e165545747839eStephan Bosch * udev_list_get_name(). The path is an absolute path, and starts with
009217abb57a24a4076092e8e4e165545747839eStephan Bosch * the device directory.
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Returns: the first entry of the device node link list
009217abb57a24a4076092e8e4e165545747839eStephan Boschstruct udev_list *udev_device_get_devlinks_list(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch return list_get_entry(&udev_device->link_list);
df70bf8c997cd91452cdb3a5c2e20605d30446d2Stephan Bosch * udev_device_get_properties_list:
df70bf8c997cd91452cdb3a5c2e20605d30446d2Stephan Bosch * @udev_device: udev device
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Retrieve the list of key/value device properties of the udev
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * device. The next list entry can be retrieved with udev_list_next(),
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * which returns #NULL if no more entries exist. The property name
df70bf8c997cd91452cdb3a5c2e20605d30446d2Stephan Bosch * can be retrieved from the list entry by udev_list_get_name(),
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * the property value by udev_list_get_value().
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch * Returns: the first entry of the property list
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschstruct udev_list *udev_device_get_properties_list(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch return list_get_entry(&udev_device->properties_list);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschconst char *udev_device_get_driver(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) < 2)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschdev_t udev_device_get_devnum(struct udev_device *udev_device)
f3cf2f02155c4bac23fd50f0de96c0cae9c46478Stephan Bosch return makedev(0, 0);
bcd6c13936df11167350ac86598a781dce9038c3Stephan Boschconst char *udev_device_get_action(struct udev_device *udev_device)
bcd6c13936df11167350ac86598a781dce9038c3Stephan Boschunsigned long long int udev_device_get_seqnum(struct udev_device *udev_device)
bcd6c13936df11167350ac86598a781dce9038c3Stephan Boschconst char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch /* look for possibly already cached result */
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch list = list_get_entry(&udev_device->attr_list);
df70bf8c997cd91452cdb3a5c2e20605d30446d2Stephan Bosch if (strcmp(udev_list_get_name(list), attr) == 0) {
df70bf8c997cd91452cdb3a5c2e20605d30446d2Stephan Bosch info(udev_device->udev, "got '%s' (%s) from cache\n", attr, udev_list_get_value(list));
df70bf8c997cd91452cdb3a5c2e20605d30446d2Stephan Bosch util_strlcpy(path, udev_device_get_syspath(udev_device), sizeof(path));
df70bf8c997cd91452cdb3a5c2e20605d30446d2Stephan Bosch info(udev_device->udev, "stat '%s' failed: %s\n", path, strerror(errno));
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch /* links return the last element of the target path */
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev_device->udev, "cache '%s' with link value '%s'\n", attr, pos);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch list = list_insert(udev_device->udev, &udev_device->attr_list, attr, pos, 0);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch /* skip directories */
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch /* skip non-readable files */
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch /* read attribute value */
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev_device->udev, "attribute '%s' can not be opened\n", path);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch /* got a valid value, store it in cache and return it */
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch info(udev_device->udev, "'%s' has attribute value '%s'\n", path, value);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch list = list_insert(udev_device->udev, &udev_device->attr_list, attr, value, 0);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_set_syspath(struct udev_device *udev_device, const char *syspath)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch const char *pos;
05262e3132642bbdc4a8087c17b0903cf2ff22d2Stephan Bosch udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))];
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Boschint device_set_subsystem(struct udev_device *udev_device, const char *subsystem)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_set_devname(struct udev_device *udev_device, const char *devname)
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Boschint device_add_devlink(struct udev_device *udev_device, const char *devlink)
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Bosch if (list_insert(udev_device->udev, &udev_device->link_list, devlink, NULL, 0) == NULL)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_add_property(struct udev_device *udev_device, const char *key, const char *value)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch if (list_insert(udev_device->udev, &udev_device->properties_list, key, value, 0) == NULL)
7a545edbd1fca7a330bcb4a807002373ee18762aStephan Boschint device_add_property_from_string(struct udev_device *udev_device, const char *property)
05262e3132642bbdc4a8087c17b0903cf2ff22d2Stephan Boschint device_set_action(struct udev_device *udev_device, const char *action)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_set_driver(struct udev_device *udev_device, const char *driver)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschconst char *device_get_devpath_old(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Bosch udev_device->devpath_old = strdup(devpath_old);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschconst char *device_get_physdevpath(struct udev_device *udev_device)
bcd6c13936df11167350ac86598a781dce9038c3Stephan Boschint device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath)
72fc989c43a0dc94ec2f114b5e221beeab45519bTimo Sirainen udev_device->physdevpath = strdup(physdevpath);
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_get_timeout(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_set_timeout(struct udev_device *udev_device, int timeout)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_set_devnum(struct udev_device *udev_device, dev_t devnum)
bcd6c13936df11167350ac86598a781dce9038c3Stephan Boschint device_get_num_fake_partitions(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_set_num_fake_partitions(struct udev_device *udev_device, int num)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_get_devlink_priority(struct udev_device *udev_device)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_set_devlink_priority(struct udev_device *udev_device, int prio)
8fe8f97e688779add9cd042a9db4ddb7b117cce2Stephan Boschint device_get_ignore_remove(struct udev_device *udev_device)