xref: /onnv-gate/usr/src/uts/common/nfs/nfs_log.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_NFS_LOG_H
28*0Sstevel@tonic-gate #define	_NFS_LOG_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #include <nfs/nfs.h>
37*0Sstevel@tonic-gate #include <nfs/export.h>
38*0Sstevel@tonic-gate #include <rpc/rpc.h>
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate #define	LOG_MODE		0600	/* open log with these permissions */
41*0Sstevel@tonic-gate #define	LOG_INPROG_STRING	"_log_in_process"
42*0Sstevel@tonic-gate 
43*0Sstevel@tonic-gate /*
44*0Sstevel@tonic-gate  * Definition of dummy program for logging special non-nfs reqs
45*0Sstevel@tonic-gate  */
46*0Sstevel@tonic-gate #define	NFSLOG_PROGRAM		((rpcprog_t)42)
47*0Sstevel@tonic-gate #define	NFSLOG_VERSION		((rpcvers_t)1)
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate #define	NFSLOG_VERSMIN		((rpcvers_t)1)
50*0Sstevel@tonic-gate #define	NFSLOG_VERSMAX		((rpcvers_t)1)
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate #define	NFSLOG_NULL		((rpcproc_t)0)
53*0Sstevel@tonic-gate #define	NFSLOG_SHARE		((rpcproc_t)1)
54*0Sstevel@tonic-gate #define	NFSLOG_UNSHARE		((rpcproc_t)2)
55*0Sstevel@tonic-gate #define	NFSLOG_LOOKUP		((rpcproc_t)3)
56*0Sstevel@tonic-gate #define	NFSLOG_GETFH		((rpcproc_t)4)
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate /*
59*0Sstevel@tonic-gate  * Version of the on disk log file
60*0Sstevel@tonic-gate  */
61*0Sstevel@tonic-gate #define	NFSLOG_BUF_VERSION	((rpcvers_t)2)
62*0Sstevel@tonic-gate 
63*0Sstevel@tonic-gate #define	NFSLOG_BUF_VERSMIN	((rpcvers_t)1)
64*0Sstevel@tonic-gate #define	NFSLOG_BUF_VERSMAX	((rpcvers_t)2)
65*0Sstevel@tonic-gate /*
66*0Sstevel@tonic-gate  * Contents of the on disk log file header
67*0Sstevel@tonic-gate  *
68*0Sstevel@tonic-gate  * Note: This is the structure for older version 1 buffers, and does not
69*0Sstevel@tonic-gate  * adequately support large buffer files, as the offset is 32 bit. Newer
70*0Sstevel@tonic-gate  * buffer files are written using version 2 buffer header (below) which
71*0Sstevel@tonic-gate  * has a 64 bit offset. However, because existing buffers continue to use
72*0Sstevel@tonic-gate  * the old header format, the daemon xdr code can read and write either format.
73*0Sstevel@tonic-gate  * This definition below is not explicitely used anywhere in the code,
74*0Sstevel@tonic-gate  * but is implicitely used by the daemon xdr code. For that reason, it
75*0Sstevel@tonic-gate  * is kept here for information purpose only.
76*0Sstevel@tonic-gate  */
77*0Sstevel@tonic-gate struct nfslog_buffer_header_1 {
78*0Sstevel@tonic-gate 	uint32_t bh_length;		/* Length of this header */
79*0Sstevel@tonic-gate 	uint32_t bh_version;		/* Version of buffer contents */
80*0Sstevel@tonic-gate 	uint32_t bh_flags;		/* Optional flags field */
81*0Sstevel@tonic-gate 	uint32_t bh_offset;		/* offset within file to begin */
82*0Sstevel@tonic-gate 	timestruc32_t bh_timestamp;	/* When the buffer was created */
83*0Sstevel@tonic-gate };
84*0Sstevel@tonic-gate typedef struct nfslog_buffer_header_1 nfslog_buffer_header_1;
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate /*
87*0Sstevel@tonic-gate  * For the current version 2, which supports largefiles
88*0Sstevel@tonic-gate  */
89*0Sstevel@tonic-gate struct nfslog_buffer_header_2 {
90*0Sstevel@tonic-gate 	uint32_t bh_length;		/* Length of this header */
91*0Sstevel@tonic-gate 	rpcvers_t bh_version;		/* Version of buffer contents */
92*0Sstevel@tonic-gate 	u_offset_t bh_offset;		/* offset within file to begin */
93*0Sstevel@tonic-gate 	uint32_t bh_flags;		/* Optional flags field */
94*0Sstevel@tonic-gate 	timestruc32_t bh_timestamp;	/* When the buffer was created */
95*0Sstevel@tonic-gate };
96*0Sstevel@tonic-gate typedef struct nfslog_buffer_header_2 nfslog_buffer_header_2;
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate typedef struct nfslog_buffer_header_2 nfslog_buffer_header;
99*0Sstevel@tonic-gate 
100*0Sstevel@tonic-gate /* bh_flags values */
101*0Sstevel@tonic-gate #define	NFSLOG_BH_OFFSET_OVERFLOW	1	/* version 1 bh_offset */
102*0Sstevel@tonic-gate 
103*0Sstevel@tonic-gate /*
104*0Sstevel@tonic-gate  * For each record written to the log file, this struct is used
105*0Sstevel@tonic-gate  * as the logical header; it will be XDR encoded to be written to the file.
106*0Sstevel@tonic-gate  *
107*0Sstevel@tonic-gate  * Note: if the buffer file becomes large enough, the rh_rec_id may
108*0Sstevel@tonic-gate  * wrap around. This situation is appropriately handled by the daemon however.
109*0Sstevel@tonic-gate  */
110*0Sstevel@tonic-gate struct nfslog_record_header {
111*0Sstevel@tonic-gate 	uint32_t rh_reclen;		/* Length of entire record */
112*0Sstevel@tonic-gate 	uint32_t rh_rec_id;		/* unique id for this log */
113*0Sstevel@tonic-gate 	rpcprog_t rh_prognum;		/* Program number */
114*0Sstevel@tonic-gate 	rpcproc_t rh_procnum;		/* Procedure number */
115*0Sstevel@tonic-gate 	rpcvers_t rh_version;		/* Version number */
116*0Sstevel@tonic-gate 	uint32_t rh_auth_flavor;	/* Auth flavor of RPC request */
117*0Sstevel@tonic-gate 	timestruc32_t rh_timestamp;	/* time stamp of the request */
118*0Sstevel@tonic-gate 	uid_t rh_uid;			/* uid of requestor as per RPC */
119*0Sstevel@tonic-gate 	gid_t rh_gid;			/* gid of requestor as per RPC */
120*0Sstevel@tonic-gate };
121*0Sstevel@tonic-gate typedef struct nfslog_record_header nfslog_record_header;
122*0Sstevel@tonic-gate 
123*0Sstevel@tonic-gate /*
124*0Sstevel@tonic-gate  * For each record written to the log file, this is the logical
125*0Sstevel@tonic-gate  * structure of the record; it will be XDR encoded and written to
126*0Sstevel@tonic-gate  * the file.
127*0Sstevel@tonic-gate  */
128*0Sstevel@tonic-gate struct nfslog_request_record {
129*0Sstevel@tonic-gate 	nfslog_record_header re_header;	/* Header as defined above */
130*0Sstevel@tonic-gate 	char *re_principal_name;	/* Principal name of caller */
131*0Sstevel@tonic-gate 	char *re_netid;			/* Netid used for request */
132*0Sstevel@tonic-gate 	char *re_tag;			/* Log buffer tag for file system */
133*0Sstevel@tonic-gate 	struct netbuf re_ipaddr;	/* Requestors ip address */
134*0Sstevel@tonic-gate 	caddr_t re_rpc_arg;		/* RPC arguments and response */
135*0Sstevel@tonic-gate 	caddr_t re_rpc_res;
136*0Sstevel@tonic-gate };
137*0Sstevel@tonic-gate typedef struct nfslog_request_record nfslog_request_record;
138*0Sstevel@tonic-gate 
139*0Sstevel@tonic-gate /*
140*0Sstevel@tonic-gate  * From this point forward, the definitions represent the arguments
141*0Sstevel@tonic-gate  * and results of each possible RPC that can be logged.  These
142*0Sstevel@tonic-gate  * may have been trimmed in content from the real RPC arguments
143*0Sstevel@tonic-gate  * and results to save space.
144*0Sstevel@tonic-gate  */
145*0Sstevel@tonic-gate typedef fhandle_t fhandle;
146*0Sstevel@tonic-gate 
147*0Sstevel@tonic-gate struct nfslog_sharefsargs {
148*0Sstevel@tonic-gate 	int sh_flags;
149*0Sstevel@tonic-gate 	uint32_t sh_anon;
150*0Sstevel@tonic-gate 	char *sh_path;
151*0Sstevel@tonic-gate 	fhandle sh_fh_buf;
152*0Sstevel@tonic-gate };
153*0Sstevel@tonic-gate typedef struct nfslog_sharefsargs nfslog_sharefsargs;
154*0Sstevel@tonic-gate 
155*0Sstevel@tonic-gate typedef nfsstat nfslog_sharefsres;
156*0Sstevel@tonic-gate 
157*0Sstevel@tonic-gate struct nfslog_getfhargs {
158*0Sstevel@tonic-gate 	fhandle gfh_fh_buf;
159*0Sstevel@tonic-gate 	char *gfh_path;
160*0Sstevel@tonic-gate };
161*0Sstevel@tonic-gate typedef struct nfslog_getfhargs nfslog_getfhargs;
162*0Sstevel@tonic-gate 
163*0Sstevel@tonic-gate struct nfslog_diropargs {
164*0Sstevel@tonic-gate 	fhandle da_fhandle;
165*0Sstevel@tonic-gate 	char *da_name;
166*0Sstevel@tonic-gate };
167*0Sstevel@tonic-gate typedef struct nfslog_diropargs nfslog_diropargs;
168*0Sstevel@tonic-gate 
169*0Sstevel@tonic-gate struct nfslog_drok {
170*0Sstevel@tonic-gate 	fhandle drok_fhandle;
171*0Sstevel@tonic-gate };
172*0Sstevel@tonic-gate typedef struct nfslog_drok nfslog_drok;
173*0Sstevel@tonic-gate 
174*0Sstevel@tonic-gate struct nfslog_diropres {
175*0Sstevel@tonic-gate 	nfsstat dr_status;
176*0Sstevel@tonic-gate 	union {
177*0Sstevel@tonic-gate 		nfslog_drok dr_ok;
178*0Sstevel@tonic-gate 	} nfslog_diropres_u;
179*0Sstevel@tonic-gate };
180*0Sstevel@tonic-gate typedef struct nfslog_diropres nfslog_diropres;
181*0Sstevel@tonic-gate 
182*0Sstevel@tonic-gate typedef struct nfsreadargs nfslog_nfsreadargs;
183*0Sstevel@tonic-gate 
184*0Sstevel@tonic-gate struct nfslog_rrok {
185*0Sstevel@tonic-gate 	uint32_t filesize;
186*0Sstevel@tonic-gate 	uint32_t rrok_count;
187*0Sstevel@tonic-gate };
188*0Sstevel@tonic-gate typedef struct nfslog_rrok nfslog_rrok;
189*0Sstevel@tonic-gate 
190*0Sstevel@tonic-gate struct nfslog_rdresult {
191*0Sstevel@tonic-gate 	nfsstat r_status;
192*0Sstevel@tonic-gate 	union {
193*0Sstevel@tonic-gate 		nfslog_rrok r_ok;
194*0Sstevel@tonic-gate 	} nfslog_rdresult_u;
195*0Sstevel@tonic-gate };
196*0Sstevel@tonic-gate typedef struct nfslog_rdresult nfslog_rdresult;
197*0Sstevel@tonic-gate 
198*0Sstevel@tonic-gate struct nfslog_writeargs {
199*0Sstevel@tonic-gate 	fhandle waargs_fhandle;
200*0Sstevel@tonic-gate 	uint32_t waargs_begoff;
201*0Sstevel@tonic-gate 	uint32_t waargs_offset;
202*0Sstevel@tonic-gate 	uint32_t waargs_totcount;
203*0Sstevel@tonic-gate 	uint32_t waargs_count;
204*0Sstevel@tonic-gate };
205*0Sstevel@tonic-gate typedef struct nfslog_writeargs nfslog_writeargs;
206*0Sstevel@tonic-gate 
207*0Sstevel@tonic-gate struct nfslog_writeresult {
208*0Sstevel@tonic-gate 	nfsstat wr_status;
209*0Sstevel@tonic-gate 	union {
210*0Sstevel@tonic-gate 		uint32_t wr_size;
211*0Sstevel@tonic-gate 	} nfslog_writeresult_u;
212*0Sstevel@tonic-gate };
213*0Sstevel@tonic-gate typedef struct nfslog_writeresult nfslog_writeresult;
214*0Sstevel@tonic-gate 
215*0Sstevel@tonic-gate struct nfslog_sattr {
216*0Sstevel@tonic-gate 	uint32_t sa_mode;
217*0Sstevel@tonic-gate 	uint32_t sa_uid;
218*0Sstevel@tonic-gate 	uint32_t sa_gid;
219*0Sstevel@tonic-gate 	uint32_t sa_size;
220*0Sstevel@tonic-gate 	nfs2_timeval sa_atime;
221*0Sstevel@tonic-gate 	nfs2_timeval sa_mtime;
222*0Sstevel@tonic-gate };
223*0Sstevel@tonic-gate typedef struct nfslog_sattr nfslog_sattr;
224*0Sstevel@tonic-gate 
225*0Sstevel@tonic-gate struct nfslog_createargs {
226*0Sstevel@tonic-gate 	nfslog_sattr ca_sa;
227*0Sstevel@tonic-gate 	nfslog_diropargs ca_da;
228*0Sstevel@tonic-gate };
229*0Sstevel@tonic-gate typedef struct nfslog_createargs nfslog_createargs;
230*0Sstevel@tonic-gate 
231*0Sstevel@tonic-gate struct nfslog_setattrargs {
232*0Sstevel@tonic-gate 	fhandle saa_fh;
233*0Sstevel@tonic-gate 	nfslog_sattr saa_sa;
234*0Sstevel@tonic-gate };
235*0Sstevel@tonic-gate typedef struct nfslog_setattrargs nfslog_setattrargs;
236*0Sstevel@tonic-gate 
237*0Sstevel@tonic-gate struct nfslog_rdlnres {
238*0Sstevel@tonic-gate 	nfsstat rl_status;
239*0Sstevel@tonic-gate 	union {
240*0Sstevel@tonic-gate 		char *rl_ok;
241*0Sstevel@tonic-gate 	} nfslog_rdlnres_u;
242*0Sstevel@tonic-gate };
243*0Sstevel@tonic-gate typedef struct nfslog_rdlnres nfslog_rdlnres;
244*0Sstevel@tonic-gate 
245*0Sstevel@tonic-gate struct nfslog_rnmargs {
246*0Sstevel@tonic-gate 	nfslog_diropargs rna_from;
247*0Sstevel@tonic-gate 	nfslog_diropargs rna_to;
248*0Sstevel@tonic-gate };
249*0Sstevel@tonic-gate typedef struct nfslog_rnmargs nfslog_rnmargs;
250*0Sstevel@tonic-gate 
251*0Sstevel@tonic-gate struct nfslog_linkargs {
252*0Sstevel@tonic-gate 	fhandle la_from;
253*0Sstevel@tonic-gate 	nfslog_diropargs la_to;
254*0Sstevel@tonic-gate };
255*0Sstevel@tonic-gate typedef struct nfslog_linkargs nfslog_linkargs;
256*0Sstevel@tonic-gate 
257*0Sstevel@tonic-gate struct nfslog_symlinkargs {
258*0Sstevel@tonic-gate 	nfslog_diropargs sla_from;
259*0Sstevel@tonic-gate 	char *sla_tnm;
260*0Sstevel@tonic-gate 	nfslog_sattr sla_sa;
261*0Sstevel@tonic-gate };
262*0Sstevel@tonic-gate typedef struct nfslog_symlinkargs nfslog_symlinkargs;
263*0Sstevel@tonic-gate 
264*0Sstevel@tonic-gate struct nfslog_rddirargs {
265*0Sstevel@tonic-gate 	fhandle rda_fh;
266*0Sstevel@tonic-gate 	uint32_t rda_offset;
267*0Sstevel@tonic-gate 	uint32_t rda_count;
268*0Sstevel@tonic-gate };
269*0Sstevel@tonic-gate typedef struct nfslog_rddirargs nfslog_rddirargs;
270*0Sstevel@tonic-gate 
271*0Sstevel@tonic-gate struct nfslog_rdok {
272*0Sstevel@tonic-gate 	uint32_t rdok_offset;
273*0Sstevel@tonic-gate 	uint32_t rdok_size;
274*0Sstevel@tonic-gate 	bool_t rdok_eof;
275*0Sstevel@tonic-gate };
276*0Sstevel@tonic-gate typedef struct nfslog_rdok nfslog_rdok;
277*0Sstevel@tonic-gate 
278*0Sstevel@tonic-gate struct nfslog_rddirres {
279*0Sstevel@tonic-gate 	nfsstat rd_status;
280*0Sstevel@tonic-gate 	union {
281*0Sstevel@tonic-gate 		nfslog_rdok rd_ok;
282*0Sstevel@tonic-gate 	} nfslog_rddirres_u;
283*0Sstevel@tonic-gate };
284*0Sstevel@tonic-gate typedef struct nfslog_rddirres nfslog_rddirres;
285*0Sstevel@tonic-gate 
286*0Sstevel@tonic-gate struct nfslog_diropargs3 {
287*0Sstevel@tonic-gate 	nfs_fh3 dir;
288*0Sstevel@tonic-gate 	char *name;
289*0Sstevel@tonic-gate };
290*0Sstevel@tonic-gate typedef struct nfslog_diropargs3 nfslog_diropargs3;
291*0Sstevel@tonic-gate 
292*0Sstevel@tonic-gate struct nfslog_LOOKUP3res {
293*0Sstevel@tonic-gate 	nfsstat3 status;
294*0Sstevel@tonic-gate 	union {
295*0Sstevel@tonic-gate 		nfs_fh3 object;
296*0Sstevel@tonic-gate 	} nfslog_LOOKUP3res_u;
297*0Sstevel@tonic-gate };
298*0Sstevel@tonic-gate typedef struct nfslog_LOOKUP3res nfslog_LOOKUP3res;
299*0Sstevel@tonic-gate 
300*0Sstevel@tonic-gate struct nfslog_createhow3 {
301*0Sstevel@tonic-gate 	createmode3 mode;
302*0Sstevel@tonic-gate 	union {
303*0Sstevel@tonic-gate 		set_size3 size;
304*0Sstevel@tonic-gate 	} nfslog_createhow3_u;
305*0Sstevel@tonic-gate };
306*0Sstevel@tonic-gate typedef struct nfslog_createhow3 nfslog_createhow3;
307*0Sstevel@tonic-gate 
308*0Sstevel@tonic-gate struct nfslog_CREATE3args {
309*0Sstevel@tonic-gate 	nfslog_diropargs3 where;
310*0Sstevel@tonic-gate 	nfslog_createhow3 how;
311*0Sstevel@tonic-gate };
312*0Sstevel@tonic-gate typedef struct nfslog_CREATE3args nfslog_CREATE3args;
313*0Sstevel@tonic-gate 
314*0Sstevel@tonic-gate struct nfslog_CREATE3resok {
315*0Sstevel@tonic-gate 	post_op_fh3 obj;
316*0Sstevel@tonic-gate };
317*0Sstevel@tonic-gate typedef struct nfslog_CREATE3resok nfslog_CREATE3resok;
318*0Sstevel@tonic-gate 
319*0Sstevel@tonic-gate struct nfslog_CREATE3res {
320*0Sstevel@tonic-gate 	nfsstat3 status;
321*0Sstevel@tonic-gate 	union {
322*0Sstevel@tonic-gate 		nfslog_CREATE3resok ok;
323*0Sstevel@tonic-gate 	} nfslog_CREATE3res_u;
324*0Sstevel@tonic-gate };
325*0Sstevel@tonic-gate typedef struct nfslog_CREATE3res nfslog_CREATE3res;
326*0Sstevel@tonic-gate 
327*0Sstevel@tonic-gate struct nfslog_SETATTR3args {
328*0Sstevel@tonic-gate 	nfs_fh3 object;
329*0Sstevel@tonic-gate 	set_size3 size;
330*0Sstevel@tonic-gate };
331*0Sstevel@tonic-gate typedef struct nfslog_SETATTR3args nfslog_SETATTR3args;
332*0Sstevel@tonic-gate 
333*0Sstevel@tonic-gate struct nfslog_READLINK3res {
334*0Sstevel@tonic-gate 	nfsstat3 status;
335*0Sstevel@tonic-gate 	union {
336*0Sstevel@tonic-gate 		char *data;
337*0Sstevel@tonic-gate 	} nfslog_READLINK3res_u;
338*0Sstevel@tonic-gate };
339*0Sstevel@tonic-gate typedef struct nfslog_READLINK3res nfslog_READLINK3res;
340*0Sstevel@tonic-gate 
341*0Sstevel@tonic-gate struct nfslog_READ3args {
342*0Sstevel@tonic-gate 	nfs_fh3 file;
343*0Sstevel@tonic-gate 	offset3 offset;
344*0Sstevel@tonic-gate 	count3 count;
345*0Sstevel@tonic-gate };
346*0Sstevel@tonic-gate typedef struct nfslog_READ3args nfslog_READ3args;
347*0Sstevel@tonic-gate 
348*0Sstevel@tonic-gate struct nfslog_READ3resok {
349*0Sstevel@tonic-gate 	size3 filesize;
350*0Sstevel@tonic-gate 	count3 count;
351*0Sstevel@tonic-gate 	bool_t eof;
352*0Sstevel@tonic-gate 	uint32_t size;
353*0Sstevel@tonic-gate };
354*0Sstevel@tonic-gate typedef struct nfslog_READ3resok nfslog_READ3resok;
355*0Sstevel@tonic-gate 
356*0Sstevel@tonic-gate struct nfslog_READ3res {
357*0Sstevel@tonic-gate 	nfsstat3 status;
358*0Sstevel@tonic-gate 	union {
359*0Sstevel@tonic-gate 		nfslog_READ3resok ok;
360*0Sstevel@tonic-gate 	} nfslog_READ3res_u;
361*0Sstevel@tonic-gate };
362*0Sstevel@tonic-gate typedef struct nfslog_READ3res nfslog_READ3res;
363*0Sstevel@tonic-gate 
364*0Sstevel@tonic-gate struct nfslog_WRITE3args {
365*0Sstevel@tonic-gate 	nfs_fh3 file;
366*0Sstevel@tonic-gate 	offset3 offset;
367*0Sstevel@tonic-gate 	count3 count;
368*0Sstevel@tonic-gate 	stable_how stable;
369*0Sstevel@tonic-gate };
370*0Sstevel@tonic-gate typedef struct nfslog_WRITE3args nfslog_WRITE3args;
371*0Sstevel@tonic-gate 
372*0Sstevel@tonic-gate struct nfslog_WRITE3resok {
373*0Sstevel@tonic-gate 	size3 filesize;
374*0Sstevel@tonic-gate 	count3 count;
375*0Sstevel@tonic-gate 	stable_how committed;
376*0Sstevel@tonic-gate };
377*0Sstevel@tonic-gate typedef struct nfslog_WRITE3resok nfslog_WRITE3resok;
378*0Sstevel@tonic-gate 
379*0Sstevel@tonic-gate struct nfslog_WRITE3res {
380*0Sstevel@tonic-gate 	nfsstat3 status;
381*0Sstevel@tonic-gate 	union {
382*0Sstevel@tonic-gate 		nfslog_WRITE3resok ok;
383*0Sstevel@tonic-gate 	} nfslog_WRITE3res_u;
384*0Sstevel@tonic-gate };
385*0Sstevel@tonic-gate typedef struct nfslog_WRITE3res nfslog_WRITE3res;
386*0Sstevel@tonic-gate 
387*0Sstevel@tonic-gate struct nfslog_MKDIR3args {
388*0Sstevel@tonic-gate 	nfslog_diropargs3 where;
389*0Sstevel@tonic-gate };
390*0Sstevel@tonic-gate typedef struct nfslog_MKDIR3args nfslog_MKDIR3args;
391*0Sstevel@tonic-gate 
392*0Sstevel@tonic-gate struct nfslog_MKDIR3res {
393*0Sstevel@tonic-gate 	nfsstat3 status;
394*0Sstevel@tonic-gate 	union {
395*0Sstevel@tonic-gate 		post_op_fh3 obj;
396*0Sstevel@tonic-gate 	} nfslog_MKDIR3res_u;
397*0Sstevel@tonic-gate };
398*0Sstevel@tonic-gate typedef struct nfslog_MKDIR3res nfslog_MKDIR3res;
399*0Sstevel@tonic-gate 
400*0Sstevel@tonic-gate struct nfslog_SYMLINK3args {
401*0Sstevel@tonic-gate 	nfslog_diropargs3 where;
402*0Sstevel@tonic-gate 	char *symlink_data;
403*0Sstevel@tonic-gate };
404*0Sstevel@tonic-gate typedef struct nfslog_SYMLINK3args nfslog_SYMLINK3args;
405*0Sstevel@tonic-gate 
406*0Sstevel@tonic-gate struct nfslog_SYMLINK3res {
407*0Sstevel@tonic-gate 	nfsstat3 status;
408*0Sstevel@tonic-gate 	union {
409*0Sstevel@tonic-gate 		post_op_fh3 obj;
410*0Sstevel@tonic-gate 	} nfslog_SYMLINK3res_u;
411*0Sstevel@tonic-gate };
412*0Sstevel@tonic-gate typedef struct nfslog_SYMLINK3res nfslog_SYMLINK3res;
413*0Sstevel@tonic-gate 
414*0Sstevel@tonic-gate struct nfslog_MKNOD3args {
415*0Sstevel@tonic-gate 	nfslog_diropargs3 where;
416*0Sstevel@tonic-gate 	ftype3 type;
417*0Sstevel@tonic-gate };
418*0Sstevel@tonic-gate typedef struct nfslog_MKNOD3args nfslog_MKNOD3args;
419*0Sstevel@tonic-gate 
420*0Sstevel@tonic-gate struct nfslog_MKNOD3res {
421*0Sstevel@tonic-gate 	nfsstat3 status;
422*0Sstevel@tonic-gate 	union {
423*0Sstevel@tonic-gate 		post_op_fh3 obj;
424*0Sstevel@tonic-gate 	} nfslog_MKNOD3res_u;
425*0Sstevel@tonic-gate };
426*0Sstevel@tonic-gate typedef struct nfslog_MKNOD3res nfslog_MKNOD3res;
427*0Sstevel@tonic-gate 
428*0Sstevel@tonic-gate struct nfslog_REMOVE3args {
429*0Sstevel@tonic-gate 	nfslog_diropargs3 object;
430*0Sstevel@tonic-gate };
431*0Sstevel@tonic-gate typedef struct nfslog_REMOVE3args nfslog_REMOVE3args;
432*0Sstevel@tonic-gate 
433*0Sstevel@tonic-gate struct nfslog_RMDIR3args {
434*0Sstevel@tonic-gate 	nfslog_diropargs3 object;
435*0Sstevel@tonic-gate };
436*0Sstevel@tonic-gate typedef struct nfslog_RMDIR3args nfslog_RMDIR3args;
437*0Sstevel@tonic-gate 
438*0Sstevel@tonic-gate struct nfslog_RENAME3args {
439*0Sstevel@tonic-gate 	nfslog_diropargs3 from;
440*0Sstevel@tonic-gate 	nfslog_diropargs3 to;
441*0Sstevel@tonic-gate };
442*0Sstevel@tonic-gate typedef struct nfslog_RENAME3args nfslog_RENAME3args;
443*0Sstevel@tonic-gate 
444*0Sstevel@tonic-gate struct nfslog_LINK3args {
445*0Sstevel@tonic-gate 	nfs_fh3 file;
446*0Sstevel@tonic-gate 	nfslog_diropargs3 link;
447*0Sstevel@tonic-gate };
448*0Sstevel@tonic-gate typedef struct nfslog_LINK3args nfslog_LINK3args;
449*0Sstevel@tonic-gate 
450*0Sstevel@tonic-gate struct nfslog_READDIRPLUS3args {
451*0Sstevel@tonic-gate 	nfs_fh3 dir;
452*0Sstevel@tonic-gate 	count3 dircount;
453*0Sstevel@tonic-gate 	count3 maxcount;
454*0Sstevel@tonic-gate };
455*0Sstevel@tonic-gate typedef struct nfslog_READDIRPLUS3args nfslog_READDIRPLUS3args;
456*0Sstevel@tonic-gate 
457*0Sstevel@tonic-gate struct nfslog_entryplus3 {
458*0Sstevel@tonic-gate 	post_op_fh3 name_handle;
459*0Sstevel@tonic-gate 	char *name;
460*0Sstevel@tonic-gate 	struct nfslog_entryplus3 *nextentry;
461*0Sstevel@tonic-gate };
462*0Sstevel@tonic-gate typedef struct nfslog_entryplus3 nfslog_entryplus3;
463*0Sstevel@tonic-gate 
464*0Sstevel@tonic-gate struct nfslog_dirlistplus3 {
465*0Sstevel@tonic-gate 	nfslog_entryplus3 *entries;
466*0Sstevel@tonic-gate 	bool_t eof;
467*0Sstevel@tonic-gate };
468*0Sstevel@tonic-gate typedef struct nfslog_dirlistplus3 nfslog_dirlistplus3;
469*0Sstevel@tonic-gate 
470*0Sstevel@tonic-gate struct nfslog_READDIRPLUS3resok {
471*0Sstevel@tonic-gate 	nfslog_dirlistplus3 reply;
472*0Sstevel@tonic-gate };
473*0Sstevel@tonic-gate typedef struct nfslog_READDIRPLUS3resok nfslog_READDIRPLUS3resok;
474*0Sstevel@tonic-gate 
475*0Sstevel@tonic-gate struct nfslog_READDIRPLUS3res {
476*0Sstevel@tonic-gate 	nfsstat3 status;
477*0Sstevel@tonic-gate 	union {
478*0Sstevel@tonic-gate 		nfslog_READDIRPLUS3resok ok;
479*0Sstevel@tonic-gate 	} nfslog_READDIRPLUS3res_u;
480*0Sstevel@tonic-gate };
481*0Sstevel@tonic-gate typedef struct nfslog_READDIRPLUS3res nfslog_READDIRPLUS3res;
482*0Sstevel@tonic-gate 
483*0Sstevel@tonic-gate struct nfslog_COMMIT3args {
484*0Sstevel@tonic-gate 	nfs_fh3 file;
485*0Sstevel@tonic-gate 	offset3 offset;
486*0Sstevel@tonic-gate 	count3 count;
487*0Sstevel@tonic-gate };
488*0Sstevel@tonic-gate typedef struct nfslog_COMMIT3args nfslog_COMMIT3args;
489*0Sstevel@tonic-gate 
490*0Sstevel@tonic-gate /* the xdr functions */
491*0Sstevel@tonic-gate #ifndef _KERNEL
492*0Sstevel@tonic-gate 
493*0Sstevel@tonic-gate extern bool_t xdr_nfsstat(XDR *, nfsstat *);
494*0Sstevel@tonic-gate extern bool_t xdr_uint64(XDR *, uint64 *);
495*0Sstevel@tonic-gate extern bool_t xdr_uint32(XDR *, uint32 *);
496*0Sstevel@tonic-gate extern bool_t xdr_fhandle(XDR *, fhandle_t *);
497*0Sstevel@tonic-gate extern bool_t xdr_nfs_fh3(XDR *, nfs_fh3 *);
498*0Sstevel@tonic-gate extern bool_t xdr_nfsstat3(XDR *, nfsstat3 *);
499*0Sstevel@tonic-gate extern bool_t xdr_nfslog_buffer_header(XDR *, nfslog_buffer_header *);
500*0Sstevel@tonic-gate extern bool_t xdr_nfslog_request_record(XDR *, nfslog_request_record *);
501*0Sstevel@tonic-gate extern bool_t xdr_nfslog_sharefsargs(XDR *, nfslog_sharefsargs *);
502*0Sstevel@tonic-gate extern bool_t xdr_nfslog_sharefsres(XDR *, nfslog_sharefsres *);
503*0Sstevel@tonic-gate extern bool_t xdr_nfslog_getfhargs(XDR *, nfslog_getfhargs *);
504*0Sstevel@tonic-gate extern bool_t xdr_nfslog_diropargs(XDR *, nfslog_diropargs *);
505*0Sstevel@tonic-gate extern bool_t xdr_nfslog_diropres(XDR *, nfslog_diropres *);
506*0Sstevel@tonic-gate extern bool_t xdr_nfslog_nfsreadargs(XDR *, nfslog_nfsreadargs *);
507*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rdresult(XDR *, nfslog_rdresult *);
508*0Sstevel@tonic-gate extern bool_t xdr_nfslog_writeargs(XDR *, nfslog_writeargs *);
509*0Sstevel@tonic-gate extern bool_t xdr_nfslog_writeresult(XDR *, nfslog_writeresult *);
510*0Sstevel@tonic-gate extern bool_t xdr_nfslog_createargs(XDR *, nfslog_createargs *);
511*0Sstevel@tonic-gate extern bool_t xdr_nfslog_setattrargs(XDR *, nfslog_setattrargs *);
512*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rdlnres(XDR *, nfslog_rdlnres *);
513*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rnmargs(XDR *, nfslog_rnmargs *);
514*0Sstevel@tonic-gate extern bool_t xdr_nfslog_linkargs(XDR *, nfslog_linkargs *);
515*0Sstevel@tonic-gate extern bool_t xdr_nfslog_symlinkargs(XDR *, nfslog_symlinkargs *);
516*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rddirargs(XDR *, nfslog_rddirargs *);
517*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rddirres(XDR *, nfslog_rddirres *);
518*0Sstevel@tonic-gate extern bool_t xdr_nfslog_diropargs3(XDR *, nfslog_diropargs3 *);
519*0Sstevel@tonic-gate extern bool_t xdr_nfslog_LOOKUP3res(XDR *, nfslog_LOOKUP3res *);
520*0Sstevel@tonic-gate extern bool_t xdr_nfslog_CREATE3args(XDR *, nfslog_CREATE3args *);
521*0Sstevel@tonic-gate extern bool_t xdr_nfslog_CREATE3res(XDR *, nfslog_CREATE3res *);
522*0Sstevel@tonic-gate extern bool_t xdr_nfslog_SETATTR3args(XDR *, nfslog_SETATTR3args *);
523*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READLINK3res(XDR *, nfslog_READLINK3res *);
524*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READ3args(XDR *, nfslog_READ3args *);
525*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READ3res(XDR *, nfslog_READ3res *);
526*0Sstevel@tonic-gate extern bool_t xdr_nfslog_WRITE3args(XDR *, nfslog_WRITE3args *);
527*0Sstevel@tonic-gate extern bool_t xdr_nfslog_WRITE3res(XDR *, nfslog_WRITE3res *);
528*0Sstevel@tonic-gate extern bool_t xdr_nfslog_MKDIR3args(XDR *, nfslog_MKDIR3args *);
529*0Sstevel@tonic-gate extern bool_t xdr_nfslog_MKDIR3res(XDR *, nfslog_MKDIR3res *);
530*0Sstevel@tonic-gate extern bool_t xdr_nfslog_SYMLINK3args(XDR *, nfslog_SYMLINK3args *);
531*0Sstevel@tonic-gate extern bool_t xdr_nfslog_SYMLINK3res(XDR *, nfslog_SYMLINK3res *);
532*0Sstevel@tonic-gate extern bool_t xdr_nfslog_MKNOD3args(XDR *, nfslog_MKNOD3args *);
533*0Sstevel@tonic-gate extern bool_t xdr_nfslog_MKNOD3res(XDR *, nfslog_MKNOD3res *);
534*0Sstevel@tonic-gate extern bool_t xdr_nfslog_REMOVE3args(XDR *, nfslog_REMOVE3args *);
535*0Sstevel@tonic-gate extern bool_t xdr_nfslog_RMDIR3args(XDR *, nfslog_RMDIR3args *);
536*0Sstevel@tonic-gate extern bool_t xdr_nfslog_RENAME3args(XDR *, nfslog_RENAME3args *);
537*0Sstevel@tonic-gate extern bool_t xdr_nfslog_LINK3args(XDR *, nfslog_LINK3args *);
538*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READDIRPLUS3args(XDR *, nfslog_READDIRPLUS3args *);
539*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READDIRPLUS3res(XDR *, nfslog_READDIRPLUS3res *);
540*0Sstevel@tonic-gate extern bool_t xdr_nfslog_COMMIT3args(XDR *, nfslog_COMMIT3args *);
541*0Sstevel@tonic-gate 
542*0Sstevel@tonic-gate #else /* !_KERNEL */
543*0Sstevel@tonic-gate 
544*0Sstevel@tonic-gate extern bool_t xdr_nfsstat(XDR *, nfsstat *);
545*0Sstevel@tonic-gate extern bool_t xdr_nfslog_nfsreadargs(XDR *, nfslog_nfsreadargs *);
546*0Sstevel@tonic-gate extern bool_t xdr_nfslog_sharefsres(XDR *, nfslog_sharefsres *);
547*0Sstevel@tonic-gate extern bool_t xdr_nfslog_sharefsargs(XDR *, struct exportinfo *);
548*0Sstevel@tonic-gate extern bool_t xdr_nfslog_getfhargs(XDR *, nfslog_getfhargs *);
549*0Sstevel@tonic-gate extern bool_t xdr_nfslog_diropargs(XDR *, struct nfsdiropargs *);
550*0Sstevel@tonic-gate extern bool_t xdr_nfslog_drok(XDR *, struct nfsdrok *);
551*0Sstevel@tonic-gate extern bool_t xdr_nfslog_diropres(XDR *, struct nfsdiropres *);
552*0Sstevel@tonic-gate extern bool_t xdr_nfslog_getattrres(XDR *, struct nfsattrstat *);
553*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rrok(XDR *, struct nfsrrok *);
554*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rdresult(XDR *, struct nfsrdresult *);
555*0Sstevel@tonic-gate extern bool_t xdr_nfslog_writeargs(XDR *, struct nfswriteargs *);
556*0Sstevel@tonic-gate extern bool_t xdr_nfslog_writeresult(XDR *, struct nfsattrstat *);
557*0Sstevel@tonic-gate extern bool_t xdr_nfslog_createargs(XDR *, struct nfscreatargs *);
558*0Sstevel@tonic-gate extern bool_t xdr_nfslog_sattr(XDR *, struct nfssattr *);
559*0Sstevel@tonic-gate extern bool_t xdr_nfslog_setattrargs(XDR *, struct nfssaargs *);
560*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rdlnres(XDR *, struct nfsrdlnres *);
561*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rnmargs(XDR *, struct nfsrnmargs *);
562*0Sstevel@tonic-gate extern bool_t xdr_nfslog_symlinkargs(XDR *, struct nfsslargs *);
563*0Sstevel@tonic-gate extern bool_t xdr_nfslog_statfs(XDR *, struct nfsstatfs *);
564*0Sstevel@tonic-gate extern bool_t xdr_nfslog_linkargs(XDR *, struct nfslinkargs *);
565*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rddirargs(XDR *, struct nfsrddirargs *);
566*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rdok(XDR *, struct nfsrdok *);
567*0Sstevel@tonic-gate extern bool_t xdr_nfslog_rddirres(XDR *, struct nfsrddirres *);
568*0Sstevel@tonic-gate extern bool_t xdr_nfslog_diropargs3(XDR *, diropargs3 *);
569*0Sstevel@tonic-gate extern bool_t xdr_nfslog_LOOKUP3res(XDR *, LOOKUP3res *);
570*0Sstevel@tonic-gate extern bool_t xdr_nfslog_createhow3(XDR *, createhow3 *);
571*0Sstevel@tonic-gate extern bool_t xdr_nfslog_CREATE3args(XDR *, CREATE3args *);
572*0Sstevel@tonic-gate extern bool_t xdr_nfslog_CREATE3resok(XDR *, CREATE3resok *);
573*0Sstevel@tonic-gate extern bool_t xdr_nfslog_CREATE3res(XDR *, CREATE3res *);
574*0Sstevel@tonic-gate extern bool_t xdr_nfslog_GETATTR3res(XDR *, GETATTR3res *);
575*0Sstevel@tonic-gate extern bool_t xdr_nfslog_ACCESS3args(XDR *, ACCESS3args *);
576*0Sstevel@tonic-gate extern bool_t xdr_nfslog_ACCESS3res(XDR *, ACCESS3res *);
577*0Sstevel@tonic-gate extern bool_t xdr_nfslog_SETATTR3args(XDR *, SETATTR3args *);
578*0Sstevel@tonic-gate extern bool_t xdr_nfslog_SETATTR3res(XDR *, SETATTR3res *);
579*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READLINK3res(XDR *, READLINK3res *);
580*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READ3args(XDR *, READ3args *);
581*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READ3resok(XDR *, READ3resok *);
582*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READ3res(XDR *, READ3res *);
583*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READ3resok(XDR *, READ3resok *);
584*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READ3res(XDR *, READ3res *);
585*0Sstevel@tonic-gate extern bool_t xdr_nfslog_WRITE3args(XDR *, WRITE3args *);
586*0Sstevel@tonic-gate extern bool_t xdr_nfslog_WRITE3resok(XDR *, WRITE3resok *);
587*0Sstevel@tonic-gate extern bool_t xdr_nfslog_WRITE3res(XDR *, WRITE3res *);
588*0Sstevel@tonic-gate extern bool_t xdr_nfslog_MKDIR3args(XDR *, MKDIR3args *);
589*0Sstevel@tonic-gate extern bool_t xdr_nfslog_MKDIR3res(XDR *, MKDIR3res *);
590*0Sstevel@tonic-gate extern bool_t xdr_nfslog_SYMLINK3args(XDR *, SYMLINK3args *);
591*0Sstevel@tonic-gate extern bool_t xdr_nfslog_SYMLINK3res(XDR *, SYMLINK3res *);
592*0Sstevel@tonic-gate extern bool_t xdr_nfslog_MKNOD3args(XDR *, MKNOD3args *);
593*0Sstevel@tonic-gate extern bool_t xdr_nfslog_MKNOD3res(XDR *, MKNOD3res *);
594*0Sstevel@tonic-gate extern bool_t xdr_nfslog_REMOVE3args(XDR *, REMOVE3args *);
595*0Sstevel@tonic-gate extern bool_t xdr_nfslog_REMOVE3res(XDR *, REMOVE3res *);
596*0Sstevel@tonic-gate extern bool_t xdr_nfslog_RMDIR3args(XDR *, RMDIR3args *);
597*0Sstevel@tonic-gate extern bool_t xdr_nfslog_RMDIR3res(XDR *, RMDIR3res *);
598*0Sstevel@tonic-gate extern bool_t xdr_nfslog_RENAME3args(XDR *, RENAME3args *);
599*0Sstevel@tonic-gate extern bool_t xdr_nfslog_RENAME3res(XDR *, RENAME3res *);
600*0Sstevel@tonic-gate extern bool_t xdr_nfslog_LINK3args(XDR *, LINK3args *);
601*0Sstevel@tonic-gate extern bool_t xdr_nfslog_LINK3res(XDR *, LINK3res *);
602*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READDIR3args(XDR *, READDIR3args *);
603*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READDIR3res(XDR *, READDIR3res *);
604*0Sstevel@tonic-gate extern bool_t xdr_nfslog_FSSTAT3args(XDR *, FSSTAT3args *);
605*0Sstevel@tonic-gate extern bool_t xdr_nfslog_FSSTAT3res(XDR *, FSSTAT3res *);
606*0Sstevel@tonic-gate extern bool_t xdr_nfslog_FSINFO3args(XDR *, FSINFO3args *);
607*0Sstevel@tonic-gate extern bool_t xdr_nfslog_FSINFO3res(XDR *, FSINFO3res *);
608*0Sstevel@tonic-gate extern bool_t xdr_nfslog_PATHCONF3args(XDR *, PATHCONF3args *);
609*0Sstevel@tonic-gate extern bool_t xdr_nfslog_PATHCONF3res(XDR *, PATHCONF3res *);
610*0Sstevel@tonic-gate extern bool_t xdr_nfslog_COMMIT3args(XDR *, COMMIT3args *);
611*0Sstevel@tonic-gate extern bool_t xdr_nfslog_COMMIT3res(XDR *, COMMIT3res *);
612*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READDIRPLUS3args(XDR *, READDIRPLUS3args *);
613*0Sstevel@tonic-gate extern bool_t xdr_nfslog_READDIRPLUS3res(XDR *, READDIRPLUS3res *);
614*0Sstevel@tonic-gate extern bool_t xdr_nfslog_request_record(XDR *,	struct exportinfo *,
615*0Sstevel@tonic-gate 			struct svc_req *, cred_t *, struct netbuf *,
616*0Sstevel@tonic-gate 			unsigned int, unsigned int);
617*0Sstevel@tonic-gate 
618*0Sstevel@tonic-gate 
619*0Sstevel@tonic-gate #endif /* !_KERNEL */
620*0Sstevel@tonic-gate 
621*0Sstevel@tonic-gate #ifdef _KERNEL
622*0Sstevel@tonic-gate 
623*0Sstevel@tonic-gate /*
624*0Sstevel@tonic-gate  * Used to direct nfslog_write_record() on its behavior of
625*0Sstevel@tonic-gate  * writing log entries
626*0Sstevel@tonic-gate  */
627*0Sstevel@tonic-gate #define	NFSLOG_ALL_BUFFERS	1
628*0Sstevel@tonic-gate #define	NFSLOG_ONE_BUFFER	2
629*0Sstevel@tonic-gate 
630*0Sstevel@tonic-gate /* Sizes of the various memory allocations for encoding records */
631*0Sstevel@tonic-gate #define	NFSLOG_SMALL_RECORD_SIZE 512
632*0Sstevel@tonic-gate #define	NFSLOG_SMALL_REC_NAME	"nfslog_small_rec"
633*0Sstevel@tonic-gate #define	NFSLOG_MEDIUM_RECORD_SIZE 8192
634*0Sstevel@tonic-gate #define	NFSLOG_MEDIUM_REC_NAME	"nfslog_medium_rec"
635*0Sstevel@tonic-gate #define	NFSLOG_LARGE_RECORD_SIZE 32768
636*0Sstevel@tonic-gate #define	NFSLOG_LARGE_REC_NAME	"nfslog_large_rec"
637*0Sstevel@tonic-gate 
638*0Sstevel@tonic-gate /*
639*0Sstevel@tonic-gate  * Functions used for interaction with nfs logging
640*0Sstevel@tonic-gate  */
641*0Sstevel@tonic-gate extern bool_t	xdr_nfslog_buffer_header(XDR *, nfslog_buffer_header *);
642*0Sstevel@tonic-gate 
643*0Sstevel@tonic-gate extern void	nfslog_share_record(struct exportinfo *exi, cred_t *cr);
644*0Sstevel@tonic-gate extern void	nfslog_unshare_record(struct exportinfo *exi, cred_t *cr);
645*0Sstevel@tonic-gate extern void	nfslog_getfh(struct exportinfo *, fhandle *, char *,
646*0Sstevel@tonic-gate 		enum uio_seg, cred_t *);
647*0Sstevel@tonic-gate 
648*0Sstevel@tonic-gate extern void	nfslog_init();
649*0Sstevel@tonic-gate extern int	nfslog_setup(struct exportinfo *);
650*0Sstevel@tonic-gate extern void	nfslog_disable(struct exportinfo *);
651*0Sstevel@tonic-gate /*PRINTFLIKE2*/
652*0Sstevel@tonic-gate extern void	nfslog_dprint(const int, const char *fmt, ...)
653*0Sstevel@tonic-gate 	__KPRINTFLIKE(2);
654*0Sstevel@tonic-gate extern void	*nfslog_record_alloc(struct exportinfo *, int,
655*0Sstevel@tonic-gate 		void **, int);
656*0Sstevel@tonic-gate extern void	nfslog_record_free(void *, void *, size_t);
657*0Sstevel@tonic-gate extern struct	exportinfo *nfslog_get_exi(struct exportinfo *,
658*0Sstevel@tonic-gate 		struct svc_req *, caddr_t, unsigned int *);
659*0Sstevel@tonic-gate extern void	nfslog_write_record(struct exportinfo *, struct svc_req *,
660*0Sstevel@tonic-gate 		caddr_t, caddr_t, cred_t *, struct netbuf *, unsigned int,
661*0Sstevel@tonic-gate 		unsigned int);
662*0Sstevel@tonic-gate 
663*0Sstevel@tonic-gate extern struct log_buffer *nfslog_buffer_list;
664*0Sstevel@tonic-gate 
665*0Sstevel@tonic-gate /*
666*0Sstevel@tonic-gate  * Logging debug macro; expands to nothing for non-debug kernels.
667*0Sstevel@tonic-gate  */
668*0Sstevel@tonic-gate #ifndef DEBUG
669*0Sstevel@tonic-gate #define	LOGGING_DPRINT(x)
670*0Sstevel@tonic-gate #else
671*0Sstevel@tonic-gate #define	LOGGING_DPRINT(x)	nfslog_dprint x
672*0Sstevel@tonic-gate #endif
673*0Sstevel@tonic-gate 
674*0Sstevel@tonic-gate #endif
675*0Sstevel@tonic-gate 
676*0Sstevel@tonic-gate #ifdef	__cplusplus
677*0Sstevel@tonic-gate }
678*0Sstevel@tonic-gate #endif
679*0Sstevel@tonic-gate 
680*0Sstevel@tonic-gate #endif	/* _NFS_LOG_H */
681