- snprintf(s, sizeof(s), "%so%d", prefix, idx);
- udev_builtin_add_property(dev, test, "ID_NET_NAME_FIRMWARE", s);
+static int dev_pci_slot(struct udev_device *dev, const char *prefix, bool test) {
+ struct udev *udev = udev_device_get_udev(dev);
+ unsigned int bus;
+ unsigned int slot;
+ unsigned int func;
+ struct udev_device *pci = NULL;
+ char slots[256];
+ DIR *dir;
+ struct dirent *dent;
+ char str[256];
+ int hotplug_slot = 0;
+ int err = 0;
+
+ /* compose a name based on the raw kernel's PCI bus, slot numbers */
+ if (sscanf(udev_device_get_sysname(dev), "0000:%x:%x.%d", &bus, &slot, &func) != 3)
+ return -ENOENT;
+ snprintf(str, sizeof(str), "%sp%ds%df%d", prefix, bus, slot, func);
+ err = udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str);
+ if (err < 0)
+ return err;