summaryrefslogtreecommitdiff
path: root/src/udev/udev-builtin-net_id.c
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-03-27 15:30:09 +0100
committerAnthony G. Basile <blueness@gentoo.org>2014-03-28 11:43:15 -0400
commit0d6a3aec203deca3d2106af96fca30823c9e325e (patch)
treef9245f8d749a3f5277ee6cb71a5ec8cb4c1339a8 /src/udev/udev-builtin-net_id.c
parent75e0b7ce10991c45ee1b66cc12a9bbc5f9bd768a (diff)
udev: update net_id comments
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev/udev-builtin-net_id.c')
-rw-r--r--src/udev/udev-builtin-net_id.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 2fba5223ba..f22751c796 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -33,8 +33,11 @@
* ww -- wwan
*
* Type of names:
+ * b<number> -- BCMA bus core number
+ * ccw<name> -- CCW bus group name
* o<index> -- on-board device index number
* s<slot>[f<function>][d<dev_id>] -- hotplug slot index number
+ * v<number> -- virtio number
* x<MAC> -- MAC address
* [P<domain>]p<bus>s<slot>[f<function>][d<dev_id>]
* -- PCI geographical location
@@ -119,12 +122,9 @@ struct netnames {
const char *pci_onboard_label;
char usb_ports[IFNAMSIZ];
-
char bcma_core[IFNAMSIZ];
-
- char virtio_core[IFNAMSIZ];
-
- char ccw_core[IFNAMSIZ];
+ char virtio[IFNAMSIZ];
+ char ccw_group[IFNAMSIZ];
};
/* retrieve on-board index number and label from firmware */
@@ -353,18 +353,17 @@ static int names_bcma(struct udev_device *dev, struct netnames *names) {
static int names_virtio(struct udev_device *dev, struct netnames *names) {
struct udev_device *virtdev;
- unsigned int core;
+ unsigned int num;
virtdev = udev_device_get_parent_with_subsystem_devtype(dev, "virtio", NULL);
if (!virtdev)
return -ENOENT;
- /* core num */
- if (sscanf(udev_device_get_sysname(virtdev), "virtio%u", &core) != 1)
+ if (sscanf(udev_device_get_sysname(virtdev), "virtio%u", &num) != 1)
return -EINVAL;
- /* suppress the common core == 0 */
- if (core > 0)
- snprintf(names->virtio_core, sizeof(names->virtio_core), "v%u", core);
+ /* suppress the common num == 0 */
+ if (num > 0)
+ snprintf(names->virtio, sizeof(names->virtio), "v%u", num);
names->type = NET_VIRTIO;
return 0;
@@ -402,8 +401,8 @@ static int names_ccw(struct udev_device *dev, struct netnames *names) {
return -EINVAL;
/* Store the CCW bus-ID for use as network device name */
- rc = snprintf(names->ccw_core, sizeof(names->ccw_core), "ccw%s", bus_id);
- if (rc >= 0 && rc < (int)sizeof(names->ccw_core))
+ rc = snprintf(names->ccw_group, sizeof(names->ccw_group), "ccw%s", bus_id);
+ if (rc >= 0 && rc < (int)sizeof(names->ccw_group))
names->type = NET_CCWGROUP;
return 0;
}
@@ -517,7 +516,7 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool
if (err >= 0 && names.type == NET_CCWGROUP) {
char str[IFNAMSIZ];
- if (snprintf(str, sizeof(str), "%s%s", prefix, names.ccw_core) < (int)sizeof(str))
+ if (snprintf(str, sizeof(str), "%s%s", prefix, names.ccw_group) < (int)sizeof(str))
udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str);
goto out;
}
@@ -585,11 +584,11 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool
char str[IFNAMSIZ];
if (names.pci_path[0])
- if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_path, names.virtio_core) < (int)sizeof(str))
+ if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_path, names.virtio) < (int)sizeof(str))
udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str);
if (names.pci_slot[0])
- if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_slot, names.virtio_core) < (int)sizeof(str))
+ if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_slot, names.virtio) < (int)sizeof(str))
udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str);
goto out;
}