summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiu Yuan Yuan <bjyyliu@linux.vnet.ibm.com>2015-11-13 11:50:42 +0100
committerHendrik Brueckner <brueckner@linux.vnet.ibm.com>2015-11-13 11:50:42 +0100
commite7eb5a8d88367a755944fdda3023a308e5272953 (patch)
treeb81d1fe9e16ecfd8438597e6248944caf76ba91a
parent87fde73e185fabc346ee4d9c9befe972e3502dc3 (diff)
udev/path_id: improve and enhance bus detection for Linux on z Systems
Improve and enhance the path_id udev builtin to correctly handle bus' available on Linux on z Systems (s390). Previously, the CCW bus and, in particular, any FCP devices on it, have been treated separately. This commit integrates the CCW bus into the device chain loop. FCP devices and their associated SCSI disks are now handled through the common SCSI handling functions in path_id. This implies also a change in the naming of the symbolic links created by udev. So any backports of this commit to existing Linux distribution must be done with care. If a backport is required, a udev rule must be created to also create the "old-style" symbolic links. Apart from the CCW bus, this commit adds bus support for the: - ccwgroup bus which manages network devices, and - ap bus which manages cryptographic adapters - iucv bus which manages IUCV devices on z/VM
-rw-r--r--src/udev/udev-builtin-path_id.c57
1 files changed, 30 insertions, 27 deletions
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index 1e190140b2..aa18c7e420 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -593,31 +593,23 @@ static struct udev_device *handle_bcma(struct udev_device *parent, char **path)
return parent;
}
-static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) {
- struct udev_device *scsi_dev;
+/* Handle devices of AP bus in System z platform. */
+static struct udev_device *handle_ap(struct udev_device *parent, char **path) {
+ const char *type, *func;
assert(parent);
- assert(dev);
assert(path);
- scsi_dev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device");
- if (scsi_dev != NULL) {
- const char *wwpn;
- const char *lun;
- const char *hba_id;
-
- hba_id = udev_device_get_sysattr_value(scsi_dev, "hba_id");
- wwpn = udev_device_get_sysattr_value(scsi_dev, "wwpn");
- lun = udev_device_get_sysattr_value(scsi_dev, "fcp_lun");
- if (hba_id != NULL && lun != NULL && wwpn != NULL) {
- path_prepend(path, "ccw-%s-zfcp-%s:%s", hba_id, wwpn, lun);
- goto out;
- }
- }
+ type = udev_device_get_sysattr_value(parent, "type");
+ func = udev_device_get_sysattr_value(parent, "ap_functions");
- path_prepend(path, "ccw-%s", udev_device_get_sysname(parent));
+ if (type != NULL && func != NULL) {
+ path_prepend(path, "ap-%s-%s", type, func);
+ goto out;
+ }
+ path_prepend(path, "ap-%s", udev_device_get_sysname(parent));
out:
- parent = skip_subsystem(parent, "ccw");
+ parent = skip_subsystem(parent, "ap");
return parent;
}
@@ -629,13 +621,6 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool
assert(dev);
- /* S390 ccw bus */
- parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL);
- if (parent != NULL) {
- handle_ccw(parent, dev, &path);
- goto out;
- }
-
/* walk up the chain of devices and compose path */
parent = dev;
while (parent != NULL) {
@@ -683,6 +668,25 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool
parent = skip_subsystem(parent, "scm");
supported_transport = true;
supported_parent = true;
+ } else if (streq(subsys, "ccw")) {
+ path_prepend(&path, "ccw-%s", udev_device_get_sysname(parent));
+ parent = skip_subsystem(parent, "ccw");
+ supported_transport = true;
+ supported_parent = true;
+ } else if (streq(subsys, "ccwgroup")) {
+ path_prepend(&path, "ccwgroup-%s", udev_device_get_sysname(parent));
+ parent = skip_subsystem(parent, "ccwgroup");
+ supported_transport = true;
+ supported_parent = true;
+ } else if (streq(subsys, "ap")) {
+ parent = handle_ap(parent, &path);
+ supported_transport = true;
+ supported_parent = true;
+ } else if (streq(subsys, "iucv")) {
+ path_prepend(&path, "iucv-%s", udev_device_get_sysname(parent));
+ parent = skip_subsystem(parent, "iucv");
+ supported_transport = true;
+ supported_parent = true;
}
if (parent)
@@ -705,7 +709,6 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool
if (streq(udev_device_get_subsystem(dev), "block") && !supported_transport)
path = mfree(path);
-out:
if (path != NULL) {
char tag[UTIL_NAME_SIZE];
size_t i;