File s390-tools-sles15sp2-02-zdev-Handle-special-case-in-if-case.patch of Package s390-tools.17667

Subject: [PATCH] [FEAT SAN1810] zdev: Handle special case in if-case
From: Fedor Loshakov <loshakov@linux.ibm.com>

Summary:     zdev: report FC Endpoint Security of zfcp devices
Description: Report FC Endpoint Security of zfcp devices, which
             includes:
             1. Add support to report Fibre Channel (FC)
             Endpoint Security related information for zfcp-host
             and zfcp-lun devices.
             2. Format and print HBA FC Endpoint Security trace
             records
Upstream-ID: 16b2799150981e9fc134573957d156d560f6d758
Problem-ID:  SAN1810

Upstream-Description:

             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 Hoeppner <hoeppner@linux.ibm.com>


Signed-off-by: Fedor Loshakov <loshakov@linux.ibm.com>
---
 zdev/src/zfcp_lun.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/zdev/src/zfcp_lun.c
+++ b/zdev/src/zfcp_lun.c
@@ -761,10 +761,8 @@ static char *zfcp_lun_st_get_active_attr
 	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_attr
 		free(hctl);
 
 		name += strlen(SCSI_ATTR_PREFIX);
+	} else {
+		devpath = path_get_zfcp_lun_dev(dev->devid);
 	}
 
 	while (*name == '/')
openSUSE Build Service is sponsored by