lszfcp: fix missing block & sg device output without CONFIG_SYSFS_DEPRECATED

lszfcp -DVe was missing a 3rd SCSI device header line like:

/sys/devices/css0/0.0.0019/0.0.1880/0x50050763031bd327/0x4045400000000000
/sys/bus/ccw/drivers/zfcp/0.0.1880/host0/rport-0:0-0/target0:0:0/0:0:0:1073758277
/sys/block/sda /sys/class/scsi_generic/sg0

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Steffen Maier
2019-02-19 18:09:53 +01:00
committed by Jan Höppner
parent abf18cb711
commit a3e37953fe
2 changed files with 23 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
#
# lszfcp - Tool to display information about zfcp devices (adapters/ports/units)
#
# Copyright IBM Corp. 2006, 2017
# Copyright IBM Corp. 2006, 2019
#
# s390-tools is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
@@ -67,7 +67,7 @@ print_version()
{
cat <<EOF
$SCRIPTNAME: version %S390_TOOLS_VERSION%
Copyright IBM Corp. 2006, 2017
Copyright IBM Corp. 2006, 2019
EOF
}
@@ -272,6 +272,21 @@ show_devices()
echo -n "$SYSFS/block/${BLOCK_DEV#*:} "
echo "$SYSFS/class/scsi_generic/${GEN_DEV#*:}"
elif [ -d $SCSI_DEVICE_PATH/block ] && $SHOW_EXTENDED
then
# case without CONFIG_SYSFS_DEPRECATED
BLOCK_DEV=$(echo $SCSI_DEVICE_PATH/block/*)
BLOCK_DEV=${BLOCK_DEV##*/}
echo -n "$SYSFS/block/$BLOCK_DEV "
local SGPATH=$SCSI_DEVICE_PATH/scsi_generic
if [ -d $SGPATH ]; then
GEN_DEV=$(echo $SGPATH/*)
GEN_DEV=${GEN_DEV##*/}
echo "$SYSFS/class/scsi_generic/$GEN_DEV"
else
echo "-"
fi
# FIXME Find a way to assign the generic devices.
elif [ -r $SYSFS/../runtime.out ]; then
SCSI_DEV=`basename $SCSI_DEVICE_PATH`

View File

@@ -1,8 +1,8 @@
.\" Copyright IBM Corp. 2006, 2017
.\" Copyright IBM Corp. 2006, 2019
.\" s390-tools is free software; you can redistribute it and/or modify
.\" it under the terms of the MIT license. See LICENSE for details.
.\"
.TH LSZFCP 8 "Mar 2008" "s390-tools"
.TH LSZFCP 8 "Feb 2019" "s390-tools"
.SH NAME
lszfcp \- list information about zfcp adapters, ports, and units
@@ -37,6 +37,8 @@ device names are listed.
Option "-V" additionally shows the sysfs paths of interest for the
listed object.
If a SCSI device has an associated block device (disk)
and SCSI generic (sg) device, show their sysfs paths in a 3rd line.
Option "-a" additionally shows all attributes of interest found in
sysfs for the listed object.
@@ -77,6 +79,8 @@ Generate extended output.
.B -V, --verbose
Generate verbose output. Display sysfs path names of class and bus
devices that are of interest for this object.
If a SCSI device has an associated block device (disk)
and SCSI generic (sg) device, show their sysfs paths in a 3rd line.
.TP
.B -s, --sysfs /path/to/sys
Use path as sysfs (for dbginfo archives).