1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 18:55:40 +03:00

Merge pull request #1878 from hbrueckner/for-upstream

udev/path_id: improve and enhance bus detection for Linux on z Systems
This commit is contained in:
Kay Sievers 2015-11-13 15:48:29 +01:00
commit df5d01df7b

View File

@ -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;
type = udev_device_get_sysattr_value(parent, "type");
func = udev_device_get_sysattr_value(parent, "ap_functions");
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;
}
if (type != NULL && func != NULL) {
path_prepend(path, "ap-%s-%s", type, func);
goto out;
}
path_prepend(path, "ccw-%s", udev_device_get_sysname(parent));
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;