The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/openzfs/cmd/zpool/zpool.d/media

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #!/bin/sh
    2 #
    3 # Print out the type of device
    4 #
    5 
    6 if [ "$1" = "-h" ] ; then
    7         echo "Show whether a vdev is a file, hdd, ssd, or iscsi."
    8         exit
    9 fi
   10 
   11 # shellcheck disable=SC2154
   12 if [ -b "$VDEV_UPATH" ]; then
   13         device="${VDEV_UPATH##*/}"
   14         read -r val 2>/dev/null < "/sys/block/$device/queue/rotational"
   15         case "$val" in
   16                 0) MEDIA="ssd" ;;
   17                 1) MEDIA="hdd" ;;
   18                 *) MEDIA="invalid" ;;
   19         esac
   20 
   21         vpd_pg83="/sys/block/$device/device/vpd_pg83"
   22         if [ -f "$vpd_pg83" ]; then
   23                 if grep -q --binary "iqn." "$vpd_pg83"; then
   24                         MEDIA="iscsi"
   25                 fi
   26         fi
   27 else
   28         if [ -f "$VDEV_UPATH" ]; then
   29                 MEDIA="file"
   30         fi
   31 fi
   32 
   33 echo "media=$MEDIA"

Cache object: d4970ba45a028d7cbb16e45c2017d8be


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.