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