Accepting request 97484 from home:a_jaeger:FactoryFix

Fix download URL.

OBS-URL: https://build.opensuse.org/request/show/97484
OBS-URL: https://build.opensuse.org/package/show/Base:System/biosdevname?expand=0&rev=9
This commit is contained in:
Torsten Duwe 2011-12-21 09:20:41 +00:00 committed by Git OBS Bridge
parent b14b5c861c
commit 730a4c33f4
13 changed files with 523 additions and 99 deletions

View File

@ -1,10 +0,0 @@
--- src/Makefile.am.orig
+++ src/Makefile.am
@@ -21,7 +21,6 @@ src_biosdevname_SOURCES = \
src/dmidecode/util.c
src_biosdevnameS_SOURCES = $(src_biosdevname_SOURCES)
-src_biosdevnameS_LDFLAGS = -all-static
EXTRA_DIST = \
src/bios_dev_name.h \

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:62e39f11a7f969ca264a6634f11808e9f9eca2f95903bdb00f1c85546acc3a70
size 149684

3
biosdevname-0.3.8.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f9bdfb1da4b9f93c28b8b53b5d8c6e572d2b21df2fa8e81d72191398f4e1ed60
size 189422

View File

@ -1,50 +0,0 @@
From: Bernhard Walle <bwalle@suse.de>
Subject: [PATCH] Delete unused function onboard_device_type()
References: bnc#433795
This patch deletes the unused function onboard_device_type(). That fixes
the compiler warning:
src/dmidecode/dmidecode.c:139: \
warning: no return statement in function returning non-void
Signed-off-by: Bernhard Walle <bwalle@suse.de>
---
src/dmidecode/dmidecode.c | 25 -------------------------
1 file changed, 25 deletions(-)
--- a/src/dmidecode/dmidecode.c
+++ b/src/dmidecode/dmidecode.c
@@ -113,31 +113,6 @@ static void dmi_slot_segment_bus_func(u1
}
}
-static u8 onboard_device_type(u8 code, const char *prefix)
-{
- /* 3.3.x.2 */
- u8 e = (code & 0x80)>>7;
- static const char *type[]={
- "Other", /* 1 */
- "Unknown",
- "Video",
- "SCSI Controller",
- "Ethernet",
- "Token Ring",
- "Sound",
- "PATA Controller",
- "SATA Controller",
- "SAS Controller" /* 0x0A */
- };
- code = code & 0x7F;
- if(code>=0x01 && code<=0x0A) {
- printf("%sStatus: %s\n", prefix, e?"Enabled":"Disabled");
- printf("%sDevice Type: %s\n", prefix, type[code-0x01]);
- }
- else
- printf("%sDevice Type: %s\n", prefix, out_of_spec);
-}
-
/*
* Main
*/

View File

@ -1,23 +0,0 @@
From: Bernhard Walle <bwalle@suse.de>
Subject: [PATCH] Change to --policy=all_names
References: bnc#441079
See the Bugzilla.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
---
biosdevname.rules.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/biosdevname.rules.in
+++ b/biosdevname.rules.in
@@ -2,6 +2,6 @@ KERNEL!="eth*", GOTO="biosdevname_end"
ACTION!="add", GOTO="biosdevname_end"
NAME=="?*", GOTO="biosdevname_end"
-PROGRAM="/sbin/biosdevname --policy=all_ethN -i %k", ENV{INTERFACE_NAME}="%c"
+PROGRAM="/sbin/biosdevname --policy=all_names -i %k", ENV{INTERFACE_NAME}="%c"
LABEL="biosdevname_end"

View File

@ -1,13 +1,59 @@
-------------------------------------------------------------------
Wed Dec 21 09:04:06 UTC 2011 - aj@suse.de
- Fix download URL.
-------------------------------------------------------------------
Wed Nov 30 09:43:41 UTC 2011 - coolo@suse.com
- add automake as buildrequire to avoid implicit dependency
-------------------------------------------------------------------
Fri Sep 23 12:02:44 UTC 2011 - duwe@suse.com
- fix bnc#706505
-------------------------------------------------------------------
Sat Sep 17 19:47:58 UTC 2011 - jengelh@medozas.de
- Remove redundant tags/sections from specfile
-------------------------------------------------------------------
Wed Sep 7 14:50:24 UTC 2011 - duwe@suse.com
- Verify length of VPD on network device (bnc#711172)
-------------------------------------------------------------------
Wed Aug 3 16:11:21 UTC 2011 - duwe@novell.com
- Enable on all Dell machines (bnc#705109)
-------------------------------------------------------------------
Mon Aug 1 13:17:24 UTC 2011 - duwe@novell.com
- pull patch to restrict SMBIOS version and to disable PIRQ usage
from upstream.
- use the above to fix bnc#705162
-------------------------------------------------------------------
Tue Jul 19 10:45:45 UTC 2011 - duwe@novell.com
- version 0.3.8 contains unconditional asm inline, making it
x86-only (bnc#706622)
-------------------------------------------------------------------
Thu Jul 7 18:38:07 UTC 2011 - duwe@novell.com
- fix bnc#704182
-------------------------------------------------------------------
Thu Jun 16 13:54:58 CEST 2011 - duwe@suse.de
- update to 0.3.8, disable rule by default (FATE#312154)
- remove now obsolete patches biosdevname-delete-unused-function.diff,
biosdevname-policy-all_names.diff and
biosdevname-0.2.4-wronglinking.patch.
-------------------------------------------------------------------
Sat Apr 30 15:55:06 UTC 2011 - crrodriguez@opensuse.org

View File

@ -18,7 +18,7 @@
Name: biosdevname
Version: 0.2.4
Version: 0.3.8
Release: 0
Summary: Udev helper for naming devices per BIOS names
Group: System/Base
@ -28,20 +28,24 @@ Url: http://linux.dell.com/files/biosdevname/
# also likely that other arches don't expect the PCI bus to be sorted
# breadth-first, or of so, there haven't been any comments about that
# on LKML.
ExclusiveArch: %{ix86} x86_64 ia64
Source0: http://linux.dell.com/files/%{name}/%{name}-%{version}.tar.bz2
ExclusiveArch: %{ix86} x86_64
Source0: http://linux.dell.com/files/%{name}/%{name}-%{version}/%{name}-%{version}.tar.gz
Source1: setup-biosdevname.sh
Patch1: more-cmdline-args
Patch2: ignore-broken-BIOSes
Patch3: whitelist-dell
Patch4: verify-network-VPD
Patch5: bug-706505
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: automake pciutils-devel zlib-devel
BuildRequires: automake
BuildRequires: pciutils-devel
BuildRequires: zlib-devel
# to figure out how to name the rules file
BuildRequires: udev
# because of mkinitrd_setup in %post and %postun
PreReq: mkinitrd
# for ownership of /etc/udev/rules.d
# for ownership of /lib/udev/rules.d
Requires: udev
Patch0: %{name}-delete-unused-function.diff
Patch1: %{name}-policy-all_names.diff
Patch2: biosdevname-0.2.4-wronglinking.patch
%description
biosdevname in its simplest form takes an kernel name name as an
@ -50,14 +54,19 @@ necessary on systems where the BIOS name for a given device (e.g. the
label on the chassis is "Gb1") doesn't map directly and obviously to
the kernel name (e.g. eth0).
You can enable/disable usage of biosdevname with boot option
"biosdevname=[0|1]"
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
autoreconf -fiv
#autoreconf -fiv
# this is a udev rule, so it needs to live in / rather than /usr
%configure --disable-rpath --libdir=/%{_lib} --prefix=/ --bindir=/bin --sbindir=/sbin
make %{?_smp_mflags}
@ -69,12 +78,15 @@ rm %{buildroot}/sbin/%{name}S || :
mkdir -p $RPM_BUILD_ROOT/lib/mkinitrd/scripts
install -m 0755 setup-biosdevname.sh \
$RPM_BUILD_ROOT/lib/mkinitrd/scripts/setup-biosdevname.sh
# remain disabled by default
perl -pi -e 's,^# GOTO,GOTO,g;' \
$RPM_BUILD_ROOT/lib/udev/rules.d/*-biosdevname.rules
%files
%defattr(-,root,root,-)
%doc COPYING README
/sbin/%{name}
%config(noreplace) %{_sysconfdir}/udev/rules.d/*%{name}.rules
%config(noreplace) /lib/udev/rules.d/*%{name}.rules
%{_mandir}/man1/*
/lib/mkinitrd/scripts/setup-biosdevname.sh

245
bug-706505 Normal file
View File

@ -0,0 +1,245 @@
diff -ur biosdevname-0.3.8.old/src/naming_policy.c biosdevname-0.3.8/src/naming_policy.c
--- biosdevname-0.3.8.old/src/naming_policy.c 2011-09-23 14:09:52.000000000 +0200
+++ biosdevname-0.3.8/src/naming_policy.c 2011-09-23 14:10:11.000000000 +0200
@@ -37,38 +37,39 @@
char interface[IFNAMSIZ];
unsigned int portnum=0;
int known=0;
-
- memset(buffer, 0, sizeof(buffer));
- memset(location, 0, sizeof(location));
- memset(port, 0, sizeof(port));
- memset(interface, 0, sizeof(interface));
+ struct pci_device *vf;
list_for_each_entry(dev, &state->bios_devices, node) {
known = 0;
+ memset(buffer, 0, sizeof(buffer));
+ memset(location, 0, sizeof(location));
+ memset(port, 0, sizeof(port));
+ memset(interface, 0, sizeof(interface));
+
if (is_pci(dev)) {
+ vf = dev->pcidev;
if (dev->pcidev->physical_slot == 0) { /* embedded devices only */
- if (dev->pcidev->uses_sysfs & HAS_SYSFS_INDEX) {
- portnum = dev->pcidev->sysfs_index;
- snprintf(location, sizeof(location), "%s%u", prefix, portnum);
- known=1;
- }
- else if (dev->pcidev->uses_smbios & HAS_SMBIOS_INSTANCE && is_pci_smbios_type_ethernet(dev->pcidev)) {
- portnum = dev->pcidev->smbios_instance;
- snprintf(location, sizeof(location), "%s%u", prefix, portnum);
- known=1;
- }
- else if (dev->pcidev->embedded_index_valid) {
- portnum = dev->pcidev->embedded_index;
+ portnum = INT_MAX;
+ /* Use master VPD device if available */
+ if (vf->vpd_pf)
+ vf = vf->vpd_pf;
+ if (vf->uses_sysfs & HAS_SYSFS_INDEX)
+ portnum = vf->sysfs_index;
+ else if (vf->uses_smbios & HAS_SMBIOS_INSTANCE && is_pci_smbios_type_ethernet(vf))
+ portnum = vf->smbios_instance;
+ else if (vf->embedded_index_valid)
+ portnum = vf->embedded_index;
+ if (portnum != INT_MAX) {
snprintf(location, sizeof(location), "%s%u", prefix, portnum);
known=1;
}
}
else if (dev->pcidev->physical_slot < PHYSICAL_SLOT_UNKNOWN) {
snprintf(location, sizeof(location), "p%u", dev->pcidev->physical_slot);
- if (!dev->pcidev->is_sriov_virtual_function)
- portnum = dev->pcidev->index_in_slot;
- else if (dev->pcidev->vpd_port < INT_MAX)
+ if (dev->pcidev->vpd_port < INT_MAX)
portnum = dev->pcidev->vpd_port;
+ else if (!dev->pcidev->is_sriov_virtual_function)
+ portnum = dev->pcidev->index_in_slot;
else
portnum = dev->pcidev->pf->index_in_slot;
snprintf(port, sizeof(port), "p%u", portnum);
diff -ur biosdevname-0.3.8.old/src/pci.c biosdevname-0.3.8/src/pci.c
--- biosdevname-0.3.8.old/src/pci.c 2011-09-23 14:09:52.000000000 +0200
+++ biosdevname-0.3.8/src/pci.c 2011-09-23 14:10:15.000000000 +0200
@@ -114,9 +114,10 @@
return -1;
}
-static int parse_vpd(struct pci_device *pdev, int len, unsigned char *vpd)
+static int parse_vpd(struct libbiosdevname_state *state, struct pci_device *pdev, int len, unsigned char *vpd)
{
int i, j, k, isz, jsz, port, func, pfi;
+ struct pci_device *vf;
i = pci_vpd_find_tag(vpd, 0, len, 0x90);
if (i < 0)
@@ -133,15 +134,6 @@
if (memcmp(vpd+j+3, "1028VPDR.VER1.0", 15))
return 1;
- /* Lookup NPY Num Ports */
- j = pci_vpd_find_info_subkey(vpd, i, isz, "**", "NPY");
- if (j < 0)
- return 1;
- jsz = pci_vpd_info_field_size(&vpd[j]);
- j += PCI_VPD_INFO_FLD_HDR_SIZE;
- sscanf((char *)vpd+j+3, "%1x", &port);
- pdev->vpd_nports = port;
-
/* Lookup Port Mappings */
j = pci_vpd_find_info_subkey(vpd, i, isz, "**", "DCM");
if (j < 0)
@@ -152,16 +144,21 @@
for (k=3; k<jsz; k+=10) {
/* Parse Port Info */
sscanf((char *)vpd+j+k, "%1x%1x%2x", &port, &func, &pfi);
- if (func == pdev->pci_dev->func) {
- pdev->vpd_port = port;
- pdev->vpd_pfi = pfi;
+ if ((vf = find_pci_dev_by_pci_addr(state, pdev->pci_dev->domain,
+ pdev->pci_dev->bus,
+ pdev->pci_dev->dev,
+ func)) != NULL) {
+ if (vf->vpd_port == INT_MAX) {
+ vf->vpd_port = port;
+ vf->vpd_pfi = pfi;
+ }
}
}
return 0;
}
/* Read and parse PCI VPD section if it exists */
-static int read_pci_vpd(struct pci_device *pdev)
+static int read_pci_vpd(struct libbiosdevname_state *state, struct pci_device *pdev)
{
char path[PATH_MAX];
char pci_name[16];
@@ -172,13 +169,13 @@
unparse_pci_name(pci_name, sizeof(pci_name), pdev->pci_dev);
snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/vpd", pci_name);
- if ((fd = open(path, O_RDONLY)) >= 0) {
+ if ((fd = open(path, O_RDONLY|O_SYNC)) >= 0) {
size = pci_vpd_size(pdev, fd);
if (size > 0) {
vpd = malloc(size);
if (vpd != NULL) {
if ((nrd = pread(fd, vpd, size, 0)) > 0)
- rc = parse_vpd(pdev, nrd, vpd);
+ rc = parse_vpd(state, pdev, nrd, vpd);
free(vpd);
}
}
@@ -189,10 +186,36 @@
static void set_pci_vpd_instance(struct libbiosdevname_state *state)
{
- struct pci_device *dev;
+ struct pci_device *dev, *dev2;
+
+ /* Read VPD information for each device */
+ list_for_each_entry(dev, &state->pci_devices, node) {
+ read_pci_vpd(state, dev);
+ }
+ /* Now match VPD master device */
list_for_each_entry(dev, &state->pci_devices, node) {
- read_pci_vpd(dev);
+ if (dev->vpd_port == INT_MAX)
+ continue;
+ list_for_each_entry(dev2, &state->pci_devices, node) {
+ if (dev2->pci_dev->domain == dev->pci_dev->domain &&
+ dev2->pci_dev->bus == dev->pci_dev->bus &&
+ dev2->pci_dev->dev == dev->pci_dev->dev &&
+ dev2->vpd_port == dev->vpd_port) {
+ dev2->vpd_count++;
+ dev->vpd_pf = dev2;
+ break;
+ }
+ }
+ }
+
+ /* Delete all VPD devices with single function */
+ list_for_each_entry(dev, &state->pci_devices, node) {
+ if (dev->vpd_count == 1) {
+ dev->vpd_port = INT_MAX;
+ dev->vpd_pfi = INT_MAX;
+ dev->vpd_pf = NULL;
+ }
}
}
@@ -495,6 +518,7 @@
dev->vf_index = INT_MAX;
dev->vpd_port = INT_MAX;
dev->vpd_pfi = INT_MAX;
+ dev->vpd_pf = NULL;
fill_pci_dev_sysfs(dev, p);
list_add(&dev->node, &state->pci_devices);
}
@@ -559,6 +583,8 @@
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++;
@@ -644,11 +670,11 @@
/* ordering here is important */
dmidecode_main(state); /* this will fail on Xen guests, that's OK */
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);
- set_pci_vpd_instance(state);
return rc;
}
@@ -711,8 +737,8 @@
if (p->smbios_type) {
s += snprintf(s, size-(s-buf), "SMBIOS Device Type: ");
s += unparse_smbios_type41_type(s, size-(s-buf), p->smbios_type);
- s += snprintf(s, size-(s-buf), "SMBIOS Instance: %u\n", p->smbios_instance);
- s += snprintf(s, size-(s-buf), "SMBIOS Enabled: %s\n", p->smbios_instance?"True":"False");
+ if (p->smbios_instance)
+ s += snprintf(s, size-(s-buf), "SMBIOS Instance: %u\n", p->smbios_instance);
}
if (p->uses_smbios & HAS_SMBIOS_LABEL && p->smbios_label)
s += snprintf(s, size-(s-buf), "SMBIOS Label: %s\n", p->smbios_label);
@@ -727,7 +753,11 @@
if (p->vpd_port < INT_MAX) {
s += snprintf(s, size-(s-buf), "VPD Port: %u\n", p->vpd_port);
s += snprintf(s, size-(s-buf), "VPD Index: %u\n", p->vpd_pfi);
- s += snprintf(s, size-(s-buf), "VPD #Ports: %u\n", p->vpd_nports);
+ if (p->vpd_pf) {
+ s += snprintf(s, size-(s-buf), "VPD PCI master: ");
+ s += unparse_pci_name(s, size-(s-buf), p->vpd_pf->pci_dev);
+ s += snprintf(s, size-(s-buf), " count %d\n", p->vpd_pf->vpd_count);
+ }
}
if (!list_empty(&p->vfs)) {
s += snprintf(s, size-(s-buf), "Virtual Functions:\n");
Only in biosdevname-0.3.8/src: pci.c.orig
diff -ur biosdevname-0.3.8.old/src/pci.h biosdevname-0.3.8/src/pci.h
--- biosdevname-0.3.8.old/src/pci.h 2011-09-23 14:09:52.000000000 +0200
+++ biosdevname-0.3.8/src/pci.h 2011-09-23 14:10:15.000000000 +0200
@@ -29,9 +29,10 @@
char * sysfs_label;
unsigned char uses_sysfs;
unsigned int vf_index;
+ unsigned int vpd_count;
unsigned int vpd_pfi;
- unsigned int vpd_nports;
unsigned int vpd_port;
+ struct pci_device *vpd_pf;
struct pci_device *pf;
struct list_head vfnode;
struct list_head vfs;

10
ignore-broken-BIOSes Normal file
View File

@ -0,0 +1,10 @@
--- biosdevname-0.3.8/biosdevname.rules.in.orig 2011-03-09 00:58:08.000000000 +0100
+++ biosdevname-0.3.8/biosdevname.rules.in 2011-08-01 15:13:10.000000000 +0200
@@ -18,6 +18,6 @@ LABEL="netdevicename_start"
# using NAME= instead of setting INTERFACE_NAME, so that persistent
# names aren't generated for these devices, they are "named" on each boot.
-PROGRAM="/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace"
+PROGRAM="/sbin/biosdevname --policy physical --smbios 2.6 --nopirq -i %k", NAME="%c", OPTIONS+="string_escape=replace"
LABEL="netdevicename_end"

122
more-cmdline-args Normal file
View File

@ -0,0 +1,122 @@
From: Jordan Hargrave <Jordan_Hargrave@dell.com>
Date: Thu, 31 Mar 2011 17:48:00 +0000 (-0500)
Subject: Add command line arguments for checking SMBIOS version and ignore $PIRQ.
X-Git-Url: http://linux.dell.com/cgi-bin/gitweb/gitweb.cgi?p=biosdevname.git;a=commitdiff_plain;h=8dde4129ab403f4df5f013209e5dd21d25b43f05
Add command line arguments for checking SMBIOS version and ignore $PIRQ.
---
diff --git a/src/bios_dev_name.c b/src/bios_dev_name.c
index 81e7620..e2f8454 100644
--- a/src/bios_dev_name.c
+++ b/src/bios_dev_name.c
@@ -14,6 +14,9 @@
#include "bios_dev_name.h"
static struct bios_dev_name_opts opts;
+int nopirq;
+int smver_mjr;
+int smver_mnr;
static void usage(void)
{
@@ -23,6 +26,8 @@ static void usage(void)
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, " 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");
@@ -55,6 +60,8 @@ parse_opts(int argc, char **argv)
{"interface", no_argument, 0, 'i'},
{"policy", required_argument, 0, 'p'},
{"prefix", required_argument, 0, 'P'},
+ {"nopirq", no_argument, 0, 'x'},
+ {"smbios", required_argument, 0, 's'},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv,
@@ -75,6 +82,12 @@ parse_opts(int argc, char **argv)
case 'P':
opts.prefix = optarg;
break;
+ case 's':
+ sscanf(optarg, "%u.%u", &smver_mjr, &smver_mnr);
+ break;
+ case 'x':
+ nopirq = 1;
+ break;
default:
usage();
exit(1);
diff --git a/src/dmidecode/dmidecode.c b/src/dmidecode/dmidecode.c
index ec91305..7bedc3a 100644
--- a/src/dmidecode/dmidecode.c
+++ b/src/dmidecode/dmidecode.c
@@ -40,6 +40,8 @@
#include "../pci.h"
#include "../naming_policy.h"
+extern int smver_mjr, smver_mnr;
+
static const char *bad_index = "<BAD INDEX>";
/*
@@ -176,12 +178,27 @@ static void to_dmi_header(struct dmi_header *h, u8 *data)
h->data=data;
}
+static int isvalidsmbios(int mjr, int mnr)
+{
+ if (!smver_mjr && !smver_mnr)
+ return 1;
+ if (mjr > smver_mjr)
+ return 1;
+ if ((mjr == smver_mjr) && (mnr >= smver_mnr))
+ return 1;
+ return 0;
+}
+
static void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, const struct libbiosdevname_state *state)
{
u8 *buf;
u8 *data;
int i=0;
+ /* Verify SMBIOS version */
+ if (!isvalidsmbios(ver >> 8, ver & 0xFF)) {
+ return;
+ }
if((buf=mem_chunk(base, len, devmem))==NULL)
{
#ifndef USE_MMAP
diff --git a/src/pirq.c b/src/pirq.c
index 14685bb..8eb4c97 100644
--- a/src/pirq.c
+++ b/src/pirq.c
@@ -18,6 +18,8 @@
#include <sys/mman.h>
#include "pirq.h"
+extern int nopirq;
+
/* If unknown, use INT_MAX so they get sorted last */
int pirq_pci_dev_to_slot(struct routing_table *table, int domain, int bus, int dev)
{
@@ -49,8 +51,13 @@ struct routing_table * pirq_alloc_read_table()
int i;
void *mem;
off_t offset=0L;
- int fd=open("/dev/mem", O_RDONLY);
+ int fd;
+ /* Skip PIRQ table parsing */
+ if (nopirq) {
+ return NULL;
+ }
+ fd = open("/dev/mem", O_RDONLY);
if(fd==-1)
return NULL;

View File

@ -27,7 +27,7 @@ cp_bin /sbin/biosdevname "${tmp_mnt}/sbin/biosdevname"
if ! [ -d "${tmp_mnt}/etc/udev/rules.d" ] ; then
mkdir -p "${tmp_mnt}/etc/udev/rules.d"
fi
cp /etc/udev/rules.d/*-biosdevname.rules "${tmp_mnt}/etc/udev/rules.d"
cp /lib/udev/rules.d/*-biosdevname.rules "${tmp_mnt}/etc/udev/rules.d"
# vim: set sw=4 ts=4 et:

60
verify-network-VPD Normal file
View File

@ -0,0 +1,60 @@
X-Git-Url: http://linux.dell.com/cgi-bin/gitweb/gitweb.cgi?p=biosdevname.git;a=blobdiff_plain;f=src%2Fpci.c;h=2175c87f815b33af09bd00d00387d0cec22cd993;hp=7220afc24753c83152acf2ae13b8f1529505a18b;hb=199c98f7bf3ae05f3ecdefcaa776278e7c535cba;hpb=473634364dbc28573faff4ab27d637f7fc842e74
diff --git a/src/pci.c b/src/pci.c
index 7220afc..2175c87 100644
--- a/src/pci.c
+++ b/src/pci.c
@@ -45,6 +45,32 @@ static inline u8 pci_vpd_info_field_size(const u8 *info_field)
return info_field[2];
}
+static int pci_vpd_size(struct pci_device *pdev, int fd)
+{
+ uint8_t buf[3], tag;
+ int off;
+
+ if (!is_pci_network(pdev))
+ return 0;
+ off = 0;
+ for(;;) {
+ if (pread(fd, buf, 1, off) != 1)
+ break;
+ if (buf[0] & PCI_VPD_LRDT) {
+ tag = buf[0];
+ if (pread(fd, buf, 3, off) != 3)
+ break;
+ off += PCI_VPD_LRDT_TAG_SIZE + pci_vpd_lrdt_size(buf);
+ } else {
+ 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)
+ break;
+ }
+ return off;
+}
+
static int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt)
{
int i;
@@ -147,12 +173,14 @@ static int read_pci_vpd(struct pci_device *pdev)
unparse_pci_name(pci_name, sizeof(pci_name), pdev->pci_dev);
snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/vpd", pci_name);
if ((fd = open(path, O_RDONLY)) >= 0) {
- size = lseek(fd, 0, SEEK_END);
- vpd = malloc(size);
- if (vpd != NULL) {
- if ((nrd = pread(fd, vpd, size, 0)) > 0)
- rc = parse_vpd(pdev, nrd, vpd);
- free(vpd);
+ size = pci_vpd_size(pdev, fd);
+ if (size > 0) {
+ vpd = malloc(size);
+ if (vpd != NULL) {
+ if ((nrd = pread(fd, vpd, size, 0)) > 0)
+ rc = parse_vpd(pdev, nrd, vpd);
+ free(vpd);
+ }
}
close(fd);
}

12
whitelist-dell Normal file
View File

@ -0,0 +1,12 @@
--- biosdevname-0.3.8/biosdevname.rules.in.orig 2011-08-03 18:06:57.000000000 +0200
+++ biosdevname-0.3.8/biosdevname.rules.in 2011-08-03 18:07:59.000000000 +0200
@@ -3,6 +3,9 @@
ACTION!="add", GOTO="netdevicename_end"
NAME=="?*", GOTO="netdevicename_end"
+# whitelist all Dell systems
+ATTR{[dmi/id]sys_vendor}=="Dell*", ENV{UDEV_BIOSDEVNAME}="1"
+
# kernel command line "biosdevname={0|1}" can turn off/on biosdevname
IMPORT{cmdline}="biosdevname"
ENV{biosdevname}=="?*", ENV{UDEV_BIOSDEVNAME}="$env{biosdevname}"