chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0035597
)
udev: net_id - merge properties into the correct device
author
Kay Sievers
<kay@vrfy.org>
Mon, 26 Nov 2012 14:03:06 +0000
(15:03 +0100)
committer
Kay Sievers
<kay@vrfy.org>
Mon, 26 Nov 2012 14:03:06 +0000
(15:03 +0100)
src/udev/udev-builtin-net_id.c
patch
|
blob
|
history
diff --git
a/src/udev/udev-builtin-net_id.c
b/src/udev/udev-builtin-net_id.c
index b6e7eee6d8f1af14ac4313e371ba0ba925ce9d4f..44a29fe3713a7bc13924dbe04052c1ad6f67d8be 100644
(file)
--- a/
src/udev/udev-builtin-net_id.c
+++ b/
src/udev/udev-builtin-net_id.c
@@
-46,7
+46,7
@@
#include "udev.h"
/* retrieve on-board index number and label from firmware */
#include "udev.h"
/* retrieve on-board index number and label from firmware */
-static int dev_pci_onboard(struct udev_device *dev, const char *prefix, bool test) {
+static int dev_pci_onboard(struct udev_device *dev,
struct udev_device *parent,
const char *prefix, bool test) {
const char *index;
int idx;
const char *label;
const char *index;
int idx;
const char *label;
@@
-54,10
+54,10
@@
static int dev_pci_onboard(struct udev_device *dev, const char *prefix, bool tes
int err;
/* ACPI _DSM -- device specific method for naming a PCI or PCI Express device */
int err;
/* ACPI _DSM -- device specific method for naming a PCI or PCI Express device */
- index = udev_device_get_sysattr_value(
dev
, "acpi_index");
+ index = udev_device_get_sysattr_value(
parent
, "acpi_index");
/* SMBIOS type 41 -- Onboard Devices Extended Information */
if (!index)
/* SMBIOS type 41 -- Onboard Devices Extended Information */
if (!index)
- index = udev_device_get_sysattr_value(
dev
, "index");
+ index = udev_device_get_sysattr_value(
parent
, "index");
if (!index)
return -ENOENT;
idx = strtoul(index, NULL, 0);
if (!index)
return -ENOENT;
idx = strtoul(index, NULL, 0);
@@
-68,7
+68,7
@@
static int dev_pci_onboard(struct udev_device *dev, const char *prefix, bool tes
if (err < 0)
return err;
if (err < 0)
return err;
- label = udev_device_get_sysattr_value(
dev
, "label");
+ label = udev_device_get_sysattr_value(
parent
, "label");
if (label) {
err = udev_builtin_add_property(dev, test, "ID_NET_LABEL_ONBOARD", label);
if (err < 0)
if (label) {
err = udev_builtin_add_property(dev, test, "ID_NET_LABEL_ONBOARD", label);
if (err < 0)
@@
-77,7
+77,7
@@
static int dev_pci_onboard(struct udev_device *dev, const char *prefix, bool tes
return 0;
}
return 0;
}
-static int dev_pci_slot(struct udev_device *dev, const char *prefix, bool test) {
+static int dev_pci_slot(struct udev_device *dev,
struct udev_device *parent,
const char *prefix, bool test) {
struct udev *udev = udev_device_get_udev(dev);
unsigned int bus;
unsigned int slot;
struct udev *udev = udev_device_get_udev(dev);
unsigned int bus;
unsigned int slot;
@@
-91,7
+91,7
@@
static int dev_pci_slot(struct udev_device *dev, const char *prefix, bool test)
int err = 0;
/* compose a name based on the raw kernel's PCI bus, slot numbers */
int err = 0;
/* compose a name based on the raw kernel's PCI bus, slot numbers */
- if (sscanf(udev_device_get_sysname(
dev
), "0000:%x:%x.%d", &bus, &slot, &func) != 3)
+ if (sscanf(udev_device_get_sysname(
parent
), "0000:%x:%x.%d", &bus, &slot, &func) != 3)
return -ENOENT;
snprintf(str, sizeof(str), "%sp%ds%df%d", prefix, bus, slot, func);
err = udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str);
return -ENOENT;
snprintf(str, sizeof(str), "%sp%ds%df%d", prefix, bus, slot, func);
err = udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str);
@@
-126,7
+126,7
@@
static int dev_pci_slot(struct udev_device *dev, const char *prefix, bool test)
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 */
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)
+ if (strncmp(address, udev_device_get_sysname(
parent
), strlen(address)) == 0)
hotplug_slot = i;
free(address);
}
hotplug_slot = i;
free(address);
}
@@
-146,15
+146,15
@@
out:
}
static int dev_pci(struct udev_device *dev, const char *prefix, bool test) {
}
static int dev_pci(struct udev_device *dev, const char *prefix, bool test) {
- struct udev_device *
d
;
+ struct udev_device *
parent
;
/* skip other buses than direct PCI parents */
/* skip other buses than direct PCI parents */
-
d
= udev_device_get_parent(dev);
- if (!
d || !streq("pci", udev_device_get_subsystem(d
)))
+
parent
= udev_device_get_parent(dev);
+ if (!
parent || !streq("pci", udev_device_get_subsystem(parent
)))
return -ENOENT;
return -ENOENT;
- dev_pci_onboard(d, prefix, test);
- dev_pci_slot(d, prefix, test);
+ dev_pci_onboard(d
ev, parent
, prefix, test);
+ dev_pci_slot(d
ev, parent
, prefix, test);
return 0;
}
return 0;
}
@@
-186,7
+186,7
@@
static int dev_mac(struct udev_device *dev, const char *prefix, bool test) {
snprintf(str, sizeof(str), "OUI:%X%X%X", a1, a2, a3);
udev_builtin_hwdb_lookup(dev, str, test);
snprintf(str, sizeof(str), "OUI:%X%X%X", a1, a2, a3);
udev_builtin_hwdb_lookup(dev, str, test);
- snprintf(str, sizeof(str), "%sx%
x%x%x%x%x%
x", prefix, a1, a2, a3, a4, a5, a6);
+ snprintf(str, sizeof(str), "%sx%
02x%02x%02x%02x%02x%02
x", prefix, a1, a2, a3, a4, a5, a6);
return udev_builtin_add_property(dev, test, "ID_NET_NAME_MAC", str);
}
return udev_builtin_add_property(dev, test, "ID_NET_NAME_MAC", str);
}