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