summaryrefslogtreecommitdiff
path: root/libudev
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-12-24 22:10:40 +0100
committerKay Sievers <kay.sievers@vrfy.org>2009-12-24 22:10:40 +0100
commit58b533f417307fb66ce11fa8ad4a873c1953ae41 (patch)
tree40aea0c5d9a4ffa5353169b73c2972680de794d1 /libudev
parent299650f1e338b27aa77be3c572a69989b381d6bd (diff)
remove remaining support for CONFIG_SYSFS_DEPRECATED
Diffstat (limited to 'libudev')
-rw-r--r--libudev/libudev-device.c61
1 files changed, 5 insertions, 56 deletions
diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c
index dffeed0b79..71fc775242 100644
--- a/libudev/libudev-device.c
+++ b/libudev/libudev-device.c
@@ -303,25 +303,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *
util_strscpy(path, sizeof(path), syspath);
util_resolve_sys_link(udev, path, sizeof(path));
- /* try to resolve the silly block layout if needed */
- if (strncmp(&path[len], "/block/", 7) == 0) {
- char block[UTIL_PATH_SIZE];
- char part[UTIL_PATH_SIZE];
-
- util_strscpy(block, sizeof(block), path);
- pos = strrchr(block, '/');
- if (pos == NULL)
- return NULL;
- util_strscpy(part, sizeof(part), pos);
- pos[0] = '\0';
- if (util_resolve_sys_link(udev, block, sizeof(block)) == 0)
- util_strscpyl(path, sizeof(path), block, part, NULL);
- }
-
- /* path exists in sys */
- if (strncmp(&syspath[len], "/devices/", 9) == 0 ||
- strncmp(&syspath[len], "/class/", 7) == 0 ||
- strncmp(&syspath[len], "/block/", 7) == 0) {
+ if (strncmp(&syspath[len], "/devices/", 9) == 0) {
char file[UTIL_PATH_SIZE];
/* all "devices" require a "uevent" file */
@@ -369,9 +351,6 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de
{
char path[UTIL_PATH_SIZE];
const char *type_str;
- struct udev_enumerate *udev_enumerate;
- struct udev_list_entry *list_entry;
- struct udev_device *device = NULL;
if (type == 'b')
type_str = "block";
@@ -380,40 +359,10 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de
else
return NULL;
- /* /sys/dev/{block,char}/<maj>:<min> link */
- snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", udev_get_sys_path(udev),
- type_str, major(devnum), minor(devnum));
- if (util_resolve_sys_link(udev, path, sizeof(path)) == 0)
- return udev_device_new_from_syspath(udev, path);
-
- udev_enumerate = udev_enumerate_new(udev);
- if (udev_enumerate == NULL)
- return NULL;
-
- /* fallback to search sys devices for the major/minor */
- if (type == 'b')
- udev_enumerate_add_match_subsystem(udev_enumerate, "block");
- else if (type == 'c')
- udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block");
- udev_enumerate_scan_devices(udev_enumerate);
- udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) {
- struct udev_device *device_loop;
-
- device_loop = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry));
- if (device_loop != NULL) {
- if (udev_device_get_devnum(device_loop) == devnum) {
- if (type == 'b' && strcmp(udev_device_get_subsystem(device_loop), "block") != 0)
- continue;
- if (type == 'c' && strcmp(udev_device_get_subsystem(device_loop), "block") == 0)
- continue;
- device = device_loop;
- break;
- }
- udev_device_unref(device_loop);
- }
- }
- udev_enumerate_unref(udev_enumerate);
- return device;
+ /* use /sys/dev/{block,char}/<maj>:<min> link */
+ snprintf(path, sizeof(path), "%s/dev/%s/%u:%u",
+ udev_get_sys_path(udev), type_str, major(devnum), minor(devnum));
+ return udev_device_new_from_syspath(udev, path);
}
/**