mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 18:11: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
32 lines
555 B
Bash
Executable File
32 lines
555 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Print out the type of device
|
|
#
|
|
|
|
if [ "$1" = "-h" ] ; then
|
|
echo "Show whether a vdev is a file, hdd, ssd, or iscsi."
|
|
exit
|
|
fi
|
|
|
|
if [ -b "$VDEV_UPATH" ]; then
|
|
device="${VDEV_UPATH##*/}"
|
|
read -r val 2>/dev/null < "/sys/block/$device/queue/rotational"
|
|
case "$val" in
|
|
0) MEDIA="ssd" ;;
|
|
1) MEDIA="hdd" ;;
|
|
esac
|
|
|
|
vpd_pg83="/sys/block/$device/device/vpd_pg83"
|
|
if [ -f "$vpd_pg83" ]; then
|
|
if grep -q --binary "iqn." "$vpd_pg83"; then
|
|
MEDIA="iscsi"
|
|
fi
|
|
fi
|
|
else
|
|
if [ -f "$VDEV_UPATH" ]; then
|
|
MEDIA="file"
|
|
fi
|
|
fi
|
|
|
|
echo "media=$MEDIA"
|