1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# CDDL HEADER START 5# 6# This file and its contents are supplied under the terms of the 7# Common Development and Distribution License ("CDDL"), version 1.0. 8# You may only use this file in accordance with the terms of version 9# 1.0 of the CDDL. 10# 11# A full copy of the text of the CDDL should have accompanied this 12# source. A copy of the CDDL is also available via the Internet at 13# http://www.illumos.org/license/CDDL. 14# 15# CDDL HEADER END 16# 17 18# 19# Copyright (c) 2019 by Tim Chase. All rights reserved. 20# Copyright (c) 2019 Lawrence Livermore National Security, LLC. 21# 22 23. $STF_SUITE/include/libtest.shlib 24 25verify_runnable "global" 26 27if is_freebsd; then 28 diskinfo -v $DISKS | grep -qE 'No.*# TRIM/UNMAP support' && 29 log_unsupported "DISKS do not support discard (TRIM/UNMAP)" 30else 31 DISK1=${DISKS%% *} 32 33 typeset -i max_discard=0 34 if is_disk_device $DEV_RDSKDIR/$DISK1; then 35 max_discard=$(lsblk -Dbn $DEV_RDSKDIR/$DISK1 | awk '{ print $4; exit }') 36 fi 37 38 if test $max_discard -eq 0; then 39 log_unsupported "DISKS do not support discard (TRIM/UNMAP)" 40 fi 41fi 42 43log_pass 44