xref: /titanic_41/usr/src/uts/common/nfs/nfssys.h (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * 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  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 #ifndef	_NFS_NFSSYS_H
31 #define	_NFS_NFSSYS_H
32 
33 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * Private definitions for the nfssys system call.
41  * Note: <nfs/export.h> and <nfs/nfs.h> must be included before
42  * this file.
43  */
44 
45 /*
46  * Flavors of nfssys call.  Note that OLD_mumble commands are no longer
47  * implemented, but the entries are kept as placeholders for binary
48  * compatibility.
49  */
50 enum nfssys_op	{ OLD_NFS_SVC, OLD_ASYNC_DAEMON, EXPORTFS, NFS_GETFH,
51     OLD_NFS_CNVT, NFS_REVAUTH, OLD_NFS_FH_TO_FID, OLD_LM_SVC, KILL_LOCKMGR,
52     LOG_FLUSH, SVCPOOL_CREATE, NFS_SVC, LM_SVC, SVCPOOL_WAIT, SVCPOOL_RUN,
53     NFS4_SVC, RDMA_SVC_INIT, NFS4_CLR_STATE, NFS_IDMAP,
54     NFS_SVC_REQUEST_QUIESCE };
55 
56 struct nfs_svc_args {
57 	int		fd;		/* Connection endpoint */
58 	char		*netid;		/* Identify transport */
59 	struct netbuf	addrmask;	/* Address mask for host */
60 	int		versmin;	/* Min protocol version to offer */
61 	int		versmax;	/* Max protocol version to offer */
62 	int		delegation;	/* NFSv4 delegation on/off? */
63 };
64 
65 #ifdef _SYSCALL32
66 struct nfs_svc_args32 {
67 	int32_t		fd;		/* Connection endpoint */
68 	caddr32_t	netid;		/* Identify transport */
69 	struct netbuf32	addrmask;	/* Address mask for host */
70 	int32_t		versmin;	/* Min protocol version to offer */
71 	int32_t		versmax;	/* Max protocol version to offer */
72 	int32_t		delegation;	/* NFSv4 delegation on/off? */
73 };
74 #endif
75 
76 struct exportfs_args {
77 	char		*dname;
78 	struct exportdata *uex;
79 };
80 
81 #ifdef _SYSCALL32
82 struct exportfs_args32 {
83 	caddr32_t	dname;
84 	caddr32_t	uex;
85 };
86 #endif
87 
88 struct nfs_getfh_args {
89 	char		*fname;
90 	fhandle_t	*fhp;
91 };
92 
93 #ifdef _SYSCALL32
94 struct nfs_getfh_args32 {
95 	caddr32_t	fname;
96 	caddr32_t	fhp;
97 };
98 #endif
99 
100 struct nfs_revauth_args {
101 	int		authtype;
102 	uid_t		uid;
103 };
104 
105 #ifdef _SYSCALL32
106 struct nfs_revauth_args32 {
107 	int32_t		authtype;
108 	uid32_t		uid;
109 };
110 #endif
111 
112 /*
113  * Arguments for establishing lock manager service.  If you change
114  * lm_svc_args, you should increment the version number.  Try to keep
115  * supporting one or more old versions of the args, so that old lockd's
116  * will work with new kernels.
117  */
118 
119 enum lm_fmly  { LM_INET, LM_INET6, LM_LOOPBACK };
120 enum lm_proto { LM_TCP, LM_UDP };
121 
122 struct lm_svc_args {
123 	int		version;	/* keep this first */
124 	int		fd;
125 	enum lm_fmly	n_fmly;		/* protocol family */
126 	enum lm_proto	n_proto;	/* protocol */
127 	dev_t		n_rdev;		/* device ID */
128 	int		debug;		/* debugging level */
129 	time_t		timout;		/* client handle life (asynch RPCs) */
130 	int		grace;		/* secs in grace period */
131 	time_t	retransmittimeout;	/* retransmission interval */
132 };
133 
134 #ifdef _SYSCALL32
135 struct lm_svc_args32 {
136 	int32_t		version;	/* keep this first */
137 	int32_t		fd;
138 	enum lm_fmly	n_fmly;		/* protocol family */
139 	enum lm_proto	n_proto;	/* protocol */
140 	dev32_t		n_rdev;		/* device ID */
141 	int32_t		debug;		/* debugging level */
142 	time32_t	timout;		/* client handle life (asynch RPCs) */
143 	int32_t		grace;		/* secs in grace period */
144 	time32_t	retransmittimeout;	/* retransmission interval */
145 };
146 #endif
147 
148 #define	LM_SVC_CUR_VERS	30		/* current lm_svc_args vers num */
149 
150 /*
151  * Arguments for nfslog flush service.
152  */
153 struct nfsl_flush_args {
154 	int		version;
155 	int		directive;
156 	char		*buff;		/* buffer to flush/rename */
157 	int		buff_len;	/* includes terminating '\0' */
158 };
159 
160 #define	NFSL_FLUSH_ARGS_VERS 1		/* current nfsl_flush_args vers num */
161 
162 #ifdef _SYSCALL32
163 struct nfsl_flush_args32 {
164 	int32_t		version;
165 	int32_t		directive;
166 	caddr32_t	buff;		/* buffer to flush/rename */
167 	int32_t		buff_len;	/* includes terminating '\0' */
168 };
169 #endif
170 
171 /*
172  * Arguments for initialising RDMA service.
173  */
174 struct rdma_svc_args {
175 	uint32_t	poolid;		/* Thread Pool ID */
176 	char		*netid;		/* Network Identifier */
177 	int		nfs_versmin;	/* Min NFS version to offer */
178 	int		nfs_versmax;	/* Max NFS version to offer */
179 	int		delegation;	/* NFSv4 delegation on/off? */
180 };
181 
182 #ifdef _SYSCALL32
183 struct rdma_svc_args32 {
184 	uint32_t	poolid;		/* Thread Pool ID */
185 	caddr32_t	netid;		/* Network Identifier */
186 	int32_t		nfs_versmin;	/* Min NFS version to offer */
187 	int32_t		nfs_versmax;	/* Max NFS version to offer */
188 	int32_t		delegation;	/* NFSv4 delegation on/off? */
189 };
190 #endif
191 
192 
193 #define	NFS4_CLRST_VERSION	1
194 struct nfs4clrst_args {
195 	int		vers;
196 	int		addr_type;
197 	void		*ap;
198 };
199 
200 #ifdef _SYSCALL32
201 struct nfs4clrst_args32 {
202 	int32_t		vers;
203 	int32_t		addr_type;
204 	caddr32_t	ap;
205 };
206 #endif
207 
208 struct nfsidmap_args {
209 	uint_t		state;	/* Flushes caches, set state up 1 or down 0 */
210 	uint_t		did;	/* Door id to upcall */
211 };
212 
213 #define	NFSL_ALL	0x01		/* Flush all buffers */
214 #define	NFSL_RENAME	0x02		/* Rename buffer(s) */
215 #define	NFSL_SYNC	0x04		/* Perform operation synchronously? */
216 
217 #ifdef _KERNEL
218 union nfssysargs {
219 	struct exportfs_args	*exportfs_args_u;	/* exportfs args */
220 	struct nfs_getfh_args	*nfs_getfh_args_u;	/* nfs_getfh args */
221 	struct nfs_svc_args	*nfs_svc_args_u;	/* nfs_svc args */
222 	struct rdma_svc_args	*rdma_svc_args_u;	/* rdma_svc args */
223 	struct nfs_revauth_args	*nfs_revauth_args_u;	/* nfs_revauth args */
224 	struct lm_svc_args	*lm_svc_args_u;		/* lm_svc args */
225 	/* kill_lockmgr args: none */
226 	struct nfsl_flush_args	*nfsl_flush_args_u;	/* nfsl_flush args */
227 	struct svcpool_args	*svcpool_args_u;	/* svcpool args */
228 	struct nfs4clrst_args   *nfs4clrst_u;		/* nfs4 clear state */
229 	struct nfsidmap_args	*nfsidmap_u;		/* nfsidmap */
230 };
231 
232 struct nfssysa {
233 	enum nfssys_op		opcode;	/* operation discriminator */
234 	union nfssysargs	arg;	/* syscall-specific arg pointer */
235 };
236 #define	nfssysarg_exportfs	arg.exportfs_args_u
237 #define	nfssysarg_getfh		arg.nfs_getfh_args_u
238 #define	nfssysarg_svc		arg.nfs_svc_args_u
239 #define	nfssysarg_rdmastart	arg.rdma_svc_args_u
240 #define	nfssysarg_revauth	arg.nfs_revauth_args_u
241 #define	nfssysarg_lmsvc		arg.lm_svc_args_u
242 #define	nfssysarg_nfslflush	arg.nfsl_flush_args_u
243 #define	nfssysarg_svcpool	arg.svcpool_args_u
244 #define	nfssysarg_nfs4clrst	arg.nfs4clrst_u
245 #define	nfssysarg_nfsidmap	arg.nfsidmap_u
246 
247 #ifdef _SYSCALL32
248 union nfssysargs32 {
249 	caddr32_t exportfs_args_u;	/* exportfs args */
250 	caddr32_t nfs_getfh_args_u;	/* nfs_getfh args */
251 	caddr32_t nfs_svc_args_u;	/* nfs_svc args */
252 	caddr32_t rdma_svc_args_u;	/* rdma_start args */
253 	caddr32_t nfs_revauth_args_u;	/* nfs_revauth args */
254 	caddr32_t lm_svc_args_u;	/* lm_svc args */
255 	/* kill_lockmgr args: none */
256 	caddr32_t nfsl_flush_args_u;	/* nfsl_flush args */
257 	caddr32_t svcpool_args_u;
258 	caddr32_t nfs4clrst_u;
259 };
260 struct nfssysa32 {
261 	enum nfssys_op		opcode;	/* operation discriminator */
262 	union nfssysargs32	arg;	/* syscall-specific arg pointer */
263 };
264 #endif /* _SYSCALL32 */
265 
266 #endif	/* _KERNEL */
267 
268 struct nfs4_svc_args {
269 	int		fd;		/* Connection endpoint */
270 	int		cmd;
271 	char		*netid;		/* Transport Identifier */
272 	char		*addr;		/* Universal Address */
273 	char		*protofmly;	/* Protocol Family */
274 	char		*proto;		/* Protocol, eg. "tcp" */
275 	struct netbuf	addrmask;	/* Address mask for host */
276 };
277 
278 #ifdef _SYSCALL32
279 struct nfs4_svc_args32 {
280 	int32_t		fd;
281 	int32_t		cmd;
282 	caddr32_t	netid;
283 	caddr32_t	addr;
284 	caddr32_t	protofmly;
285 	caddr32_t	proto;
286 	struct netbuf32	addrmask;
287 };
288 #endif
289 
290 #define	NFS4_KRPC_START	1
291 #define	NFS4_SETPORT	2
292 #define	NFS4_DQUERY	4
293 
294 #ifdef _KERNEL
295 
296 #include <sys/systm.h>		/* for rval_t typedef */
297 
298 extern int	nfssys(enum nfssys_op opcode, void *arg);
299 extern int	exportfs(struct exportfs_args *, model_t, cred_t *);
300 extern int	nfs_getfh(struct nfs_getfh_args *, model_t, cred_t *);
301 extern int	nfs_svc(struct nfs_svc_args *, model_t);
302 extern int	lm_svc(struct lm_svc_args *uap);
303 extern int	lm_shutdown(void);
304 extern int	nfsl_flush(struct nfsl_flush_args *, model_t);
305 extern int	nfs4_svc(struct nfs4_svc_args *, model_t);
306 extern int 	rdma_start(struct rdma_svc_args *);
307 extern void	rfs4_clear_client_state(struct nfs4clrst_args *);
308 extern void	nfs_idmap_args(struct nfsidmap_args *);
309 #endif
310 
311 #ifdef	__cplusplus
312 }
313 #endif
314 
315 #endif	/* _NFS_NFSSYS_H */
316