return NULL;
if (!udev_device->driver_set) {
udev_device->driver_set = true;
- if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) > 0)
+ if (util_get_sys_core_link_value(udev_device->udev, "driver", udev_device->syspath, driver, sizeof(driver)) > 0)
udev_device->driver = strdup(driver);
}
return udev_device->driver;
if (!udev_device->subsystem_set) {
udev_device->subsystem_set = true;
/* read "subsystem" link */
- if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) {
+ if (util_get_sys_core_link_value(udev_device->udev, "subsystem", udev_device->syspath, subsystem, sizeof(subsystem)) > 0) {
udev_device_set_subsystem(udev_device, subsystem);
return udev_device->subsystem;
}
#define UTIL_NAME_SIZE 512
#define UTIL_LINE_SIZE 16384
#define UDEV_ALLOWED_CHARS_INPUT "/ $%?,"
-ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size);
-ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size);
+ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size);
int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size);
int util_log_priority(const char *priority);
size_t util_path_encode(const char *src, char *dest, size_t size);
#include "libudev.h"
#include "libudev-private.h"
-static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size)
+ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size)
{
char path[UTIL_PATH_SIZE];
char target[UTIL_PATH_SIZE];
return util_strscpy(value, size, pos);
}
-ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size)
-{
- return get_sys_link(udev, "subsystem", syspath, subsystem, size);
-}
-
-ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size)
-{
- return get_sys_link(udev, "driver", syspath, driver, size);
-}
-
int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size)
{
char link_target[UTIL_PATH_SIZE];