chiark / gitweb /
udev: update net_id comments
authorKay Sievers <kay@vrfy.org>
Thu, 27 Mar 2014 14:30:09 +0000 (15:30 +0100)
committerKay Sievers <kay@vrfy.org>
Thu, 27 Mar 2014 14:30:34 +0000 (15:30 +0100)
src/udev/udev-builtin-net_id.c

index 4f2b2c1f73b35ee1c8603f16627cf65ee876c263..9ac07de7bd6953474f91011e20ad0dccc798b3e1 100644 (file)
  *   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;
         }