xref: /illumos-gate/usr/src/lib/libshare/nfs/libshare_nfs.h (revision 6764e83b0a0199b8aa37e222a7c92e92c1d44f90)
1549ec3ffSdougm /*
2549ec3ffSdougm  * CDDL HEADER START
3549ec3ffSdougm  *
4549ec3ffSdougm  * The contents of this file are subject to the terms of the
5549ec3ffSdougm  * Common Development and Distribution License (the "License").
6549ec3ffSdougm  * You may not use this file except in compliance with the License.
7549ec3ffSdougm  *
8549ec3ffSdougm  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9549ec3ffSdougm  * or http://www.opensolaris.org/os/licensing.
10549ec3ffSdougm  * See the License for the specific language governing permissions
11549ec3ffSdougm  * and limitations under the License.
12549ec3ffSdougm  *
13549ec3ffSdougm  * When distributing Covered Code, include this CDDL HEADER in each
14549ec3ffSdougm  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15549ec3ffSdougm  * If applicable, add the following below this CDDL HEADER, with the
16549ec3ffSdougm  * fields enclosed by brackets "[]" replaced with your own identifying
17549ec3ffSdougm  * information: Portions Copyright [yyyy] [name of copyright owner]
18549ec3ffSdougm  *
19549ec3ffSdougm  * CDDL HEADER END
20549ec3ffSdougm  */
21549ec3ffSdougm 
22549ec3ffSdougm /*
232f172c55SRobert Thurlow  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24549ec3ffSdougm  * Use is subject to license terms.
25549ec3ffSdougm  */
26549ec3ffSdougm 
27549ec3ffSdougm /*
28549ec3ffSdougm  * basic API declarations for share management
29549ec3ffSdougm  */
30549ec3ffSdougm 
31549ec3ffSdougm #ifndef _LIBSHARE_NFS_H
32549ec3ffSdougm #define	_LIBSHARE_NFS_H
33549ec3ffSdougm 
34549ec3ffSdougm #ifdef	__cplusplus
35549ec3ffSdougm extern "C" {
36549ec3ffSdougm #endif
37549ec3ffSdougm 
38549ec3ffSdougm /* property names used by NFS */
39549ec3ffSdougm #define	SHOPT_RO	"ro"
40549ec3ffSdougm #define	SHOPT_RW	"rw"
41b89a8333Snatalie li - Sun Microsystems - Irvine United States #define	SHOPT_NONE	"none"
42b89a8333Snatalie li - Sun Microsystems - Irvine United States #define	SHOPT_ROOT_MAPPING	"root_mapping"
43549ec3ffSdougm 
44549ec3ffSdougm #define	SHOPT_SEC	"sec"
45549ec3ffSdougm #define	SHOPT_SECURE	"secure"
46549ec3ffSdougm #define	SHOPT_ROOT	"root"
47549ec3ffSdougm #define	SHOPT_ANON	"anon"
48549ec3ffSdougm #define	SHOPT_WINDOW	"window"
49549ec3ffSdougm #define	SHOPT_NOSUB	"nosub"
50549ec3ffSdougm #define	SHOPT_NOSUID	"nosuid"
51549ec3ffSdougm #define	SHOPT_ACLOK	"aclok"
52549ec3ffSdougm #define	SHOPT_PUBLIC	"public"
53549ec3ffSdougm #define	SHOPT_INDEX	"index"
54549ec3ffSdougm #define	SHOPT_LOG	"log"
55549ec3ffSdougm #define	SHOPT_CKSUM	"cksum"
56*6764e83bSVallish Vaidyeshwara #define	SHOPT_NOACLFAB	"noaclfab"
57549ec3ffSdougm 
58549ec3ffSdougm /*
59549ec3ffSdougm  * defined options types. These should be in a file rather than
60549ec3ffSdougm  * compiled in. Until there is a plugin mechanism to add new types,
61549ec3ffSdougm  * this is sufficient.
62549ec3ffSdougm  */
63549ec3ffSdougm #define	OPT_TYPE_ANY		0
64549ec3ffSdougm #define	OPT_TYPE_STRING		1
65549ec3ffSdougm #define	OPT_TYPE_BOOLEAN	2
66549ec3ffSdougm #define	OPT_TYPE_NUMBER		3
67549ec3ffSdougm #define	OPT_TYPE_RANGE		4
68549ec3ffSdougm #define	OPT_TYPE_USER		5
69549ec3ffSdougm #define	OPT_TYPE_ACCLIST	6
70549ec3ffSdougm #define	OPT_TYPE_DEPRECATED	7
71549ec3ffSdougm #define	OPT_TYPE_SECURITY	8
72549ec3ffSdougm #define	OPT_TYPE_PATH		9
73549ec3ffSdougm #define	OPT_TYPE_FILE		10
74549ec3ffSdougm #define	OPT_TYPE_LOGTAG		11
75549ec3ffSdougm #define	OPT_TYPE_STRINGSET	12
76549ec3ffSdougm #define	OPT_TYPE_DOMAIN		13
77549ec3ffSdougm #define	OPT_TYPE_ONOFF		14
78549ec3ffSdougm #define	OPT_TYPE_PROTOCOL	15
79549ec3ffSdougm 
80549ec3ffSdougm #define	OPT_SHARE_ONLY		1
81549ec3ffSdougm 
82549ec3ffSdougm struct option_defs {
83549ec3ffSdougm 	char *tag;
84549ec3ffSdougm 	int index;
85549ec3ffSdougm 	int type;
86549ec3ffSdougm 	int share;	/* share only option */
87687915e9Sdougm 	int (*check)(sa_handle_t, char *);
88549ec3ffSdougm };
89549ec3ffSdougm 
90549ec3ffSdougm /*
91549ec3ffSdougm  * service bit mask values
92549ec3ffSdougm  */
93549ec3ffSdougm #define	SVC_LOCKD	0x0001
94549ec3ffSdougm #define	SVC_STATD	0x0002
95549ec3ffSdougm #define	SVC_NFSD	0x0004
96549ec3ffSdougm #define	SVC_MOUNTD	0x0008
97549ec3ffSdougm #define	SVC_NFS4CBD	0x0010
98549ec3ffSdougm #define	SVC_NFSMAPID	0x0020
99549ec3ffSdougm #define	SVC_RQUOTAD	0x0040
100549ec3ffSdougm #define	SVC_NFSLOGD	0x0080
1012f172c55SRobert Thurlow #define	SVC_REPARSED	0x0100
102549ec3ffSdougm 
103549ec3ffSdougm /*
104549ec3ffSdougm  * place holder for future service -- will move to daemon_utils.h when
105549ec3ffSdougm  * fully implemented.
106549ec3ffSdougm  */
107549ec3ffSdougm #define	NFSLOGD	"svc:/network/nfs/log:default"
108549ec3ffSdougm 
109549ec3ffSdougm /* The NFS export structure flags for read/write modes */
110549ec3ffSdougm #define	NFS_RWMODES	(M_RO|M_ROL|M_RW|M_RWL)
111549ec3ffSdougm 
112549ec3ffSdougm /* other values */
113549ec3ffSdougm /* max size of 64-bit integer in digits plus a bit extra */
114549ec3ffSdougm #define	MAXDIGITS	32
115549ec3ffSdougm 
116549ec3ffSdougm /* external variable */
117549ec3ffSdougm extern boolean_t nfsl_errs_to_syslog;
118549ec3ffSdougm 
119549ec3ffSdougm /* imported functions */
120549ec3ffSdougm extern int exportfs(char *, struct exportdata *);
121549ec3ffSdougm extern void _check_services(char **);
122549ec3ffSdougm extern int nfs_getseconfig_default(seconfig_t *);
123549ec3ffSdougm extern int nfs_getseconfig_byname(char *, seconfig_t *);
124549ec3ffSdougm extern bool_t nfs_get_root_principal(seconfig_t *, char *, caddr_t *);
125549ec3ffSdougm extern int nfsl_getconfig_list(nfsl_config_t **);
126549ec3ffSdougm extern void nfsl_freeconfig_list(nfsl_config_t **);
127549ec3ffSdougm extern nfsl_config_t *nfsl_findconfig(nfsl_config_t *, char *, int *);
128549ec3ffSdougm 
129549ec3ffSdougm #ifdef	__cplusplus
130549ec3ffSdougm }
131549ec3ffSdougm #endif
132549ec3ffSdougm 
133549ec3ffSdougm #endif /* _LIBSHARE_NFS_H */
134