3 # Functions useful for quota tests
5 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms of version 2 of the GNU General Public License as
9 # published by the Free Software Foundation.
11 # This program is distributed in the hope that it would be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 # Further, this software is distributed without any warranty that it is
16 # free of the rightful claim of any third person regarding infringement
17 # or the like. Any license provided herein, whether implied or
18 # otherwise, applies only to this software file. Patent licenses, if
19 # any, provided herein do not apply to combinations of this program with
20 # other software, or any other product whatsoever.
22 # You should have received a copy of the GNU General Public License along
23 # with this program; if not, write the Free Software Foundation, Inc., 59
24 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
26 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 # Mountain View, CA 94043, or:
31 # For further information regarding this notice, see:
33 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
37 # checks that the XFS quota support in the kernel is enabled
38 # and that we have valid quota user tools installed.
42 src/feature -q $TEST_DEV
43 [ $? -ne 0 ] && _notrun "Installed kernel does not support XFS quota"
45 if [ "$HOSTOS" = "IRIX" ]; then
46 [ ! -x /usr/etc/quotaon ] && _notrun "Quota user tools not installed"
48 [ ! -x /sbin/quotaon ] && _notrun "Quota user tools not installed"
50 /sbin/quotaon -x 2>&1 | grep "option requires an argument -- x" >/dev/null
51 [ $? -ne 0 ] && _notrun "Installed quota tools do not support XFS"
55 # create a file as a specific user (uid)
56 # takes filename, id, type (u/g), blocksize, blockcount
60 [ $# != 5 ] && _notrun "broken call to _file_as_id in test $seq"
64 magik='$>' # perlspeak for effective uid
67 magik='$)' # perlspeak for effective gid
69 _notrun "broken type in call to _file_as_id in test $seq"
72 perl <<EOF >/dev/null 2>&1
75 exec "dd if=/dev/zero of=$1 bs=$4 count=$5";
77 # for debugging the above euid change, try... [need write in cwd]
78 # exec "dd if=/dev/zero of=$1 bs=$4 count=$5 >>$seq.full 2>&1";
83 perl -ne '@a = split(/:/); END { printf "id=%d name=%s\n", $a[2],$a[0] }' \
89 perl -ne '@a = split(/:/); END { printf "id=%d name=%s\n", $a[2],$a[0] }' \
96 s/^(\w+)\s+([-|+])/[NAME] \2/g;
97 s($SCRATCH_DEV)([DEVICE])g;
103 umount $SCRATCH_DEV >/dev/null 2>&1
104 _scratch_mount || _fail "qmount failed"
105 chmod ugo+rwx $SCRATCH_MNT
106 [ -x /usr/sbin/quot ] && quot $SCRATCH_MNT >>$seq.full 2>&1
109 # make sure this script returns success