xref: /illumos-gate/usr/src/lib/libshare/nfs/libshare_nfs.h (revision 687915e946710e354e302fa654bf53bf38b57cc6)
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 /*
23*687915e9Sdougm  * Copyright 2008 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35549ec3ffSdougm 
36549ec3ffSdougm #ifdef	__cplusplus
37549ec3ffSdougm extern "C" {
38549ec3ffSdougm #endif
39549ec3ffSdougm 
40549ec3ffSdougm /* property names used by NFS */
41549ec3ffSdougm #define	SHOPT_RO	"ro"
42549ec3ffSdougm #define	SHOPT_RW	"rw"
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"
56549ec3ffSdougm 
57549ec3ffSdougm /*
58549ec3ffSdougm  * defined options types. These should be in a file rather than
59549ec3ffSdougm  * compiled in. Until there is a plugin mechanism to add new types,
60549ec3ffSdougm  * this is sufficient.
61549ec3ffSdougm  */
62549ec3ffSdougm #define	OPT_TYPE_ANY		0
63549ec3ffSdougm #define	OPT_TYPE_STRING		1
64549ec3ffSdougm #define	OPT_TYPE_BOOLEAN	2
65549ec3ffSdougm #define	OPT_TYPE_NUMBER		3
66549ec3ffSdougm #define	OPT_TYPE_RANGE		4
67549ec3ffSdougm #define	OPT_TYPE_USER		5
68549ec3ffSdougm #define	OPT_TYPE_ACCLIST	6
69549ec3ffSdougm #define	OPT_TYPE_DEPRECATED	7
70549ec3ffSdougm #define	OPT_TYPE_SECURITY	8
71549ec3ffSdougm #define	OPT_TYPE_PATH		9
72549ec3ffSdougm #define	OPT_TYPE_FILE		10
73549ec3ffSdougm #define	OPT_TYPE_LOGTAG		11
74549ec3ffSdougm #define	OPT_TYPE_STRINGSET	12
75549ec3ffSdougm #define	OPT_TYPE_DOMAIN		13
76549ec3ffSdougm #define	OPT_TYPE_ONOFF		14
77549ec3ffSdougm #define	OPT_TYPE_PROTOCOL	15
78549ec3ffSdougm 
79549ec3ffSdougm #define	OPT_SHARE_ONLY		1
80549ec3ffSdougm 
81549ec3ffSdougm struct option_defs {
82549ec3ffSdougm 	char *tag;
83549ec3ffSdougm 	int index;
84549ec3ffSdougm 	int type;
85549ec3ffSdougm 	int share;	/* share only option */
86*687915e9Sdougm 	int (*check)(sa_handle_t, char *);
87549ec3ffSdougm };
88549ec3ffSdougm 
89549ec3ffSdougm /*
90549ec3ffSdougm  * service bit mask values
91549ec3ffSdougm  */
92549ec3ffSdougm #define	SVC_LOCKD	0x0001
93549ec3ffSdougm #define	SVC_STATD	0x0002
94549ec3ffSdougm #define	SVC_NFSD	0x0004
95549ec3ffSdougm #define	SVC_MOUNTD	0x0008
96549ec3ffSdougm #define	SVC_NFS4CBD	0x0010
97549ec3ffSdougm #define	SVC_NFSMAPID	0x0020
98549ec3ffSdougm #define	SVC_RQUOTAD	0x0040
99549ec3ffSdougm #define	SVC_NFSLOGD	0x0080
100549ec3ffSdougm 
101549ec3ffSdougm /*
102549ec3ffSdougm  * place holder for future service -- will move to daemon_utils.h when
103549ec3ffSdougm  * fully implemented.
104549ec3ffSdougm  */
105549ec3ffSdougm #define	NFSLOGD	"svc:/network/nfs/log:default"
106549ec3ffSdougm 
107549ec3ffSdougm /* The NFS export structure flags for read/write modes */
108549ec3ffSdougm #define	NFS_RWMODES	(M_RO|M_ROL|M_RW|M_RWL)
109549ec3ffSdougm 
110549ec3ffSdougm /* other values */
111549ec3ffSdougm /* max size of 64-bit integer in digits plus a bit extra */
112549ec3ffSdougm #define	MAXDIGITS	32
113549ec3ffSdougm 
114549ec3ffSdougm /* external variable */
115549ec3ffSdougm extern boolean_t nfsl_errs_to_syslog;
116549ec3ffSdougm 
117549ec3ffSdougm /* imported functions */
118549ec3ffSdougm extern int exportfs(char *, struct exportdata *);
119549ec3ffSdougm extern void _check_services(char **);
120549ec3ffSdougm extern int nfs_getseconfig_default(seconfig_t *);
121549ec3ffSdougm extern int nfs_getseconfig_byname(char *, seconfig_t *);
122549ec3ffSdougm extern bool_t nfs_get_root_principal(seconfig_t *, char *, caddr_t *);
123549ec3ffSdougm extern int nfsl_getconfig_list(nfsl_config_t **);
124549ec3ffSdougm extern void nfsl_freeconfig_list(nfsl_config_t **);
125549ec3ffSdougm extern nfsl_config_t *nfsl_findconfig(nfsl_config_t *, char *, int *);
126549ec3ffSdougm 
127549ec3ffSdougm #ifdef	__cplusplus
128549ec3ffSdougm }
129549ec3ffSdougm #endif
130549ec3ffSdougm 
131549ec3ffSdougm #endif /* _LIBSHARE_NFS_H */
132