zdev: Handle special case in if-case

As preparation for a following commit reorder the path logic in function
zfcp_lun_st_get_active_attrib_path(). This then allows to handle
subsequent special cases more easily. Additionally it also enhances the
readability of the expression.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reviewed-by: Fedor Loshakov <loshakov@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jens Remus
2018-11-26 18:10:33 +01:00
committed by Jan Höppner
parent c063273b14
commit 16b2799150
+4 -4
View File
@@ -761,10 +761,8 @@ static char *zfcp_lun_st_get_active_attrib_path(struct subtype *st,
char *hctl, *devpath, *path;
size_t len = strlen(SCSI_ATTR_PREFIX);
if (!starts_with(name, SCSI_ATTR_PREFIX) ||
!(name[len] == 0 || name[len] == '/' ))
devpath = path_get_zfcp_lun_dev(dev->devid);
else {
if (starts_with(name, SCSI_ATTR_PREFIX) &&
(name[len] == 0 || name[len] == '/')) {
hctl = scsi_hctl_from_zfcp_lun_devid(dev->devid);
if (!hctl)
return NULL;
@@ -772,6 +770,8 @@ static char *zfcp_lun_st_get_active_attrib_path(struct subtype *st,
free(hctl);
name += strlen(SCSI_ATTR_PREFIX);
} else {
devpath = path_get_zfcp_lun_dev(dev->devid);
}
while (*name == '/')