+static bool is_pci_singlefunction(struct udev_device *dev) {
+ char filename[256];
+ FILE *f;
+ char config[256];
+ bool single = false;
+
+ snprintf(filename, sizeof(filename), "%s/config", udev_device_get_syspath(dev));
+ f = fopen(filename, "re");
+ if (!f)
+ goto out;
+ if (fread(&config, sizeof(config), 1, f) != 1)
+ goto out;
+
+ /* bit 0-6 header type, bit 7 multi/single function device */
+ if ((config[PCI_HEADER_TYPE] & 0x80) == 0)
+ single = true;
+out:
+ fclose(f);
+ return single;
+}
+