xref: /illumos-gate/usr/src/lib/libshare/nfs/libshare_nfs.h (revision f7db5903887928b2b43995473632ef63d130bbd4)
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 /*
23b56bf881SAntonello Cruz  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
245cb0d679SMarcel Telka  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
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"
566764e83bSVallish Vaidyeshwara #define	SHOPT_NOACLFAB	"noaclfab"
575cb0d679SMarcel Telka #define	SHOPT_UIDMAP	"uidmap"
585cb0d679SMarcel Telka #define	SHOPT_GIDMAP	"gidmap"
59*f7db5903SVitaliy Gusev #define	SHOPT_NOHIDE	"nohide"
60549ec3ffSdougm 
61549ec3ffSdougm /*
62549ec3ffSdougm  * defined options types. These should be in a file rather than
63549ec3ffSdougm  * compiled in. Until there is a plugin mechanism to add new types,
64549ec3ffSdougm  * this is sufficient.
65549ec3ffSdougm  */
66549ec3ffSdougm #define	OPT_TYPE_ANY		0
67549ec3ffSdougm #define	OPT_TYPE_STRING		1
68549ec3ffSdougm #define	OPT_TYPE_BOOLEAN	2
69549ec3ffSdougm #define	OPT_TYPE_NUMBER		3
70549ec3ffSdougm #define	OPT_TYPE_RANGE		4
71549ec3ffSdougm #define	OPT_TYPE_USER		5
72549ec3ffSdougm #define	OPT_TYPE_ACCLIST	6
73549ec3ffSdougm #define	OPT_TYPE_DEPRECATED	7
74549ec3ffSdougm #define	OPT_TYPE_SECURITY	8
75549ec3ffSdougm #define	OPT_TYPE_PATH		9
76549ec3ffSdougm #define	OPT_TYPE_FILE		10
77549ec3ffSdougm #define	OPT_TYPE_LOGTAG		11
78549ec3ffSdougm #define	OPT_TYPE_STRINGSET	12
79549ec3ffSdougm #define	OPT_TYPE_DOMAIN		13
80549ec3ffSdougm #define	OPT_TYPE_ONOFF		14
81549ec3ffSdougm #define	OPT_TYPE_PROTOCOL	15
825cb0d679SMarcel Telka #define	OPT_TYPE_MAPPING	16
83549ec3ffSdougm 
84549ec3ffSdougm #define	OPT_SHARE_ONLY		1
85549ec3ffSdougm 
86549ec3ffSdougm struct option_defs {
87549ec3ffSdougm 	char *tag;
88549ec3ffSdougm 	int index;
89549ec3ffSdougm 	int type;
90549ec3ffSdougm 	int share;	/* share only option */
91687915e9Sdougm 	int (*check)(sa_handle_t, char *);
92549ec3ffSdougm };
93549ec3ffSdougm 
94549ec3ffSdougm /*
95549ec3ffSdougm  * service bit mask values
96549ec3ffSdougm  */
97549ec3ffSdougm #define	SVC_LOCKD	0x0001
98549ec3ffSdougm #define	SVC_STATD	0x0002
99549ec3ffSdougm #define	SVC_NFSD	0x0004
100549ec3ffSdougm #define	SVC_MOUNTD	0x0008
101549ec3ffSdougm #define	SVC_NFS4CBD	0x0010
102549ec3ffSdougm #define	SVC_NFSMAPID	0x0020
103549ec3ffSdougm #define	SVC_RQUOTAD	0x0040
104549ec3ffSdougm #define	SVC_NFSLOGD	0x0080
1052f172c55SRobert Thurlow #define	SVC_REPARSED	0x0100
106dd51520eSPavan Mettu - Oracle Corporation - Menlo Park United States #define	SVC_CLIENT	0x0200
107dd51520eSPavan Mettu - Oracle Corporation - Menlo Park United States 
108dd51520eSPavan Mettu - Oracle Corporation - Menlo Park United States /*
109dd51520eSPavan Mettu - Oracle Corporation - Menlo Park United States  * NFS Restart/Refresh options
110dd51520eSPavan Mettu - Oracle Corporation - Menlo Park United States  */
111dd51520eSPavan Mettu - Oracle Corporation - Menlo Park United States #define	NFSD_REFRESH		0x0001
112dd51520eSPavan Mettu - Oracle Corporation - Menlo Park United States #define	NFSD_RESTART		0x0002
113dd51520eSPavan Mettu - Oracle Corporation - Menlo Park United States #define	NLOCKMGR_REFESH		0x0003
114dd51520eSPavan Mettu - Oracle Corporation - Menlo Park United States #define	NLOCKMGR_RESTART	0x0004
115dd51520eSPavan Mettu - Oracle Corporation - Menlo Park United States #define	MAPID_REFRESH		0x0005
116dd51520eSPavan Mettu - Oracle Corporation - Menlo Park United States #define	MAPID_RESTART		0x0006
117549ec3ffSdougm 
118549ec3ffSdougm /*
119549ec3ffSdougm  * place holder for future service -- will move to daemon_utils.h when
120549ec3ffSdougm  * fully implemented.
121549ec3ffSdougm  */
122549ec3ffSdougm #define	NFSLOGD	"svc:/network/nfs/log:default"
123549ec3ffSdougm 
124549ec3ffSdougm /* The NFS export structure flags for read/write modes */
125549ec3ffSdougm #define	NFS_RWMODES	(M_RO|M_ROL|M_RW|M_RWL)
126549ec3ffSdougm 
127549ec3ffSdougm /* other values */
128549ec3ffSdougm /* max size of 64-bit integer in digits plus a bit extra */
129549ec3ffSdougm #define	MAXDIGITS	32
130549ec3ffSdougm 
131549ec3ffSdougm /* external variable */
132549ec3ffSdougm extern boolean_t nfsl_errs_to_syslog;
133549ec3ffSdougm 
134549ec3ffSdougm /* imported functions */
135549ec3ffSdougm extern int exportfs(char *, struct exportdata *);
136549ec3ffSdougm extern int nfs_getseconfig_default(seconfig_t *);
137549ec3ffSdougm extern int nfs_getseconfig_byname(char *, seconfig_t *);
138549ec3ffSdougm extern bool_t nfs_get_root_principal(seconfig_t *, char *, caddr_t *);
139549ec3ffSdougm extern int nfsl_getconfig_list(nfsl_config_t **);
140549ec3ffSdougm extern void nfsl_freeconfig_list(nfsl_config_t **);
141549ec3ffSdougm extern nfsl_config_t *nfsl_findconfig(nfsl_config_t *, char *, int *);
142549ec3ffSdougm 
143549ec3ffSdougm #ifdef	__cplusplus
144549ec3ffSdougm }
145549ec3ffSdougm #endif
146549ec3ffSdougm 
147549ec3ffSdougm #endif /* _LIBSHARE_NFS_H */
148