udev-builtin-net_id.c   udev-builtin-net_id.c 
skipping to change at line 152 skipping to change at line 152
if (idx <= 0) if (idx <= 0)
return -EINVAL; return -EINVAL;
snprintf(names->pci_onboard, sizeof(names->pci_onboard), "o%d", idx ); snprintf(names->pci_onboard, sizeof(names->pci_onboard), "o%d", idx );
names->pci_onboard_label = udev_device_get_sysattr_value(names->pci dev, "label"); names->pci_onboard_label = udev_device_get_sysattr_value(names->pci dev, "label");
return 0; return 0;
} }
/* read the 256 bytes PCI configuration space to check the multi-function b it */ /* read the 256 bytes PCI configuration space to check the multi-function b it */
static bool is_pci_multifunction(struct udev_device *dev) { static bool is_pci_multifunction(struct udev_device *dev) {
char filename[256]; _cleanup_fclose_ FILE *f = NULL;
FILE *f = NULL; const char *filename;
char config[64]; uint8_t config[64];
bool multi = false;
snprintf(filename, sizeof(filename), "%s/config", udev_device_get_s yspath(dev)); filename = strappenda(udev_device_get_syspath(dev), "/config");
f = fopen(filename, "re"); f = fopen(filename, "re");
if (!f) if (!f)
goto out; return false;
if (fread(&config, sizeof(config), 1, f) != 1) if (fread(&config, sizeof(config), 1, f) != 1)
goto out; return false;
/* bit 0-6 header type, bit 7 multi/single function device */ /* bit 0-6 header type, bit 7 multi/single function device */
if ((config[PCI_HEADER_TYPE] & 0x80) != 0) if ((config[PCI_HEADER_TYPE] & 0x80) != 0)
multi = true; return true;
out:
if (f) return false;
fclose(f);
return multi;
} }
static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { static int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
struct udev *udev = udev_device_get_udev(names->pcidev); struct udev *udev = udev_device_get_udev(names->pcidev);
unsigned domain, bus, slot, func, dev_port = 0; unsigned domain, bus, slot, func, dev_port = 0;
size_t l; size_t l;
char *s; char *s;
const char *attr; const char *attr;
struct udev_device *pci = NULL; struct udev_device *pci = NULL;
char slots[256], str[256]; char slots[256], str[256];
 End of changes. 5 change blocks. 
12 lines changed or deleted 9 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/