mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	 745a7f78da
			
		
	
	
		745a7f78da
		
	
	
	
	
		
			
			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
		
	
			
		
			
				
	
	
		
			84 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/sh
 | |
| #
 | |
| # Print some common lsblk values
 | |
| #
 | |
| # Any (lowercased) name symlinked to the lsblk script will be passed to lsblk
 | |
| # as one of its --output names.  Here's a partial list of --output names
 | |
| # from the lsblk binary:
 | |
| #
 | |
| # Available columns (for --output):
 | |
| #        NAME  device name
 | |
| #       KNAME  internal kernel device name
 | |
| #     MAJ:MIN  major:minor device number
 | |
| #      FSTYPE  filesystem type
 | |
| #  MOUNTPOINT  where the device is mounted
 | |
| #       LABEL  filesystem LABEL
 | |
| #        UUID  filesystem UUID
 | |
| #          RA  read-ahead of the device
 | |
| #          RO  read-only device
 | |
| #          RM  removable device
 | |
| #       MODEL  device identifier
 | |
| #        SIZE  size of the device
 | |
| #       STATE  state of the device
 | |
| #       OWNER  user name
 | |
| #       GROUP  group name
 | |
| #        MODE  device node permissions
 | |
| #   ALIGNMENT  alignment offset
 | |
| #      MIN-IO  minimum I/O size
 | |
| #      OPT-IO  optimal I/O size
 | |
| #     PHY-SEC  physical sector size
 | |
| #     LOG-SEC  logical sector size
 | |
| #        ROTA  rotational device
 | |
| #       SCHED  I/O scheduler name
 | |
| #     RQ-SIZE  request queue size
 | |
| #        TYPE  device type
 | |
| #    DISC-ALN  discard alignment offset
 | |
| #   DISC-GRAN  discard granularity
 | |
| #    DISC-MAX  discard max bytes
 | |
| #   DISC-ZERO  discard zeroes data
 | |
| #
 | |
| # If the script is run as just 'lsblk' then print out disk size, vendor,
 | |
| # and model number.
 | |
| 
 | |
| 
 | |
| helpstr="
 | |
| label:	Show filesystem label.
 | |
| model:	Show disk model number.
 | |
| size:	Show the disk capacity.
 | |
| vendor:	Show the disk vendor.
 | |
| lsblk:	Show the disk size, vendor, and model number."
 | |
| 
 | |
| script="${0##*/}"
 | |
| 
 | |
| if [ "$1" = "-h" ] ; then
 | |
|         echo "$helpstr" | grep "$script:" | tr -s '\t' | cut -f 2-
 | |
|         exit
 | |
| fi
 | |
| 
 | |
| if [ "$script" = "lsblk" ] ; then
 | |
| 	list="size vendor model"
 | |
| else
 | |
| 	list=$(echo "$script" | tr '[:upper:]' '[:lower:]')
 | |
| fi
 | |
| 
 | |
| # Older versions of lsblk don't support all these values (like SERIAL).
 | |
| for i in $list ; do
 | |
| 
 | |
| 	# Special case: Looking up the size of a file-based vdev can't
 | |
| 	# be done with lsblk.
 | |
| 	if [ "$i" = "size" ] && [ -f "$VDEV_UPATH" ] ; then
 | |
| 		size=$(du -h --apparent-size "$VDEV_UPATH" | cut -f 1)
 | |
| 		echo "size=$size"
 | |
| 		continue
 | |
| 	fi
 | |
| 
 | |
| 
 | |
| 	val=""
 | |
| 	if val=$(eval "lsblk -dl -n -o $i $VDEV_UPATH 2>/dev/null") ; then
 | |
| 		# Remove leading/trailing whitespace from value
 | |
| 		val=$(echo "$val" | sed -e 's/^[[:space:]]*//' \
 | |
| 		     -e 's/[[:space:]]*$//')
 | |
| 	fi
 | |
| 	echo "$i=$val"
 | |
| done
 |