* possibly have a whitelist for these devices here...
*/
class_dev_parent = sysfs_get_classdev_parent(class_dev);
- if (class_dev_parent)
- dbg("Really a partition");
+ if (class_dev_parent != NULL)
+ dbg("given class device has a parent, use this instead");
tspec.tv_sec = 0;
tspec.tv_nsec = 10000000; /* sleep 10 millisec */
while (loop--) {
if (udev_sleep)
nanosleep(&tspec, NULL);
+
if (class_dev_parent)
sysfs_device = sysfs_get_classdev_device(class_dev_parent);
else
sysfs_device = sysfs_get_classdev_device(class_dev);
-
if (sysfs_device != NULL)
goto device_found;
}
dbg("timed out waiting for device symlink, continuing on anyway...");
-
+
device_found:
/* We have another issue with just the wait above - the sysfs part of
* the kernel may not be quick enough to have created the link to the
* device under the "bus" subsystem. Due to this, the sysfs_device->bus
* will not contain the actual bus name :(
- *
- * Libsysfs now provides a new API sysfs_get_device_bus(), so use it
- * if needed
*/
if (sysfs_device) {
if (sysfs_device->bus[0] != '\0')
}
if (dev->symlink[0] != '\0') {
- char temp[NAMESIZE];
+ char temp[NAME_SIZE];
info("configured rule in '%s' at line %i applied, added symlink '%s'",
dev->config_file, dev->config_line, dev->symlink);
}
if (dev->name[0] != '\0') {
+ /* apply all_partitions flag only at a main block device */
+ if (dev->partitions > 0 &&
+ (udev->type != 'b' || udev->kernel_number[0] != '\0'))
+ continue;
+
info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",
dev->config_file, dev->config_line, udev->kernel_name, dev->name);
strfieldcpy(udev->name, dev->name);
}
}
+ /* no rule was found for the net device */
+ if (udev->type == 'n') {
+ dbg("no name for net device '%s' configured", udev->kernel_name);
+ return -1;
+ }
+
/* no rule was found so we use the kernel name */
strfieldcpy(udev->name, udev->kernel_name);
goto done;
found:
apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device);
+
+ if (udev->type == 'n')
+ return 0;
+
udev->partitions = dev->partitions;
strfieldcpy(udev->config_file, dev->config_file);
udev->config_line = dev->config_line;