From 6dc56a8dfd998327160149b60512e97a05db203de5f0220ef21d351a904146e9 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Mon, 27 Jan 2014 14:49:10 +0000 Subject: [PATCH] Accepting request 215267 from home:juwolf:branches:Base:System Updated to version 0.5.0 OBS-URL: https://build.opensuse.org/request/show/215267 OBS-URL: https://build.opensuse.org/package/show/Base:System/biosdevname?expand=0&rev=19 --- biosdevname-0.4.1.tar.gz | 3 - biosdevname-0.5.0.tar.bz2 | 3 + biosdevname.changes | 11 + biosdevname.spec | 11 +- biosdevname_git_v050_to_head.patch | 546 +++++++++++++++++++++++++++++ udev-rule-path.patch | 24 +- 6 files changed, 572 insertions(+), 26 deletions(-) delete mode 100644 biosdevname-0.4.1.tar.gz create mode 100644 biosdevname-0.5.0.tar.bz2 create mode 100644 biosdevname_git_v050_to_head.patch diff --git a/biosdevname-0.4.1.tar.gz b/biosdevname-0.4.1.tar.gz deleted file mode 100644 index e76a6a9..0000000 --- a/biosdevname-0.4.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:230e5bffd17f46b6d820faa46ea79ace3eecaf919852ee7ff231e73f6b9f8fe7 -size 187782 diff --git a/biosdevname-0.5.0.tar.bz2 b/biosdevname-0.5.0.tar.bz2 new file mode 100644 index 0000000..dd2952b --- /dev/null +++ b/biosdevname-0.5.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2619f42fbfa049930346af6c7f149d2475d93d7cedc4dfab27f18a7b34b0cc69 +size 84045 diff --git a/biosdevname.changes b/biosdevname.changes index 4d15897..7104e5d 100644 --- a/biosdevname.changes +++ b/biosdevname.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Jan 20 16:34:53 UTC 2014 - juwolf@suse.com + +- Updated to version 0.5.0 + * Add version number to biosdevname + * Save off Secondary PCI bus for PCI tree traversal + * Change scan of SMBIOS slot <-> PCI mapping +- Drop: biosdevname-0.4.1.tar.gz +- Add: biosdevname-0.5.0.tar.bz2 +- Add biosdevname_git_v050_to_head.patch: Latest fixes from v0.5.0 to HEAD + ------------------------------------------------------------------- Fri Jul 12 19:33:10 CEST 2013 - ohering@suse.de diff --git a/biosdevname.spec b/biosdevname.spec index 6a8afa7..b4e53a2 100644 --- a/biosdevname.spec +++ b/biosdevname.spec @@ -1,7 +1,7 @@ # # spec file for package biosdevname # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: biosdevname -Version: 0.4.1 +Version: 0.5.0 Release: 0 Summary: Udev helper for naming devices per BIOS names License: GPL-2.0 @@ -28,12 +28,15 @@ Url: http://linux.dell.com/files/biosdevname/ # breadth-first, or of so, there haven't been any comments about that # on LKML. ExclusiveArch: %{ix86} x86_64 -Source0: http://linux.dell.com/files/%{name}/%{name}-%{version}/%{name}-%{version}.tar.gz +#Source0: http://linux.dell.com/files/%{name}/%{name}-%{version}/%{name}-%{version}.tar.gz +Source0: %{name}-%{version}.tar.bz2 Source1: setup-biosdevname.sh +Patch1: biosdevname_git_v050_to_head.patch Patch2: ignore-broken-BIOSes Patch3: whitelist-dell Patch4: udev-rule-path.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: automake BuildRequires: pciutils-devel BuildRequires: pkgconfig BuildRequires: zlib-devel @@ -58,12 +61,14 @@ You can enable/disable usage of biosdevname with boot option %prep %setup -q +%patch1 -p1 %patch2 -p1 %patch3 -p1 %patch4 -p1 %build # this is a udev rule, so it needs to live in / rather than /usr +./autogen.sh %configure --disable-rpath --prefix=/ --bindir=/bin --sbindir=/sbin make %{?_smp_mflags} cp %{S:1} . diff --git a/biosdevname_git_v050_to_head.patch b/biosdevname_git_v050_to_head.patch new file mode 100644 index 0000000..a4d5d2d --- /dev/null +++ b/biosdevname_git_v050_to_head.patch @@ -0,0 +1,546 @@ +diff --git a/Makefile.am b/Makefile.am +index 28d3e8d..14d9a92 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -6,7 +6,7 @@ dist_noinst_DATA = biosdevname.rules.in biosdevname.spec.fedora biosdevname.spec + + + +-CLEANFILES = version src/version.h ++CLEANFILES = version src/bios_dev_name.h + install-data-local: + mkdir -p $(DESTDIR)@RULEDIR@ + $(INSTALL_DATA) $(top_srcdir)/biosdevname.rules.in $(DESTDIR)@RULEDEST@ +diff --git a/biosdevname.1 b/biosdevname.1 +index 7067a56..22a53bd 100644 +--- a/biosdevname.1 ++++ b/biosdevname.1 +@@ -31,16 +31,16 @@ Treat [args] as ethernet devs + .B \-d, \-\-debug + Enable debugging + .TP +-.B \-\-policy \fI[physical|all_ethN] ++.B \-p, \-\-policy \fI[physical|all_ethN] + .TP +-.B \-\-prefix \fI[string] ++.B \-P, \-\-prefix \fI[string] + string use for embedded NICs in the physical policy (default=em) + .TP +-.B \-\-nopirq ++.B \-x, \-\-nopirq + Do not use $PIR table for mapping PCI device to slot. Some BIOS have + incorrect values. + .TP +-.B \-\-smbios \fI[x.y] ++.B \-s, \-\-smbios \fI[x.y] + Require minimum SMBIOS version x.y + .SH POLICIES + .br +diff --git a/configure.ac b/configure.ac +index e26ba98..e75e64a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -88,5 +88,5 @@ echo "PACKAGE_NAME='$PACKAGE_NAME'" > version + echo "PACKAGE_VERSION='$PACKAGE_VERSION'" >> version + echo "PACKAGE_STRING='$PACKAGE_STRING'" >> version + +-AC_CONFIG_FILES([Makefile biosdevname.spec.fedora biosdevname.spec.suse src/version.h]) ++AC_CONFIG_FILES([Makefile biosdevname.spec.fedora biosdevname.spec.suse src/bios_dev_name.h]) + AC_OUTPUT +diff --git a/src/bios_dev_name.c b/src/bios_dev_name.c +index 7374f9b..d0a917a 100644 +--- a/src/bios_dev_name.c ++++ b/src/bios_dev_name.c +@@ -10,8 +10,6 @@ + #include + #include + +-#include "version.h" +- + #include "libbiosdevname.h" + #include "bios_dev_name.h" + +@@ -27,11 +25,11 @@ static void usage(void) + fprintf(stderr, " Options:\n"); + fprintf(stderr, " -i or --interface treat [args] as ethernet devs\n"); + fprintf(stderr, " -d or --debug enable debugging\n"); +- fprintf(stderr, " --policy [physical | all_ethN ]\n"); +- fprintf(stderr, " --prefix [string] string use for embedded NICs (default='em')\n"); +- fprintf(stderr, " --smbios [x.y] Require SMBIOS x.y or greater\n"); +- fprintf(stderr, " --nopirq Don't use $PIR table for slot numbers\n"); +- fprintf(stderr, " --version Show biosdevname version\n"); ++ fprintf(stderr, " -p or --policy [physical | all_ethN ]\n"); ++ fprintf(stderr, " -P or --prefix [string] string use for embedded NICs (default='em')\n"); ++ fprintf(stderr, " -s or --smbios [x.y] Require SMBIOS x.y or greater\n"); ++ fprintf(stderr, " -x or --nopirq Don't use $PIR table for slot numbers\n"); ++ fprintf(stderr, " -v or --version Show biosdevname version\n"); + fprintf(stderr, " Example: biosdevname -i eth0\n"); + fprintf(stderr, " returns: em1\n"); + fprintf(stderr, " when eth0 is an embedded NIC with label '1' on the chassis.\n"); +@@ -70,7 +68,7 @@ parse_opts(int argc, char **argv) + {0, 0, 0, 0} + }; + c = getopt_long(argc, argv, +- "dinp:", ++ "dip:P:xs:v", + long_options, &option_index); + if (c == -1) + break; +diff --git a/src/bios_dev_name.h b/src/bios_dev_name.h +deleted file mode 100644 +index 636c5e1..0000000 +--- a/src/bios_dev_name.h ++++ /dev/null +@@ -1,20 +0,0 @@ +-/* +- * Copyright (c) 2006 Dell, Inc. +- * by Matt Domsch +- * Licensed under the GNU General Public license, version 2. +- */ +-#ifndef GLUE_H_INCLUDED +-#define GLUE_H_INCLUDED +- +-struct bios_dev_name_opts { +- int argc; +- char **argv; +- int optind; +- int sortroutine; +- int namingpolicy; +- const char *prefix; +- unsigned int debug:1; +- unsigned int interface:1; +-}; +- +-#endif /* GLUE_H_INCLUDED */ +diff --git a/src/bios_dev_name.h.in b/src/bios_dev_name.h.in +new file mode 100644 +index 0000000..444c5e5 +--- /dev/null ++++ b/src/bios_dev_name.h.in +@@ -0,0 +1,22 @@ ++/* ++ * Copyright (c) 2006 Dell, Inc. ++ * by Matt Domsch ++ * Licensed under the GNU General Public license, version 2. ++ */ ++#ifndef GLUE_H_INCLUDED ++#define GLUE_H_INCLUDED ++ ++#define BIOSDEVNAME_VERSION "@PACKAGE_VERSION@" ++ ++struct bios_dev_name_opts { ++ int argc; ++ char **argv; ++ int optind; ++ int sortroutine; ++ int namingpolicy; ++ const char *prefix; ++ unsigned int debug:1; ++ unsigned int interface:1; ++}; ++ ++#endif /* GLUE_H_INCLUDED */ +diff --git a/src/bios_device.c b/src/bios_device.c +index 9e319a3..132877e 100644 +--- a/src/bios_device.c ++++ b/src/bios_device.c +@@ -217,32 +217,6 @@ static void match_pci_and_eth_devs(struct libbiosdevname_state *state) + struct pci_device *p; + struct bios_device *b; + struct network_device *n; +- +- list_for_each_entry(n, &state->network_devices, node) { +- p = find_dev_by_pci_name(state, n->drvinfo.bus_info); +- if (!p) +- continue; +- +- b = malloc(sizeof(*b)); +- if (!b) +- continue; +- memset(b, 0, sizeof(*b)); +- INIT_LIST_HEAD(&b->node); +- b->pcidev = p; +- b->netdev = n; +- b->slot_num = -1; +- b->port_num = -1; +- claim_netdev(b->netdev); +- list_add(&b->node, &state->bios_devices); +- } +-} +- +- +-static void match_eth_and_pci_devs(struct libbiosdevname_state *state) +-{ +- struct pci_device *p; +- struct bios_device *b; +- struct network_device *n; + char pci_name[40]; + + list_for_each_entry(p, &state->pci_devices, node) { +@@ -261,8 +235,6 @@ static void match_eth_and_pci_devs(struct libbiosdevname_state *state) + INIT_LIST_HEAD(&b->node); + b->pcidev = p; + b->netdev = n; +- b->slot_num = -1; +- b->port_num = -1; + claim_netdev(b->netdev); + list_add(&b->node, &state->bios_devices); + } +@@ -286,8 +258,6 @@ static void match_unknown_eths(struct libbiosdevname_state *state) + memset(b, 0, sizeof(*b)); + INIT_LIST_HEAD(&b->node); + b->netdev = n; +- b->slot_num = -1; +- b->port_num = -1; + list_add(&b->node, &state->bios_devices); + } + } +@@ -355,26 +325,6 @@ static void find_duplicates(struct libbiosdevname_state *state) + } + } + +-extern int addslot(struct libbiosdevname_state *state, int slot); +- +-/* Fix for RHBZ 816536/757743/756164/: Cards with same PCI but multiple ports +- * chelsio, mellanox */ +-static void check_ports(struct libbiosdevname_state *state) +-{ +- struct pci_device *dev; +- struct bios_device *a; +- +- list_for_each_entry(a, &state->bios_devices, node) { +- dev = a->pcidev; +- if (dev == NULL || dev->is_sriov_virtual_function || dev->vpd_port != INT_MAX) +- continue; +- if (dev->physical_slot != PHYSICAL_SLOT_UNKNOWN) { +- a->slot_num = dev->physical_slot; +- a->port_num = addslot(state, 0x1000 + dev->physical_slot); +- } +- } +-} +- + void * setup_bios_devices(int namingpolicy, const char *prefix) + { + int rc=1; +@@ -390,7 +340,6 @@ void * setup_bios_devices(int namingpolicy, const char *prefix) + get_eths(state); + match_all(state); + sort_device_list(state); +- check_ports(state); + rc = assign_bios_network_names(state, namingpolicy, prefix); + if (rc) + goto out; +diff --git a/src/bios_device.h b/src/bios_device.h +index d1ef911..690ed6f 100644 +--- a/src/bios_device.h ++++ b/src/bios_device.h +@@ -19,9 +19,6 @@ struct bios_device { + struct pci_device *pcidev; + char *bios_name; + int duplicate; +- +- int slot_num; +- int port_num; + }; + + static inline int is_pci(const struct bios_device *dev) +diff --git a/src/dmidecode/dmidecode.c b/src/dmidecode/dmidecode.c +index 3f761a9..a7a60be 100644 +--- a/src/dmidecode/dmidecode.c ++++ b/src/dmidecode/dmidecode.c +@@ -361,6 +361,57 @@ static int address_from_efi(size_t *address) + + static const char *devmem = "/dev/mem"; + ++int dmidecode_read_file(const struct libbiosdevname_state *state) ++{ ++#ifdef _JPH ++ FILE *fp; ++ const char *dmidecode_file = "dmidecode.txt"; ++ char line[128], *r; ++ int type = -1, eth=0,s,b,d,f,slot,i; ++ ++ if ((fp = fopen(dmidecode_file, "r")) == NULL) ++ return 0; ++ while ((fgets(line, sizeof(line), fp)) != NULL) { ++ if (strstr(line, " DMI type 41,") != NULL) { ++ type = 41; ++ eth = 0; ++ slot = -1; ++ } else if (strstr(line, " DMI type 9,") != NULL) { ++ type = 9; ++ } else if (strstr(line, " DMI type ") != NULL) { ++ type = -1; ++ } ++ if (type == 41) { ++ if ((r = strstr(line, "Type: Ethernet")) != NULL) { ++ eth = 1; ++ } ++ if ((r = strstr(line, "Type Instance: ")) != NULL) { ++ sscanf(r, "Type Instance: %d", &slot); ++ } ++ if ((r = strstr(line, "Bus Address: ")) != NULL && eth) { ++ sscanf(r, "Bus Address: %x:%x:%x.%x", &s,&b,&d,&f); ++ printf("bus: %.4x:%.2x:%.2x.%x\n", s, b, d, f); ++ smbios_setslot(state, s, b, d, f, 0x5, 0x00, slot, ""); ++ } ++ } ++ if (type == 9) { ++ /* System Slots */ ++ if ((r = strstr(line, "ID: ")) != NULL) { ++ sscanf(r, "ID: %d", &slot); ++ } ++ if ((r = strstr(line, "Bus Address: ")) != NULL) { ++ sscanf(r, "Bus Address: %x:%x:%x.%x", &s,&b,&d,&f); ++ printf("bus: %.4x:%.2x:%.2x.%x = %d\n", s, b, d, f, slot); ++ for (i=0; i<8; i++) ++ smbios_setslot(state, s, b, d, i, 0x00, slot, 0x00, ""); ++ } ++ } ++ } ++ return 1; ++#endif ++ return 0; ++} ++ + int dmidecode_main(const struct libbiosdevname_state *state) + { + int ret=0; /* Returned value */ +@@ -369,6 +420,9 @@ int dmidecode_main(const struct libbiosdevname_state *state) + int efi; + u8 *buf; + ++ if (dmidecode_read_file(state)) ++ return 0; ++ + /* First try EFI (ia64, Intel-based Mac) */ + efi=address_from_efi(&fp); + switch(efi) +diff --git a/src/naming_policy.c b/src/naming_policy.c +index fe7b934..4f2033c 100644 +--- a/src/naming_policy.c ++++ b/src/naming_policy.c +@@ -59,8 +59,8 @@ static void use_physical(const struct libbiosdevname_state *state, const char *p + portnum = vf->sysfs_index; + else if (vf->uses_smbios & HAS_SMBIOS_INSTANCE && is_pci_smbios_type_ethernet(vf)) + portnum = vf->smbios_instance; +- else if (dev->port_num != -1) +- portnum = dev->port_num; ++ else if (vf->embedded_index_valid) ++ portnum = vf->embedded_index; + if (portnum != INT_MAX) { + snprintf(location, sizeof(location), "%s%u", prefix, portnum); + known=1; +@@ -70,8 +70,6 @@ static void use_physical(const struct libbiosdevname_state *state, const char *p + snprintf(location, sizeof(location), "p%u", dev->pcidev->physical_slot); + if (dev->pcidev->vpd_port < INT_MAX) + portnum = dev->pcidev->vpd_port; +- else if (dev->port_num != -1) +- portnum = dev->port_num; + else if (!dev->pcidev->is_sriov_virtual_function) + portnum = dev->pcidev->index_in_slot; + else +diff --git a/src/pci.c b/src/pci.c +index d017c50..67ef464 100644 +--- a/src/pci.c ++++ b/src/pci.c +@@ -30,6 +30,7 @@ extern int is_valid_smbios; + /* Borrowed from kernel vpd code */ + #define PCI_VPD_LRDT 0x80 + #define PCI_VPD_SRDT_END 0x78 ++#define PCI_VPDR_TAG 0x90 + + #define PCI_VPD_SRDT_LEN_MASK 0x7 + #define PCI_VPD_LRDT_TAG_SIZE 3 +@@ -71,7 +72,7 @@ static int pci_vpd_size(struct pci_device *pdev, int fd) + tag = buf[0] & ~PCI_VPD_SRDT_LEN_MASK; + off += PCI_VPD_SRDT_TAG_SIZE + pci_vpd_srdt_size(buf); + } +- if (tag == 0 || tag == 0xFF || tag == PCI_VPD_SRDT_END) ++ if (tag == 0 || tag == 0xFF || tag == PCI_VPD_SRDT_END || tag == PCI_VPDR_TAG) + break; + } + return off; +@@ -125,7 +126,7 @@ static int parse_vpd(struct libbiosdevname_state *state, struct pci_device *pdev + int i, j, k, isz, jsz, port, func, pfi; + struct pci_device *vf; + +- i = pci_vpd_find_tag(vpd, 0, len, 0x90); ++ i = pci_vpd_find_tag(vpd, 0, len, PCI_VPDR_TAG); + if (i < 0) + return 1; + isz = pci_vpd_lrdt_size(&vpd[i]); +@@ -631,24 +632,6 @@ void free_pci_devices(struct libbiosdevname_state *state) + } + } + +-int addslot(struct libbiosdevname_state *state, int slot) +-{ +- struct slotlist *s; +- +- list_for_each_entry(s, &state->slots, node) { +- if (s->slot == slot) { +- return ++s->count; +- } +- } +- s = malloc(sizeof(*s)); +- INIT_LIST_HEAD(&s->node); +- s->slot = slot; +- s->count = 0; +- list_add(&s->node, &state->slots); +- +- return ++s->count; +-} +- + static void set_pci_slots(struct libbiosdevname_state *state) + { + struct pci_device *dev; +@@ -656,21 +639,55 @@ static void set_pci_slots(struct libbiosdevname_state *state) + list_for_each_entry(dev, &state->pci_devices, node) { + dev_to_slot(state, dev); + } ++} + +- /* Get mapping for each slot */ +- list_for_each_entry(dev, &state->pci_devices, node) { +- if (dev->is_sriov_virtual_function || !is_pci_network(dev) || dev->vpd_port != INT_MAX) { ++static int set_pci_slot_index(struct libbiosdevname_state *state) ++{ ++ struct pci_device *pcidev; ++ int prevslot=-1; ++ int index=1; ++ ++ /* only iterate over the PCI devices, because the bios_device list may be incomplete due to renames happening in parallel */ ++ list_for_each_entry(pcidev, &state->pci_devices, node) { ++ if (pcidev->physical_slot == 0) /* skip embedded devices */ + continue; ++ if (!is_pci_network(pcidev)) /* only look at PCI network devices */ ++ continue; ++ if (pcidev->is_sriov_virtual_function) /* skip sriov VFs, they're handled later */ ++ continue; ++ if (pcidev->physical_slot != prevslot) { ++ index=1; ++ prevslot = pcidev->physical_slot; + } +- if (dev->physical_slot == 0) { +- dev->embedded_index_valid = 1; +- dev->embedded_index = addslot(state, 0); +- } else if (dev->physical_slot != PHYSICAL_SLOT_UNKNOWN) { +- dev->index_in_slot = addslot(state, dev->physical_slot); +- } ++ else ++ index++; ++ pcidev->index_in_slot = index; + } ++ return 0; + } + ++static int set_embedded_index(struct libbiosdevname_state *state) ++{ ++ struct pci_device *pcidev; ++ int index=1; ++ ++ list_for_each_entry(pcidev, &state->pci_devices, node) { ++ if (pcidev->physical_slot != 0) /* skip non-embedded devices */ ++ continue; ++ if (!is_pci_network(pcidev)) /* only look at PCI network devices */ ++ continue; ++ if (pcidev->is_sriov_virtual_function) /* skip sriov VFs, they're handled later */ ++ continue; ++ if (pcidev->vpd_port != INT_MAX) ++ continue; ++ pcidev->embedded_index = index; ++ pcidev->embedded_index_valid = 1; ++ index++; ++ } ++ return 0; ++} ++ ++ + static void set_sriov_pf_vf(struct libbiosdevname_state *state) + { + struct pci_device *vf; +@@ -755,6 +772,8 @@ int get_pci_devices(struct libbiosdevname_state *state) + sort_device_list(state); + set_pci_vpd_instance(state); + set_pci_slots(state); ++ set_embedded_index(state); ++ set_pci_slot_index(state); + set_sriov_pf_vf(state); + + return rc; +diff --git a/src/pirq.c b/src/pirq.c +index 6568c24..0aa4d0c 100644 +--- a/src/pirq.c ++++ b/src/pirq.c +@@ -44,7 +44,53 @@ int pirq_pci_dev_to_slot(struct routing_table *table, int domain, int bus, int d + return INT_MAX; + } + ++struct routing_table *pirq_read_file() ++{ ++#ifdef _JPH ++ FILE *fp; ++ char line[128]; ++ struct routing_table *table; ++ char *r; ++ int count, bus, dev, slot; ++ const char *pirq_file = "biosdecode.txt"; + ++ /* Get count of entries */ ++ if ((fp = fopen(pirq_file, "r")) == NULL) ++ return NULL; ++ count = 0; ++ while (fgets(line, sizeof(line), fp) != NULL) { ++ if (strstr(line, "Slot Entry") != NULL) ++ count++; ++ } ++ fclose(fp); ++ ++ /* Read table */ ++ table = malloc(sizeof(*table) + count * sizeof(struct slot_entry)); ++ table->size = 32 + (sizeof(struct slot_entry) * count); ++ if ((fp = fopen(pirq_file, "r")) == NULL) ++ return NULL; ++ count = 0; ++ while (fgets(line, sizeof(line), fp) != NULL) { ++ if ((r = strstr(line, "Slot Entry")) == NULL) ++ continue; ++ if (sscanf(r, "Slot Entry %*d: ID %x:%x", &bus, &dev) == 2) { ++ table->slot[count].bus = bus; ++ table->slot[count].device = dev << 3; ++ if ((r = strstr(line, "on-board")) != NULL) ++ table->slot[count].slot = 0; ++ else if ((r = strstr(line, "slot number ")) != NULL) { ++ sscanf(r, "slot number %d", &slot); ++ table->slot[count].slot = slot; ++ } ++ printf("%d = %.2x:%.2x = %d\n", count, bus, dev, table->slot[count].slot); ++ count++; ++ } ++ } ++ fclose(fp); ++ return table; ++#endif ++ return NULL; ++} + + struct routing_table * pirq_alloc_read_table() + { +@@ -60,6 +106,9 @@ struct routing_table * pirq_alloc_read_table() + if (nopirq) { + return NULL; + } ++ if ((table = pirq_read_file()) != NULL) ++ return table; ++ + fd = open("/dev/mem", O_RDONLY); + if(fd==-1) + return NULL; +diff --git a/src/version.h.in b/src/version.h.in +deleted file mode 100644 +index bcc0fda..0000000 +--- a/src/version.h.in ++++ /dev/null +@@ -1 +0,0 @@ +-#define BIOSDEVNAME_VERSION "@PACKAGE_VERSION@" diff --git a/udev-rule-path.patch b/udev-rule-path.patch index bb11fec..91c2a0d 100644 --- a/udev-rule-path.patch +++ b/udev-rule-path.patch @@ -1,7 +1,7 @@ -Index: biosdevname-0.4.1/configure.ac +Index: biosdevname-0.5.0/configure.ac =================================================================== ---- biosdevname-0.4.1.orig/configure.ac -+++ biosdevname-0.4.1/configure.ac +--- biosdevname-0.5.0.orig/configure.ac ++++ biosdevname-0.5.0/configure.ac @@ -70,7 +70,10 @@ AC_CHECK_FUNCS([dup2 gettimeofday memset # handles default udev rules as of udev 114 or thereabouts RULEDEST=/lib/udev/rules.d/71-biosdevname.rules @@ -9,24 +9,8 @@ Index: biosdevname-0.4.1/configure.ac -if [[ -e /etc/udev/rules.d/60-net.rules ]]; then +if [[ -e /usr/lib/udev/rules.d/99-systemd.rules ]]; then + # openSUSE 12.3+ -+ RULESDEST=/usr/lib/udev/rules.d/71-biosdevname.rules ++ RULEDEST=/usr/lib/udev/rules.d/71-biosdevname.rules +elif [[ -e /etc/udev/rules.d/60-net.rules ]]; then # RHEL 5 / Fedora RULEDEST=/etc/udev/rules.d/60-biosdevname.rules elif [[ -e /etc/udev/rules.d/31-network.rules ]]; then -Index: biosdevname-0.4.1/configure -=================================================================== ---- biosdevname-0.4.1.orig/configure -+++ biosdevname-0.4.1/configure -@@ -10473,7 +10473,10 @@ done - # handles default udev rules as of udev 114 or thereabouts - RULEDEST=/lib/udev/rules.d/71-biosdevname.rules - --if [ -e /etc/udev/rules.d/60-net.rules ]; then -+if [ -e /usr/lib/udev ]; then -+ # openSUSE 12.3+ -+ RULEDEST=/usr/lib/udev/rules.d/71-biosdevname.rules -+elif [ -e /etc/udev/rules.d/60-net.rules ]; then - # RHEL 5 / Fedora - RULEDEST=/etc/udev/rules.d/60-biosdevname.rules - elif [ -e /etc/udev/rules.d/31-network.rules ]; then