+ 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;
+
+ /* ACPI _SUN -- slot user number */
+ pci = udev_device_new_from_subsystem_sysname(udev, "subsystem", "pci");
+ if (!pci) {
+ err = -ENOENT;
+ goto out;
+ }
+ snprintf(slots, sizeof(slots), "%s/slots", udev_device_get_syspath(pci));
+ dir = opendir(slots);
+ if (!dir) {
+ err = -errno;
+ goto out;
+ }
+
+ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
+ int i;
+ char *rest;
+ char *address;
+
+ if (dent->d_name[0] == '.')
+ continue;
+ i = strtol(dent->d_name, &rest, 10);
+ if (rest[0] != '\0')
+ continue;
+ if (i < 1)
+ continue;
+ snprintf(str, sizeof(str), "%s/%s/address", slots, dent->d_name);
+ if (read_one_line_file(str, &address) >= 0) {
+ /* match slot address with device by stripping the function */
+ if (strncmp(address, udev_device_get_sysname(dev), strlen(address)) == 0)
+ hotplug_slot = i;
+ free(address);
+ }
+
+ if (hotplug_slot > 0)
+ break;
+ }
+ closedir(dir);
+
+ if (hotplug_slot > 0) {
+ snprintf(str, sizeof(str), "%ss%df%d", prefix, hotplug_slot, func);
+ err = udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str);
+ }
+out:
+ udev_device_unref(pci);
+ return err;
+}
+
+static int dev_pci(struct udev_device *dev, const char *prefix, bool test) {
+ struct udev_device *d;