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 character file according to parameter.
39 # $3 device path (used for 'b' device type)
41 function create_dev_file
52 # stat(1) --format=FORMAT tokens
53 # %t - major device type in hex
54 # %T - minor device type in hex
56 major=$(stat --dereference --format="%t" "$devstr")
57 minor=$(stat --dereference --format="%T" "$devstr")
58 log_must mknod $filename b "0x${major}" "0x${minor}"
62 # Get the device file information. i.e:
63 # $devstr: block special (28/768)
65 devstr=$(file $devstr)
70 log_must mknod $filename b $major $minor
76 # Create device file '/dev/null', $devstr is unused.
81 # stat(1) --format=FORMAT tokens
82 # %t - major device type in hex
83 # %T - minor device type in hex
85 major=$(stat --format="%t" /dev/null)
86 minor=$(stat --format="%T" /dev/null)
87 log_must mknod $filename c "0x${major}" "0x${minor}"
91 # Create device file '/dev/null'
95 log_must mknod $filename b $major $minor
100 log_must mknod $filename b $major $minor
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.out1
118 log_must rm -f $TESTDIR/$TESTFILE1.out2