4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
28 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
31 . $STF_SUITE/tests/functional/devices/devices.cfg
32 . $STF_SUITE/include/libtest.shlib
35 # Create block file or charactor file according to parameter.
40 function create_dev_file
47 devtype=$(df -n / | awk '{print $3}')
52 rootpool=${rootpool#\(}
53 rootpool=${rootpool%%/*}
55 devstr=$(get_disklist $rootpool)
56 devstr=$(echo "$devstr" | \
59 log_fail "Can not get block device file."
60 devstr=/dev/dsk/${devstr}
64 # Get the existing block device file in current system.
65 # And bring out the first one.
67 devstr=$(df -lhF ufs | \
70 devstr=$(echo "$devstr" | \
73 log_fail "Can not get block device file."
76 log_unsupported "Unsupported fstype " \
78 "only ufs|zfs is supported."
83 # Get the device file information. i.e:
84 # /dev/dsk/c0t0d0s0: block special (28/768)
86 devstr=$(file $devstr)
89 # Bring out major and minor number.
96 log_must mknod $filename b $major $minor
100 # Create device file '/dev/null'
102 log_must mknod $filename c $(getmajor mm) 2
105 log_fail "'$filetype' is wrong."
114 log_must zfs set devices=on $TESTPOOL/$TESTFS
115 log_must rm -f $TESTDIR/$TESTFILE1
116 log_must rm -f $TESTDIR/$TESTFILE2
117 log_must rm -f $TESTDIR/$TESTFILE1.out
118 log_must rm -f $TESTDIR/$TESTFILE2.out