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/encdev

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 SCSI Enclosure Services (SES) info. The output is dependent on the name
    4 # of the script/symlink used to call it.
    5 #
    6 helpstr="
    7 enc:            Show disk enclosure w:x:y:z value.
    8 slot:           Show disk slot number as reported by the enclosure.
    9 encdev:         Show /dev/sg* device associated with the enclosure disk slot.
   10 fault_led:      Show value of the disk enclosure slot fault LED.
   11 locate_led:     Show value of the disk enclosure slot locate LED.
   12 ses:            Show disk's enc, enc device, slot, and fault/locate LED values."
   13 
   14 script="${0##*/}"
   15 if [ "$1" = "-h" ] ; then
   16         echo "$helpstr" | grep "$script:" | tr -s '\t' | cut -f 2-
   17         exit
   18 fi
   19 
   20 if [ "$script" = "ses" ] ; then
   21         scripts='enc encdev slot fault_led locate_led'
   22 else
   23         scripts="$script"
   24 fi
   25 
   26 for i in $scripts ; do
   27         # shellcheck disable=SC2154
   28         if [ -z "$VDEV_ENC_SYSFS_PATH" ] ; then
   29                 echo "$i="
   30                 continue
   31         fi
   32 
   33         val=""
   34         case $i in
   35         enc)
   36                 val=$(ls "$VDEV_ENC_SYSFS_PATH/../../" 2>/dev/null)
   37                 ;;
   38         slot)
   39                 val=$(cat "$VDEV_ENC_SYSFS_PATH/slot" 2>/dev/null)
   40                 ;;
   41         encdev)
   42                 val=$(ls "$VDEV_ENC_SYSFS_PATH/../device/scsi_generic" 2>/dev/null)
   43                 ;;
   44         fault_led)
   45                 # JBODs fault LED is called 'fault', NVMe fault LED is called
   46                 # 'attention'.
   47                 if [ -f "$VDEV_ENC_SYSFS_PATH/fault" ] ; then
   48                         val=$(cat "$VDEV_ENC_SYSFS_PATH/fault" 2>/dev/null)
   49                 elif [ -f "$VDEV_ENC_SYSFS_PATH/attention" ] ; then
   50                         val=$(cat "$VDEV_ENC_SYSFS_PATH/attention" 2>/dev/null)
   51                 fi
   52                 ;;
   53         locate_led)
   54                 val=$(cat "$VDEV_ENC_SYSFS_PATH/locate" 2>/dev/null)
   55                 ;;
   56         *)
   57                 val=invalid
   58                 ;;
   59         esac
   60         echo "$i=$val"
   61 done

Cache object: 2c3602e5f5cd037e8b54e0375d8ba9f3


[ 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.