From d4b687c96adf207f0878aebf3ce3371f6160687f Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Thu, 27 Mar 2014 15:30:09 +0100
Subject: [PATCH] udev: update net_id comments

Signed-off-by: Robert Milasan <rmilasan@suse.com>
---
 src/udev/udev-builtin-net_id.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 4f2b2c1..9ac07de 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;
         }
-- 
1.8.4.5

