xref: /titanic_41/usr/src/lib/libshare/nfs/libshare_nfs.h (revision 4209bc2097a959d7ddabb51581682e4565885eed)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * basic API declarations for share management
29  */
30 
31 #ifndef _LIBSHARE_NFS_H
32 #define	_LIBSHARE_NFS_H
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /* property names used by NFS */
39 #define	SHOPT_RO	"ro"
40 #define	SHOPT_RW	"rw"
41 #define	SHOPT_NONE	"none"
42 #define	SHOPT_ROOT_MAPPING	"root_mapping"
43 
44 #define	SHOPT_SEC	"sec"
45 #define	SHOPT_SECURE	"secure"
46 #define	SHOPT_ROOT	"root"
47 #define	SHOPT_ANON	"anon"
48 #define	SHOPT_WINDOW	"window"
49 #define	SHOPT_NOSUB	"nosub"
50 #define	SHOPT_NOSUID	"nosuid"
51 #define	SHOPT_ACLOK	"aclok"
52 #define	SHOPT_PUBLIC	"public"
53 #define	SHOPT_INDEX	"index"
54 #define	SHOPT_LOG	"log"
55 #define	SHOPT_CKSUM	"cksum"
56 #define	SHOPT_NOACLFAB	"noaclfab"
57 
58 /*
59  * defined options types. These should be in a file rather than
60  * compiled in. Until there is a plugin mechanism to add new types,
61  * this is sufficient.
62  */
63 #define	OPT_TYPE_ANY		0
64 #define	OPT_TYPE_STRING		1
65 #define	OPT_TYPE_BOOLEAN	2
66 #define	OPT_TYPE_NUMBER		3
67 #define	OPT_TYPE_RANGE		4
68 #define	OPT_TYPE_USER		5
69 #define	OPT_TYPE_ACCLIST	6
70 #define	OPT_TYPE_DEPRECATED	7
71 #define	OPT_TYPE_SECURITY	8
72 #define	OPT_TYPE_PATH		9
73 #define	OPT_TYPE_FILE		10
74 #define	OPT_TYPE_LOGTAG		11
75 #define	OPT_TYPE_STRINGSET	12
76 #define	OPT_TYPE_DOMAIN		13
77 #define	OPT_TYPE_ONOFF		14
78 #define	OPT_TYPE_PROTOCOL	15
79 
80 #define	OPT_SHARE_ONLY		1
81 
82 struct option_defs {
83 	char *tag;
84 	int index;
85 	int type;
86 	int share;	/* share only option */
87 	int (*check)(sa_handle_t, char *);
88 };
89 
90 /*
91  * service bit mask values
92  */
93 #define	SVC_LOCKD	0x0001
94 #define	SVC_STATD	0x0002
95 #define	SVC_NFSD	0x0004
96 #define	SVC_MOUNTD	0x0008
97 #define	SVC_NFS4CBD	0x0010
98 #define	SVC_NFSMAPID	0x0020
99 #define	SVC_RQUOTAD	0x0040
100 #define	SVC_NFSLOGD	0x0080
101 #define	SVC_REPARSED	0x0100
102 
103 /*
104  * place holder for future service -- will move to daemon_utils.h when
105  * fully implemented.
106  */
107 #define	NFSLOGD	"svc:/network/nfs/log:default"
108 
109 /* The NFS export structure flags for read/write modes */
110 #define	NFS_RWMODES	(M_RO|M_ROL|M_RW|M_RWL)
111 
112 /* other values */
113 /* max size of 64-bit integer in digits plus a bit extra */
114 #define	MAXDIGITS	32
115 
116 /* external variable */
117 extern boolean_t nfsl_errs_to_syslog;
118 
119 /* imported functions */
120 extern int exportfs(char *, struct exportdata *);
121 extern void _check_services(char **);
122 extern int nfs_getseconfig_default(seconfig_t *);
123 extern int nfs_getseconfig_byname(char *, seconfig_t *);
124 extern bool_t nfs_get_root_principal(seconfig_t *, char *, caddr_t *);
125 extern int nfsl_getconfig_list(nfsl_config_t **);
126 extern void nfsl_freeconfig_list(nfsl_config_t **);
127 extern nfsl_config_t *nfsl_findconfig(nfsl_config_t *, char *, int *);
128 
129 #ifdef	__cplusplus
130 }
131 #endif
132 
133 #endif /* _LIBSHARE_NFS_H */
134