xref: /freebsd/tests/sys/cddl/zfs/tests/acl/cifs/cifs.kshlib (revision b00ab754)
1# vim: filetype=sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22
23# $FreeBSD$
24
25#
26# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
27# Use is subject to license terms.
28#
29# ident	"@(#)cifs.kshlib	1.4	09/05/19 SMI"
30#
31
32. $STF_SUITE/include/libtest.kshlib
33
34function cifs_supported
35{
36     	if check_version "5.11" ; then
37		fs_prop_exist "sharesmb"
38		return $?
39	fi
40	return 1
41}
42
43#
44# Create a file or direcotry
45#
46# $1: The type specified, "file" or "dir"
47# $2: The given node name
48# $3: Owner of the node
49#
50function create_object
51{
52	typeset type=$1
53	typeset object=$2
54	typeset owner=$3
55
56	destroy_object $object
57
58	case $type in
59		dir)
60			$MKDIR -p $object
61			;;
62		file)
63			$ECHO "ZFS test suites" > $object
64			;;
65	esac
66
67	if [[ -n $owner ]]; then
68		$CHOWN $owner $object
69	fi
70	return 0
71}
72
73#
74# Destroy the given node(s)
75#
76# $@: The node(s) need to be destroyed
77#
78function destroy_object
79{
80	for object in $@ ; do
81		if [[ -e $object ]]; then
82
83			# clear_attribute is a common function name,
84			# but each case should have their own implement.
85			log_must clear_attribute $object
86			log_must $RM -rf $object
87		fi
88	done
89	return 0
90}
91
92