summaryrefslogtreecommitdiff
path: root/common/nfs
blob: a03eaf48e1c0cacbbb1efcc5e71726f30da85909 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#
# NFS specific common functions.
#

# given an NFS export and a NFS version number, return 0 if
# the mounted NFS is the given version. e.g.
# _is_nfs_version $SCRATCH_DEV 4.2
_is_nfs_version()
{
	local nfs_exp=$1
	local nfs_ver=$2
	_fs_options $1 | grep -q "vers=$2"
}

# require $TEST_DEV mounted as a given NFS version
# e.g. _require_test_nfs_version 4.2
_require_test_nfs_version()
{
	_require_test
	if ! _is_nfs_version $TEST_DEV $1; then
		_notrun "Test requires \$TEST_DEV mounted as NFSv$1"
	fi
}

# require $SCRATCH_DEV mounted as a given NFS version
# e.g. _require_scratch_nfs_version 4
_require_scratch_nfs_version()
{
	_require_scratch
	_scratch_mount
	if ! _is_nfs_version $SCRATCH_DEV $1; then
		_notrun "Test requires \$SCRATCH_DEV mounted as NFSv$1"
	fi
	_scratch_unmount
}