From 9c56255a70c5fc7db940683b7a5c82a97977325e Mon Sep 17 00:00:00 2001 From: Steffen Maier Date: Fri, 1 Mar 2019 16:42:25 +0100 Subject: [PATCH] lszfcp: new command line option to show module parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I often use "systool -v -m zfcp" but that's a bit longish to type and contains more output than just the parameters I'm interested in. "tail /sys/module/zfcp/parameters/*" is also not so nice. "lszfcp -Z" makes it very easy and can be combined with the other existing output options of lszfcp. Signed-off-by: Steffen Maier Reviewed-by: Jens Remus Signed-off-by: Jan Höppner --- zconf/lszfcp | 27 +++++++++++++++++++++++++-- zconf/lszfcp.8 | 15 ++++++++++----- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/zconf/lszfcp b/zconf/lszfcp index e64864d5..df7d5d4c 100755 --- a/zconf/lszfcp +++ b/zconf/lszfcp @@ -14,6 +14,7 @@ FC_CLASS=false # Command line parameters VERBOSITY=0 +SHOW_MODPARMS=0 SHOW_HOSTS=0 SHOW_PORTS=0 SHOW_DEVICES=0 @@ -109,6 +110,7 @@ OPTIONS: -H, --hosts show host information (default) -P, --ports show remote port information -D, --devices show SCSI device information + -Z, --modparms show zfcp (module) parameters -b, --busid=BUSID select specific busid -p, --wwpn=WWPN select specific port name -l, --lun=LUN select specific LUN @@ -159,6 +161,22 @@ show_attributes() } +show_modparms() +{ + local modparmdir=$SYSFS/module/zfcp/parameters + + [ -d "$modparmdir" ] || return + + if [ $VERBOSITY -ne 0 ]; then + echo "$modparmdir" + fi + + echo 'Module = "zfcp"' + show_attributes "$modparmdir" + echo +} + + show_hosts() { HOST_LIST=`ls -dX $SYSFS/devices/css0/[0-9]*/[0-9]*/host[0-9]* \ @@ -509,8 +527,8 @@ show_devices() ############################################################################## -ARGS=`getopt --options ahvHPDVb:p:l:s:em --longoptions \ -attributes,help,version,hosts,ports,devices,verbose,busid:,wwpn:,lun:,sysfs:,extended,moreattrs \ +ARGS=`getopt --options ahvHPDVb:p:l:s:emZ --longoptions \ +attributes,help,version,hosts,ports,devices,verbose,busid:,wwpn:,lun:,sysfs:,extended,moreattrs,modparms \ -n "$SCRIPTNAME" -- "$@"` if [ $? -ne 0 ]; then @@ -535,6 +553,7 @@ for ARG; do -D|--devices) SHOW_DEVICES=1; shift 1;; -P|--ports) SHOW_PORTS=1; shift 1;; -V|--verbose) VERBOSITY=1; shift 1;; + -Z|--modparms) SHOW_MODPARMS=1; shift 1;; -s|--sysfs) SYSFS=$2; shift 2;; --) shift; break;; esac @@ -546,6 +565,10 @@ check_fc_class check_fcp_devs default=1 +if [ $SHOW_MODPARMS -eq 1 ]; then + default=0; show_modparms +fi + if [ $SHOW_HOSTS -eq 1 ]; then default=0; show_hosts elif [ $SHOW_PORTS -eq 0 -a $SHOW_DEVICES -eq 0 -a -n "$PAR_BUSID" ]; then diff --git a/zconf/lszfcp.8 b/zconf/lszfcp.8 index 6eb72380..5bcc28c5 100644 --- a/zconf/lszfcp.8 +++ b/zconf/lszfcp.8 @@ -8,7 +8,7 @@ lszfcp \- list information about zfcp adapters, ports, and units .SH SYNOPSIS .B lszfcp -.RB [ \-hvVaHDPem ] +.RB [ \-hvVaZHDPem ] .RB [ \-b .IR busid ] .RB [ \-l @@ -28,8 +28,10 @@ scsi_devices. The default is to list busids of all zfcp adapters and their corresponding SCSI host names. -There are three output variants. Default (without options "-a" or -"-V") is one line for each object. For adapters the busid and their +There are four output variants. Default (without options "-a" or +"-V" or "-Z") is one line for each object. +For the zfcp device driver (module), its parameters are listed. +For adapters the busid and their corresponding SCSI host names are listed. For ports the pair "busid"/"wwpn" and their corresponding FC-remote-port names are listed. For units the triple "busid"/"wwpn"/"lun" and their corresponding SCSI @@ -75,6 +77,9 @@ If specified twice, show additional attributes of the specified SCSI device objects: scsi_disk, block, block_integrity, block_queue, block_queue_iosched. .TP +.B -Z, --modparms +List zfcp (module) parameters with a scope of the device driver. +.TP .B -D, --devices List zfcp units and SCSI devices. .TP @@ -121,7 +126,7 @@ Display version info and exit. .PP Options "-b", "-p" or "-l" are of restricting nature. They limit the output to those adapters, ports or units that match the specified busid, wwpn and lun. -If none of the options "-H", "-P" and "-D" are specified, "-b" implies "-H", +If none of the options "-Z", "-H", "-P" and "-D" are specified, "-b" implies "-H", "-p" implies "-P" and "-l" implies "-D". .SH EXAMPLES @@ -140,7 +145,7 @@ Show all adapters that match the given busid, all ports that match the given busid and wwpnn and show all units that match the given busid, wwpn and lun. .IP "lszfcp -b 0.0.0815 -p 0x5005123456789000 -l 0x0000000000000000 -H -P -D" Generates same output as previous example. -.IP "lszfcp -HPDVeamm" +.IP "lszfcp -ZHPDVeamm" Generates the fullest output in the extended format. .SH "SEE ALSO" .BR lscss (8)