mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-18 18:31:00 +03:00
420b44488f
Basenames that remain, in cmd/zed/zed.d/statechange-led.sh: dev=$(basename "$(echo "$therest" | awk '{print $(NF-1)}')") vdev=$(basename "$ZEVENT_VDEV_PATH") I don't wanna interfere with #11988 scripts/zfs-tests.sh: SINGLETESTFILE=$(basename "$SINGLETEST") tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list.kshlib: ACTUAL=$(basename $dataset) ACTUAL=$(basename $dataset) tests/zfs-tests/tests/functional/cli_user/zpool_iostat/ zpool_iostat_-c_homedir.ksh: typeset USER_SCRIPT=$(basename "$USER_SCRIPT_FULL") tests/zfs-tests/tests/functional/cli_user/zpool_iostat/ zpool_iostat_-c_searchpath.ksh: typeset CMD_1=$(basename "$SCRIPT_1") typeset CMD_2=$(basename "$SCRIPT_2") tests/zfs-tests/tests/functional/cli_user/zpool_status/ zpool_status_-c_homedir.ksh: typeset USER_SCRIPT=$(basename "$USER_SCRIPT_FULL") tests/zfs-tests/tests/functional/cli_user/zpool_status/ zpool_status_-c_searchpath.ksh typeset CMD_1=$(basename "$SCRIPT_1") typeset CMD_2=$(basename "$SCRIPT_2") tests/zfs-tests/tests/functional/migration/migration.cfg: export BNAME=`basename $TESTFILE` tests/zfs-tests/tests/perf/perf.shlib: typeset logbase="$(get_perf_output_dir)/$(basename \ tests/zfs-tests/tests/perf/perf.shlib: typeset logbase="$(get_perf_output_dir)/$(basename \ These are potentially Of Directories, where basename is actually useful Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12652
59 lines
1.4 KiB
Bash
Executable File
59 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Print SCSI Enclosure Services (SES) info. The output is dependent on the name
|
|
# of the script/symlink used to call it.
|
|
#
|
|
helpstr="
|
|
enc: Show disk enclosure w:x:y:z value.
|
|
slot: Show disk slot number as reported by the enclosure.
|
|
encdev: Show /dev/sg* device associated with the enclosure disk slot.
|
|
fault_led: Show value of the disk enclosure slot fault LED.
|
|
locate_led: Show value of the disk enclosure slot locate LED.
|
|
ses: Show disk's enc, enc device, slot, and fault/locate LED values."
|
|
|
|
script="${0##*/}"
|
|
if [ "$1" = "-h" ] ; then
|
|
echo "$helpstr" | grep "$script:" | tr -s '\t' | cut -f 2-
|
|
exit
|
|
fi
|
|
|
|
if [ "$script" = "ses" ] ; then
|
|
scripts='enc encdev slot fault_led locate_led'
|
|
else
|
|
scripts="$script"
|
|
fi
|
|
|
|
for i in $scripts ; do
|
|
if [ -z "$VDEV_ENC_SYSFS_PATH" ] ; then
|
|
echo "$i="
|
|
continue
|
|
fi
|
|
|
|
val=""
|
|
case $i in
|
|
enc)
|
|
val=$(ls "$VDEV_ENC_SYSFS_PATH/../../" 2>/dev/null)
|
|
;;
|
|
slot)
|
|
val=$(cat "$VDEV_ENC_SYSFS_PATH/slot" 2>/dev/null)
|
|
;;
|
|
encdev)
|
|
val=$(ls "$VDEV_ENC_SYSFS_PATH/../device/scsi_generic" 2>/dev/null)
|
|
;;
|
|
fault_led)
|
|
# JBODs fault LED is called 'fault', NVMe fault LED is called
|
|
# 'attention'.
|
|
if [ -f "$VDEV_ENC_SYSFS_PATH/fault" ] ; then
|
|
val=$(cat "$VDEV_ENC_SYSFS_PATH/fault" 2>/dev/null)
|
|
elif [ -f "$VDEV_ENC_SYSFS_PATH/attention" ] ; then
|
|
val=$(cat "$VDEV_ENC_SYSFS_PATH/attention" 2>/dev/null)
|
|
fi
|
|
;;
|
|
locate_led)
|
|
val=$(cat "$VDEV_ENC_SYSFS_PATH/locate" 2>/dev/null)
|
|
;;
|
|
esac
|
|
echo "$i=$val"
|
|
done
|
|
|