/*
- * compose persisistent device path
+ * compose persistent device path
*
* Copyright (C) 2009 Kay Sievers <kay.sievers@vrfy.org>
*
+ * Logic based on Hannes Reinecke's shell script.
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
#include "libudev.h"
#include "libudev-private.h"
-int debug;
+static int debug;
static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
/* 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));
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;
}
}
} 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);