Update ZTS to work on FreeBSD

Update the common ZTS scripts and individual test cases as needed 
in order to allow them to be run on FreeBSD.  The high level goal
is to provide compatibility wrappers whenever possible to minimize
changes to individual test cases.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9692
This commit is contained in:
Matthew Macy
2019-12-18 12:29:43 -08:00
committed by Brian Behlendorf
parent 118fc3ef07
commit 7839c4b5e1
145 changed files with 1723 additions and 573 deletions
+21 -2
View File
@@ -79,6 +79,8 @@ function block_device_wait
typeset local elapsed=$((SECONDS - start))
[[ $elapsed > 60 ]] && \
log_note udevadm settle time too long: $elapsed
elif is_freebsd; then
sleep 3
fi
}
@@ -94,6 +96,9 @@ function is_physical_device #device
[[ -b "$DEV_DSKDIR/$device" ]] && \
[[ -f /sys/module/loop/parameters/max_part ]]
return $?
elif is_freebsd; then
echo $device | grep -q -e '^a?da[0-9]*$' -e '^md[0-9]*$' > /dev/null 2>&1
return $?
else
echo $device | egrep "^c[0-F]+([td][0-F]+)+$" > /dev/null 2>&1
return $?
@@ -131,10 +136,17 @@ function is_loop_device #disk
}
#
# Linux:
# Check if the given device is a multipath device and if there is a symbolic
# link to a device mapper and to a disk
# Currently no support for dm devices alone without multipath
#
# FreeBSD:
# Check if the given device is a gmultipath device.
#
# Others:
# No multipath detection.
#
function is_mpath_device #disk
{
typeset disk=$1
@@ -149,6 +161,10 @@ function is_mpath_device #disk
else
return $?
fi
elif is_freebsd; then
test -b $DEV_MPATHDIR/$disk
else
false
fi
}
@@ -178,6 +194,9 @@ function set_slice_prefix
fi
(( i = i + 1))
done
elif is_freebsd; then
export SLICE_PREFIX="p"
return 0
fi
}
@@ -218,7 +237,7 @@ function get_device_dir #device
{
typeset device=$1
if ! $(is_physical_device $device) ; then
if ! is_freebsd && ! $(is_physical_device $device) ; then
if [[ $device != "/" ]]; then
device=${device%/*}
fi
@@ -459,7 +478,7 @@ function get_pool_devices #testpool #devdir
typeset devdir=$2
typeset out=""
if is_linux; then
if is_linux || is_freebsd; then
out=$(zpool status -P $testpool |grep ${devdir} | awk '{print $1}')
out=$(echo $out | sed -e "s|${devdir}/||g" | tr '\n' ' ')
fi
+50 -34
View File
@@ -8,22 +8,17 @@
# Please keep the contents of each variable sorted for ease of reading
# and maintenance.
#
export SYSTEM_FILES='arp
export SYSTEM_FILES_COMMON='arp
awk
attr
base64
basename
bc
blkid
blockdev
bunzip2
bzcat
cat
chattr
chgrp
chmod
chown
cksum
cmp
cp
cpio
@@ -37,11 +32,8 @@ export SYSTEM_FILES='arp
du
echo
egrep
exportfs
expr
fallocate
false
fdisk
file
find
fio
@@ -49,15 +41,10 @@ export SYSTEM_FILES='arp
getconf
getent
getfacl
getfattr
grep
groupadd
groupdel
groupmod
gunzip
gzip
head
hostid
hostname
id
iostat
@@ -65,29 +52,16 @@ export SYSTEM_FILES='arp
ksh
ln
logname
losetup
ls
lsattr
lsblk
lscpu
lsmod
lsscsi
md5sum
mkdir
mknod
mkswap
mktemp
modprobe
mount
mpstat
mv
net
nproc
od
openssl
parted
pax
perf
pgrep
ping
pkill
@@ -105,11 +79,8 @@ export SYSTEM_FILES='arp
scp
sed
seq
setenforce
setfacl
setfattr
sh
sha256sum
shuf
sleep
sort
@@ -130,13 +101,9 @@ export SYSTEM_FILES='arp
tr
true
truncate
udevadm
umask
umount
uname
useradd
userdel
usermod
uuidgen
vmstat
wait
@@ -144,6 +111,55 @@ export SYSTEM_FILES='arp
which
xargs'
export SYSTEM_FILES_FREEBSD='chflags
compress
dumpon
fsck
gpart
md5
mdconfig
mkfifo
newfs
pw
sha256
swapctl
sysctl
uncompress'
export SYSTEM_FILES_LINUX='attr
blkid
blockdev
chattr
cksum
exportfs
fallocate
fdisk
getfattr
groupadd
groupdel
groupmod
hostid
losetup
lsattr
lsblk
lscpu
lsmod
lsscsi
md5sum
mkswap
modprobe
mpstat
nproc
parted
perf
setenforce
setfattr
sha256sum
udevadm
useradd
userdel
usermod'
export ZFS_FILES='zdb
zfs
zhack
+15 -1
View File
@@ -143,7 +143,7 @@ export SPA_MINDEVSIZE=$((64 * 1024 * 1024))
# For iscsi target support
export ISCSITGTFILE=/tmp/iscsitgt_file
export ISCSITGT_FMRI=svc:/system/iscsitgt:default
if ! is_linux; then
if ! is_linux && ! is_freebsd; then
export AUTO_SNAP=$(svcs -a | grep auto-snapshot | grep online | awk \
'{print $3}')
fi
@@ -184,6 +184,20 @@ if is_linux; then
NEWFS_DEFAULT_FS="ext2"
elif is_freebsd; then
unpack_opts="xv"
pack_opts="cf"
verbose="v"
unpack_preserve="xpf"
pack_preserve="cpf"
ZVOL_DEVDIR="/dev/zvol"
ZVOL_RDEVDIR="/dev/zvol"
DEV_DSKDIR="/dev"
DEV_RDSKDIR="/dev"
DEV_MPATHDIR="/dev/multipath"
NEWFS_DEFAULT_FS="ufs"
else
unpack_opts="xv"
pack_opts="cf"
+439 -103
View File
@@ -92,6 +92,19 @@ function is_linux
fi
}
# Determine if this is a FreeBSD test system
#
# Return 0 if platform FreeBSD, 1 if otherwise
function is_freebsd
{
if [[ $(uname -o) == "FreeBSD" ]]; then
return 0
else
return 1
fi
}
# Determine if this is a 32-bit system
#
# Return 0 if platform is 32-bit, 1 if otherwise
@@ -144,17 +157,23 @@ function ismounted
fi
;;
ufs|nfs)
out=$(df -F $fstype $1 2>/dev/null)
ret=$?
(($ret != 0)) && return $ret
if is_freebsd; then
mount -pt $fstype | while read dev dir _t _flags; do
[[ "$1" == "$dev" || "$1" == "$dir" ]] && return 0
done
else
out=$(df -F $fstype $1 2>/dev/null)
ret=$?
(($ret != 0)) && return $ret
dir=${out%%\(*}
dir=${dir%% *}
name=${out##*\(}
name=${name%%\)*}
name=${name%% *}
dir=${out%%\(*}
dir=${dir%% *}
name=${out##*\(}
name=${name%%\)*}
name=${name%% *}
[[ "$1" == "$dir" || "$1" == "$name" ]] && return 0
[[ "$1" == "$dir" || "$1" == "$name" ]] && return 0
fi
;;
ext*)
out=$(df -t $fstype $1 2>/dev/null)
@@ -881,7 +900,8 @@ function set_partition
typeset size=$3
typeset disk=$4
if is_linux; then
case "$(uname)" in
Linux)
if [[ -z $size || -z $disk ]]; then
log_fail "The size or disk name is unspecified."
fi
@@ -928,7 +948,36 @@ function set_partition
blockdev --rereadpt $disk 2>/dev/null
block_device_wait $disk
else
;;
FreeBSD)
if [[ -z $size || -z $disk ]]; then
log_fail "The size or disk name is unspecified."
fi
[[ -n $DEV_DSKDIR ]] && disk=$DEV_DSKDIR/$disk
if [[ $slicenum -eq 0 ]] || ! gpart show $disk >/dev/null 2>&1; then
gpart destroy -F $disk >/dev/null 2>&1
gpart create -s GPT $disk
if [[ $? -ne 0 ]]; then
log_note "Failed to create GPT partition table on $disk"
return 1
fi
fi
typeset index=$((slicenum + 1))
if [[ -n $start ]]; then
start="-b $start"
fi
gpart add -t freebsd-zfs $start -s $size -i $index $disk
if [[ $ret_val -ne 0 ]]; then
log_note "Failed to create partition $slicenum on $disk"
return 1
fi
block_device_wait $disk
;;
*)
if [[ -z $slicenum || -z $size || -z $disk ]]; then
log_fail "The slice, size or disk name is unspecified."
fi
@@ -949,7 +998,8 @@ function set_partition
format -e -s -d $disk -f $format_file
typeset ret_val=$?
rm -f $format_file
fi
;;
esac
if [[ $ret_val -ne 0 ]]; then
log_note "Unable to format $disk slice $slicenum to $size"
@@ -984,6 +1034,14 @@ function delete_partitions
fi
done
done
elif is_freebsd; then
for disk in $DISKSARRAY; do
if gpart destroy -F $disk; then
log_note "Partitions for ${disk} deleted"
else
log_fail "Partitions for ${disk} not deleted"
fi
done
fi
}
@@ -998,13 +1056,22 @@ function get_endslice #<disk> <slice>
log_fail "The disk name or slice number is unspecified."
fi
if is_linux; then
case "$(uname)" in
Linux)
endcyl=$(parted -s $DEV_DSKDIR/$disk -- unit cyl print | \
grep "part${slice}" | \
awk '{print $3}' | \
sed 's,cyl,,')
((endcyl = (endcyl + 1)))
else
;;
FreeBSD)
disk=${disk#/dev/zvol/}
disk=${disk%p*}
slice=$((slice + 1))
endcyl=$(gpart show $disk | \
awk -v slice=$slice '$3 == slice { print $1 + $2 }')
;;
*)
disk=${disk#/dev/dsk/}
disk=${disk#/dev/rdsk/}
disk=${disk%s*}
@@ -1022,7 +1089,8 @@ function get_endslice #<disk> <slice>
nawk -v token="$slice" '{if ($1==token) print $6}')
((endcyl = (endcyl + 1) / ratio))
fi
;;
esac
echo $endcyl
}
@@ -1441,7 +1509,7 @@ function setup_nfs_server
return
fi
if is_linux; then
if is_linux || is_freebsd; then
#
# Re-synchronize /var/lib/nfs/etab with /etc/exports and
# /etc/exports.d./* to provide a clean test environment.
@@ -1497,7 +1565,7 @@ function setup_nfs_server
#
function is_global_zone
{
if is_linux; then
if is_linux || is_freebsd; then
return 0
else
typeset cur_zone=$(zonename 2>/dev/null)
@@ -2244,7 +2312,7 @@ function cleanup_devices #vdevs
function find_disks
{
# Trust provided list, no attempt is made to locate unused devices.
if is_linux; then
if is_linux || is_freebsd; then
echo "$@"
return
fi
@@ -2325,6 +2393,224 @@ EOF
echo $unused
}
function add_user_freebsd #<group_name> <user_name> <basedir>
{
typeset group=$1
typeset user=$2
typeset basedir=$3
# Check to see if the user exists.
if id $user > /dev/null 2>&1; then
return 0
fi
# Assign 1000 as the base uid
typeset -i uid=1000
while true; do
typeset -i ret
pw useradd -u $uid -g $group -d $basedir/$user -m -n $user
ret=$?
case $ret in
0) break ;;
# The uid is not unique
65) ((uid += 1)) ;;
*) return 1 ;;
esac
if [[ $uid == 65000 ]]; then
log_fail "No user id available under 65000 for $user"
fi
done
# Silence MOTD
touch $basedir/$user/.hushlogin
return 0
}
#
# Delete the specified user.
#
# $1 login name
#
function del_user_freebsd #<logname>
{
typeset user=$1
if id $user > /dev/null 2>&1; then
log_must pw userdel $user
fi
return 0
}
#
# Select valid gid and create specified group.
#
# $1 group name
#
function add_group_freebsd #<group_name>
{
typeset group=$1
# See if the group already exists.
if pw groupshow $group >/dev/null 2>&1; then
return 0
fi
# Assign 1000 as the base gid
typeset -i gid=1000
while true; do
pw groupadd -g $gid -n $group > /dev/null 2>&1
typeset -i ret=$?
case $ret in
0) return 0 ;;
# The gid is not unique
65) ((gid += 1)) ;;
*) return 1 ;;
esac
if [[ $gid == 65000 ]]; then
log_fail "No user id available under 65000 for $group"
fi
done
}
#
# Delete the specified group.
#
# $1 group name
#
function del_group_freebsd #<group_name>
{
typeset group=$1
pw groupdel -n $group > /dev/null 2>&1
typeset -i ret=$?
case $ret in
# Group does not exist, or was deleted successfully.
0|6|65) return 0 ;;
# Name already exists as a group name
9) log_must pw groupdel $group ;;
*) return 1 ;;
esac
return 0
}
function add_user_illumos #<group_name> <user_name> <basedir>
{
typeset group=$1
typeset user=$2
typeset basedir=$3
log_must useradd -g $group -d $basedir/$user -m $user
return 0
}
function del_user_illumos #<user_name>
{
typeset user=$1
if id $user > /dev/null 2>&1; then
log_must_retry "currently used" 6 userdel $user
fi
return 0
}
function add_group_illumos #<group_name>
{
typeset group=$1
typeset -i gid=100
while true; do
groupadd -g $gid $group > /dev/null 2>&1
typeset -i ret=$?
case $ret in
0) return 0 ;;
# The gid is not unique
4) ((gid += 1)) ;;
*) return 1 ;;
esac
done
}
function del_group_illumos #<group_name>
{
typeset group=$1
groupmod -n $grp $grp > /dev/null 2>&1
typeset -i ret=$?
case $ret in
# Group does not exist.
6) return 0 ;;
# Name already exists as a group name
9) log_must groupdel $grp ;;
*) return 1 ;;
esac
}
function add_user_linux #<group_name> <user_name> <basedir>
{
typeset group=$1
typeset user=$2
typeset basedir=$3
log_must useradd -g $group -d $basedir/$user -m $user
# Add new users to the same group and the command line utils.
# This allows them to be run out of the original users home
# directory as long as it permissioned to be group readable.
cmd_group=$(stat --format="%G" $(which zfs))
log_must usermod -a -G $cmd_group $user
return 0
}
function del_user_linux #<user_name>
{
typeset user=$1
if id $user > /dev/null 2>&1; then
log_must_retry "currently used" 6 userdel $user
fi
return 0
}
function add_group_linux #<group_name>
{
typeset group=$1
# Assign 100 as the base gid, a larger value is selected for
# Linux because for many distributions 1000 and under are reserved.
while true; do
groupadd $group > /dev/null 2>&1
typeset -i ret=$?
case $ret in
0) return 0 ;;
*) return 1 ;;
esac
done
}
function del_group_linux #<group_name>
{
typeset group=$1
getent group $group > /dev/null 2>&1
typeset -i ret=$?
case $ret in
# Group does not exist.
2) return 0 ;;
# Name already exists as a group name
0) log_must groupdel $group ;;
*) return 1 ;;
esac
return 0
}
#
# Add specified user to specified group
#
@@ -2334,26 +2620,29 @@ EOF
#
function add_user #<group_name> <user_name> <basedir>
{
typeset gname=$1
typeset uname=$2
typeset group=$1
typeset user=$2
typeset basedir=${3:-"/var/tmp"}
if ((${#gname} == 0 || ${#uname} == 0)); then
if ((${#group} == 0 || ${#user} == 0)); then
log_fail "group name or user name are not defined."
fi
log_must useradd -g $gname -d $basedir/$uname -m $uname
echo "export PATH=\"$STF_PATH\"" >>$basedir/$uname/.profile
echo "export PATH=\"$STF_PATH\"" >>$basedir/$uname/.bash_profile
echo "export PATH=\"$STF_PATH\"" >>$basedir/$uname/.login
case $(uname) in
FreeBSD)
add_user_freebsd "$group" "$user" "$basedir"
;;
Linux)
add_user_linux "$group" "$user" "$basedir"
;;
*)
add_user_illumos "$group" "$user" "$basedir"
;;
esac
# Add new users to the same group and the command line utils.
# This allows them to be run out of the original users home
# directory as long as it permissioned to be group readable.
if is_linux; then
cmd_group=$(stat --format="%G" $(which zfs))
log_must usermod -a -G $cmd_group $uname
fi
echo "export PATH=\"$STF_PATH\"" >>$basedir/$user/.profile
echo "export PATH=\"$STF_PATH\"" >>$basedir/$user/.bash_profile
echo "export PATH=\"$STF_PATH\"" >>$basedir/$user/.login
return 0
}
@@ -2373,9 +2662,17 @@ function del_user #<logname> <basedir>
log_fail "login name is necessary."
fi
if id $user > /dev/null 2>&1; then
log_must_retry "currently used" 6 userdel $user
fi
case $(uname) in
FreeBSD)
del_user_freebsd "$user"
;;
Linux)
del_user_linux "$user"
;;
*)
del_user_illumos "$user"
;;
esac
[[ -d $basedir/$user ]] && rm -fr $basedir/$user
@@ -2395,30 +2692,19 @@ function add_group #<group_name>
log_fail "group name is necessary."
fi
# Assign 100 as the base gid, a larger value is selected for
# Linux because for many distributions 1000 and under are reserved.
if is_linux; then
while true; do
groupadd $group > /dev/null 2>&1
typeset -i ret=$?
case $ret in
0) return 0 ;;
*) return 1 ;;
esac
done
else
typeset -i gid=100
while true; do
groupadd -g $gid $group > /dev/null 2>&1
typeset -i ret=$?
case $ret in
0) return 0 ;;
# The gid is not unique
4) ((gid += 1)) ;;
*) return 1 ;;
esac
done
fi
case $(uname) in
FreeBSD)
add_group_freebsd "$group"
;;
Linux)
add_group_linux "$group"
;;
*)
add_group_illumos "$group"
;;
esac
return 0
}
#
@@ -2428,32 +2714,23 @@ function add_group #<group_name>
#
function del_group #<group_name>
{
typeset grp=$1
if ((${#grp} == 0)); then
typeset group=$1
if ((${#group} == 0)); then
log_fail "group name is necessary."
fi
if is_linux; then
getent group $grp > /dev/null 2>&1
typeset -i ret=$?
case $ret in
# Group does not exist.
2) return 0 ;;
# Name already exists as a group name
0) log_must groupdel $grp ;;
*) return 1 ;;
esac
else
groupmod -n $grp $grp > /dev/null 2>&1
typeset -i ret=$?
case $ret in
# Group does not exist.
6) return 0 ;;
# Name already exists as a group name
9) log_must groupdel $grp ;;
*) return 1 ;;
esac
fi
case $(uname) in
FreeBSD)
del_group_freebsd "$group"
;;
Linux)
del_group_linux "$group"
;;
*)
del_group_illumos "$group"
;;
esac
return 0
}
@@ -2800,7 +3077,7 @@ function labelvtoc
typeset label_file=/var/tmp/labelvtoc.$$
typeset arch=$(uname -p)
if is_linux; then
if is_linux || is_freebsd; then
log_note "Currently unsupported by the test framework"
return 1
fi
@@ -2858,7 +3135,9 @@ function get_rootfs
{
typeset rootfs=""
if ! is_linux; then
if is_freebsd; then
rootfs=$(mount -p | awk '$2 == "/" && $3 == "zfs" {print $1}')
elif ! is_linux; then
rootfs=$(awk '{if ($2 == "/" && $3 == "zfs") print $1}' \
/etc/mnttab)
fi
@@ -2883,7 +3162,9 @@ function get_rootpool
typeset rootfs=""
typeset rootpool=""
if ! is_linux; then
if is_freebsd; then
rootfs=$(mount -p | awk '$2 == "/" && $3 == "zfs" {print $1}')
elif ! is_linux; then
rootfs=$(awk '{if ($2 == "/" && $3 =="zfs") print $1}' \
/etc/mnttab)
fi
@@ -2892,23 +3173,12 @@ function get_rootpool
fi
zfs list $rootfs > /dev/null 2>&1
if (($? == 0)); then
rootpool=`echo $rootfs | awk -F\/ '{print $1}'`
echo $rootpool
echo ${rootfs%%/*}
else
log_fail "This is not a zfsroot system."
fi
}
#
# Get the package name
#
function get_package_name
{
typeset dirpath=${1:-$STC_NAME}
echo "SUNWstc-${dirpath}" | /usr/bin/sed -e "s/\//-/g"
}
#
# Get the word numbers from a string separated by white space
#
@@ -2971,6 +3241,8 @@ function is_mp
{
if is_linux; then
(($(nproc) > 1))
elif is_freebsd; then
sysctl -n kern.smp.cpus
else
(($(psrinfo | wc -l) > 1))
fi
@@ -2982,6 +3254,8 @@ function get_cpu_freq
{
if is_linux; then
lscpu | awk '/CPU MHz/ { print $3 }'
elif is_freebsd; then
cat /var/run/dmesg.boot | grep '^CPU:' | cut -d '(' -f 2 | cut -d ')' -f 1
else
psrinfo -v 0 | awk '/processor operates at/ {print $6}'
fi
@@ -2994,8 +3268,13 @@ function user_run
shift
log_note "user:$user $@"
eval su - \$user -c \"$@\" > $TEST_BASE_DIR/out 2>$TEST_BASE_DIR/err
return $?
if is_freebsd; then
eval "su \$user -c \"$@\"" > $TEST_BASE_DIR/out 2>$TEST_BASE_DIR/err
return $?
else
eval su - \$user -c \"$@\" > $TEST_BASE_DIR/out 2>$TEST_BASE_DIR/err
return $?
fi
}
#
@@ -3121,7 +3400,11 @@ function get_objnum
typeset objnum
[[ -e $pathname ]] || log_fail "No such file or directory: $pathname"
objnum=$(stat -c %i $pathname)
if is_freebsd; then
objnum=$(stat -f "%i" $pathname)
else
objnum=$(stat -c %i $pathname)
fi
echo $objnum
}
@@ -3214,7 +3497,7 @@ function zed_rc_restore
function zed_setup
{
if ! is_linux; then
return
log_unsupported "No zed on $(uname)"
fi
if [[ ! -d $ZEDLET_DIR ]]; then
@@ -3376,6 +3659,8 @@ function is_swap_inuse
if is_linux; then
swapon -s | grep -w $(readlink -f $device) > /dev/null 2>&1
elif is_freebsd; then
swapctl -l | grep -w $device
else
swap -l | grep -w $device > /dev/null 2>&1
fi
@@ -3393,6 +3678,8 @@ function swap_setup
if is_linux; then
log_must eval "mkswap $swapdev > /dev/null 2>&1"
log_must swapon $swapdev
elif is_freebsd; then
log_must swapctl -a $swapdev
else
log_must swap -a $swapdev
fi
@@ -3410,6 +3697,8 @@ function swap_cleanup
if is_swap_inuse $swapdev; then
if is_linux; then
log_must swapoff $swapdev
elif is_freebsd; then
log_must swapoff $swapdev
else
log_must swap -d $swapdev
fi
@@ -3458,6 +3747,10 @@ function set_tunable_impl
cat >"$zfs_tunables/$tunable" <<<"$value"
return $?
;;
FreeBSD)
sysctl vfs.zfs.$tunable=$value
return "$?"
;;
SunOS)
[[ "$module" -eq "zfs" ]] || return 1
echo "${tunable}/${mdb_cmd}0t${value}" | mdb -kw
@@ -3490,6 +3783,9 @@ function get_tunable_impl
cat $zfs_tunables/$tunable
return $?
;;
FreeBSD)
sysctl -n vfs.zfs.$tunable
;;
SunOS)
[[ "$module" -eq "zfs" ]] || return 1
;;
@@ -3567,7 +3863,14 @@ function md5digest
{
typeset file=$1
md5sum -b $file | awk '{ print $1 }'
case $(uname) in
FreeBSD)
md5 -q $file
;;
*)
md5sum -b $file | awk '{ print $1 }'
;;
esac
}
#
@@ -3578,5 +3881,38 @@ function sha256digest
{
typeset file=$1
sha256sum -b $file | awk '{ print $1 }'
case $(uname) in
FreeBSD)
sha256 -q $file
;;
*)
sha256sum -b $file | awk '{ print $1 }'
;;
esac
}
function new_fs #<args>
{
case $(uname) in
FreeBSD)
newfs "$@"
;;
*)
echo y | newfs -v "$@"
;;
esac
}
function stat_size #<path>
{
typeset path=$1
case $(uname) in
FreeBSD)
stat -f %z "$path"
;;
*)
stat -c %s "$path"
;;
esac
}
+7 -2
View File
@@ -80,8 +80,13 @@ function get_rand_large_recsize
#
# Functions to toggle on/off properties
#
typeset -a binary_props=('atime' 'devices' 'exec' 'readonly' 'setuid' 'xattr'
'zoned')
typeset -a binary_props=('atime' 'devices' 'exec' 'readonly' 'setuid' 'xattr')
if is_freebsd; then
binary_props+=('jailed')
else
binary_props+=('zoned')
fi
if is_linux; then
# Only older kernels support non-blocking mandatory locks