chiark / gitweb /
fix more warnings
[elogind.git] / extras / path_id / path_id.c
index 2d70b6373df8ad0f2b58f11711b502202fb53b87..518ec8b386a782596404a1cd3aede55a60cb9593 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * compose persisistent device path
+ * compose persistent device path
  *
  * Copyright (C) 2009 Kay Sievers <kay.sievers@vrfy.org>
  *
@@ -137,15 +137,13 @@ static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **
 
        /* find iscsi session */
        transportdev = parent;
-       while (1) {
+       for (;;) {
                transportdev = udev_device_get_parent(transportdev);
                if (transportdev == NULL)
                        return NULL;
                if (strncmp(udev_device_get_sysname(transportdev), "session", 7) == 0)
                        break;
        }
-       if (transportdev == NULL)
-               return NULL;
 
        /* find iscsi session device */
        sessiondev = udev_device_new_from_subsystem_sysname(udev, "iscsi_session", udev_device_get_sysname(transportdev));
@@ -388,8 +386,6 @@ int main(int argc, char **argv)
                        printf("Usage: path_id [--debug] [--help] <devpath>\n"
                               "  --debug    print debug information\n"
                               "  --help      print this help text\n\n");
-               default:
-                       rc = 1;
                        goto exit;
                }
        }
@@ -448,6 +444,9 @@ int main(int argc, char **argv)
                } else if (strcmp(subsys, "xen") == 0) {
                        path_prepend(&path, "xen-%s", udev_device_get_sysname(parent));
                        parent = skip_subsystem(parent, "xen");
+               } else if (strcmp(subsys, "virtio") == 0) {
+                       path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent));
+                       parent = skip_subsystem(parent, "virtio");
                }
 
                parent = udev_device_get_parent(parent);