1# vim: filetype=sh 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27# ident "@(#)zfs_get_list_d.kshlib 1.1 09/06/22 SMI" 28# 29 30. $STF_SUITE/include/libtest.kshlib 31 32DEPTH_FS=$TESTPOOL/depth_fs 33MAX_DEPTH=3 34DS_COUNT=3 35set -A depth_options "d 0" "d 1" "d 2" "d 4" "d 32" 36set -A depth_array 0 1 2 4 32 37 38# 39# 'zfs get -d or zfs list -d' is supported 40# 41function zfs_get_list_d_supported 42{ 43 check_opt_support "get" "-d" 44 return $? 45} 46 47# 48# Setup multiple depths datasets, including fs, volume and snapshot. 49# 50function depth_fs_setup 51{ 52 typeset -i i j k 53 typeset fslist 54 55 log_must $ZFS create $DEPTH_FS 56 57 (( i=1 )) 58 while (( i<=MAX_DEPTH )); do 59 if (( i==1 )); then 60 fslist=$DEPTH_FS 61 else 62 (( k=i-1 )) 63 fslist=$($ZFS list -rH -t filesystem -o name $DEPTH_FS|$GREP d"$k"$) 64 if (( $? != 0 )); then 65 zfs list -rH -t filesystem -o name $DEPTH_FS 66 log_fail "No d$k filesystem" 67 fi 68 fi 69 for fs in $fslist; do 70 (( j=1 )) 71 while (( j<=DS_COUNT )); do 72 log_must $ZFS create $fs/fs_"$j"_d"$i" 73 if is_global_zone ; then 74 log_must $ZFS create -V 8M $fs/v_"$j"_d"$i" 75 fi 76 log_must $ZFS snapshot $fs@s_"$j"_d"$i" 77 (( j=j+1 )) 78 done 79 done 80 (( i=i+1 )) 81 done 82} 83 84# 85# Cleanup multiple depths filesystem. 86# 87function depth_fs_cleanup 88{ 89 log_must $ZFS destroy -rR $DEPTH_FS 90} 91 92 93