summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/nfs/nfs_log.h
blob: ff0f38a455b192cd6b4efb0e4f95d6b7d3a54485 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_NFS_LOG_H
#define	_NFS_LOG_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

#include <nfs/nfs.h>
#include <nfs/export.h>
#include <rpc/rpc.h>

#define	LOG_MODE		0600	/* open log with these permissions */
#define	LOG_INPROG_STRING	"_log_in_process"

/*
 * Definition of dummy program for logging special non-nfs reqs
 */
#define	NFSLOG_PROGRAM		((rpcprog_t)42)
#define	NFSLOG_VERSION		((rpcvers_t)1)

#define	NFSLOG_VERSMIN		((rpcvers_t)1)
#define	NFSLOG_VERSMAX		((rpcvers_t)1)

#define	NFSLOG_NULL		((rpcproc_t)0)
#define	NFSLOG_SHARE		((rpcproc_t)1)
#define	NFSLOG_UNSHARE		((rpcproc_t)2)
#define	NFSLOG_LOOKUP		((rpcproc_t)3)
#define	NFSLOG_GETFH		((rpcproc_t)4)

/*
 * Version of the on disk log file
 */
#define	NFSLOG_BUF_VERSION	((rpcvers_t)2)

#define	NFSLOG_BUF_VERSMIN	((rpcvers_t)1)
#define	NFSLOG_BUF_VERSMAX	((rpcvers_t)2)
/*
 * Contents of the on disk log file header
 *
 * Note: This is the structure for older version 1 buffers, and does not
 * adequately support large buffer files, as the offset is 32 bit. Newer
 * buffer files are written using version 2 buffer header (below) which
 * has a 64 bit offset. However, because existing buffers continue to use
 * the old header format, the daemon xdr code can read and write either format.
 * This definition below is not explicitely used anywhere in the code,
 * but is implicitely used by the daemon xdr code. For that reason, it
 * is kept here for information purpose only.
 */
struct nfslog_buffer_header_1 {
	uint32_t bh_length;		/* Length of this header */
	uint32_t bh_version;		/* Version of buffer contents */
	uint32_t bh_flags;		/* Optional flags field */
	uint32_t bh_offset;		/* offset within file to begin */
	timestruc32_t bh_timestamp;	/* When the buffer was created */
};
typedef struct nfslog_buffer_header_1 nfslog_buffer_header_1;

/*
 * For the current version 2, which supports largefiles
 */
struct nfslog_buffer_header_2 {
	uint32_t bh_length;		/* Length of this header */
	rpcvers_t bh_version;		/* Version of buffer contents */
	u_offset_t bh_offset;		/* offset within file to begin */
	uint32_t bh_flags;		/* Optional flags field */
	timestruc32_t bh_timestamp;	/* When the buffer was created */
};
typedef struct nfslog_buffer_header_2 nfslog_buffer_header_2;

typedef struct nfslog_buffer_header_2 nfslog_buffer_header;

/* bh_flags values */
#define	NFSLOG_BH_OFFSET_OVERFLOW	1	/* version 1 bh_offset */

/*
 * For each record written to the log file, this struct is used
 * as the logical header; it will be XDR encoded to be written to the file.
 *
 * Note: if the buffer file becomes large enough, the rh_rec_id may
 * wrap around. This situation is appropriately handled by the daemon however.
 */
struct nfslog_record_header {
	uint32_t rh_reclen;		/* Length of entire record */
	uint32_t rh_rec_id;		/* unique id for this log */
	rpcprog_t rh_prognum;		/* Program number */
	rpcproc_t rh_procnum;		/* Procedure number */
	rpcvers_t rh_version;		/* Version number */
	uint32_t rh_auth_flavor;	/* Auth flavor of RPC request */
	timestruc32_t rh_timestamp;	/* time stamp of the request */
	uid_t rh_uid;			/* uid of requestor as per RPC */
	gid_t rh_gid;			/* gid of requestor as per RPC */
};
typedef struct nfslog_record_header nfslog_record_header;

/*
 * For each record written to the log file, this is the logical
 * structure of the record; it will be XDR encoded and written to
 * the file.
 */
struct nfslog_request_record {
	nfslog_record_header re_header;	/* Header as defined above */
	char *re_principal_name;	/* Principal name of caller */
	char *re_netid;			/* Netid used for request */
	char *re_tag;			/* Log buffer tag for file system */
	struct netbuf re_ipaddr;	/* Requestors ip address */
	caddr_t re_rpc_arg;		/* RPC arguments and response */
	caddr_t re_rpc_res;
};
typedef struct nfslog_request_record nfslog_request_record;

/*
 * From this point forward, the definitions represent the arguments
 * and results of each possible RPC that can be logged.  These
 * may have been trimmed in content from the real RPC arguments
 * and results to save space.
 */
typedef fhandle_t fhandle;

struct nfslog_sharefsargs {
	int sh_flags;
	uint32_t sh_anon;
	char *sh_path;
	fhandle sh_fh_buf;
};
typedef struct nfslog_sharefsargs nfslog_sharefsargs;

typedef nfsstat nfslog_sharefsres;

struct nfslog_getfhargs {
	fhandle gfh_fh_buf;
	char *gfh_path;
};
typedef struct nfslog_getfhargs nfslog_getfhargs;

struct nfslog_diropargs {
	fhandle da_fhandle;
	char *da_name;
};
typedef struct nfslog_diropargs nfslog_diropargs;

struct nfslog_drok {
	fhandle drok_fhandle;
};
typedef struct nfslog_drok nfslog_drok;

struct nfslog_diropres {
	nfsstat dr_status;
	union {
		nfslog_drok dr_ok;
	} nfslog_diropres_u;
};
typedef struct nfslog_diropres nfslog_diropres;

typedef struct nfsreadargs nfslog_nfsreadargs;

struct nfslog_rrok {
	uint32_t filesize;
	uint32_t rrok_count;
};
typedef struct nfslog_rrok nfslog_rrok;

struct nfslog_rdresult {
	nfsstat r_status;
	union {
		nfslog_rrok r_ok;
	} nfslog_rdresult_u;
};
typedef struct nfslog_rdresult nfslog_rdresult;

struct nfslog_writeargs {
	fhandle waargs_fhandle;
	uint32_t waargs_begoff;
	uint32_t waargs_offset;
	uint32_t waargs_totcount;
	uint32_t waargs_count;
};
typedef struct nfslog_writeargs nfslog_writeargs;

struct nfslog_writeresult {
	nfsstat wr_status;
	union {
		uint32_t wr_size;
	} nfslog_writeresult_u;
};
typedef struct nfslog_writeresult nfslog_writeresult;

struct nfslog_sattr {
	uint32_t sa_mode;
	uint32_t sa_uid;
	uint32_t sa_gid;
	uint32_t sa_size;
	nfs2_timeval sa_atime;
	nfs2_timeval sa_mtime;
};
typedef struct nfslog_sattr nfslog_sattr;

struct nfslog_createargs {
	nfslog_sattr ca_sa;
	nfslog_diropargs ca_da;
};
typedef struct nfslog_createargs nfslog_createargs;

struct nfslog_setattrargs {
	fhandle saa_fh;
	nfslog_sattr saa_sa;
};
typedef struct nfslog_setattrargs nfslog_setattrargs;

struct nfslog_rdlnres {
	nfsstat rl_status;
	union {
		char *rl_ok;
	} nfslog_rdlnres_u;
};
typedef struct nfslog_rdlnres nfslog_rdlnres;

struct nfslog_rnmargs {
	nfslog_diropargs rna_from;
	nfslog_diropargs rna_to;
};
typedef struct nfslog_rnmargs nfslog_rnmargs;

struct nfslog_linkargs {
	fhandle la_from;
	nfslog_diropargs la_to;
};
typedef struct nfslog_linkargs nfslog_linkargs;

struct nfslog_symlinkargs {
	nfslog_diropargs sla_from;
	char *sla_tnm;
	nfslog_sattr sla_sa;
};
typedef struct nfslog_symlinkargs nfslog_symlinkargs;

struct nfslog_rddirargs {
	fhandle rda_fh;
	uint32_t rda_offset;
	uint32_t rda_count;
};
typedef struct nfslog_rddirargs nfslog_rddirargs;

struct nfslog_rdok {
	uint32_t rdok_offset;
	uint32_t rdok_size;
	bool_t rdok_eof;
};
typedef struct nfslog_rdok nfslog_rdok;

struct nfslog_rddirres {
	nfsstat rd_status;
	union {
		nfslog_rdok rd_ok;
	} nfslog_rddirres_u;
};
typedef struct nfslog_rddirres nfslog_rddirres;

struct nfslog_diropargs3 {
	nfs_fh3 dir;
	char *name;
};
typedef struct nfslog_diropargs3 nfslog_diropargs3;

struct nfslog_LOOKUP3res {
	nfsstat3 status;
	union {
		nfs_fh3 object;
	} nfslog_LOOKUP3res_u;
};
typedef struct nfslog_LOOKUP3res nfslog_LOOKUP3res;

struct nfslog_createhow3 {
	createmode3 mode;
	union {
		set_size3 size;
	} nfslog_createhow3_u;
};
typedef struct nfslog_createhow3 nfslog_createhow3;

struct nfslog_CREATE3args {
	nfslog_diropargs3 where;
	nfslog_createhow3 how;
};
typedef struct nfslog_CREATE3args nfslog_CREATE3args;

struct nfslog_CREATE3resok {
	post_op_fh3 obj;
};
typedef struct nfslog_CREATE3resok nfslog_CREATE3resok;

struct nfslog_CREATE3res {
	nfsstat3 status;
	union {
		nfslog_CREATE3resok ok;
	} nfslog_CREATE3res_u;
};
typedef struct nfslog_CREATE3res nfslog_CREATE3res;

struct nfslog_SETATTR3args {
	nfs_fh3 object;
	set_size3 size;
};
typedef struct nfslog_SETATTR3args nfslog_SETATTR3args;

struct nfslog_READLINK3res {
	nfsstat3 status;
	union {
		char *data;
	} nfslog_READLINK3res_u;
};
typedef struct nfslog_READLINK3res nfslog_READLINK3res;

struct nfslog_READ3args {
	nfs_fh3 file;
	offset3 offset;
	count3 count;
};
typedef struct nfslog_READ3args nfslog_READ3args;

struct nfslog_READ3resok {
	size3 filesize;
	count3 count;
	bool_t eof;
	uint32_t size;
};
typedef struct nfslog_READ3resok nfslog_READ3resok;

struct nfslog_READ3res {
	nfsstat3 status;
	union {
		nfslog_READ3resok ok;
	} nfslog_READ3res_u;
};
typedef struct nfslog_READ3res nfslog_READ3res;

struct nfslog_WRITE3args {
	nfs_fh3 file;
	offset3 offset;
	count3 count;
	stable_how stable;
};
typedef struct nfslog_WRITE3args nfslog_WRITE3args;

struct nfslog_WRITE3resok {
	size3 filesize;
	count3 count;
	stable_how committed;
};
typedef struct nfslog_WRITE3resok nfslog_WRITE3resok;

struct nfslog_WRITE3res {
	nfsstat3 status;
	union {
		nfslog_WRITE3resok ok;
	} nfslog_WRITE3res_u;
};
typedef struct nfslog_WRITE3res nfslog_WRITE3res;

struct nfslog_MKDIR3args {
	nfslog_diropargs3 where;
};
typedef struct nfslog_MKDIR3args nfslog_MKDIR3args;

struct nfslog_MKDIR3res {
	nfsstat3 status;
	union {
		post_op_fh3 obj;
	} nfslog_MKDIR3res_u;
};
typedef struct nfslog_MKDIR3res nfslog_MKDIR3res;

struct nfslog_SYMLINK3args {
	nfslog_diropargs3 where;
	char *symlink_data;
};
typedef struct nfslog_SYMLINK3args nfslog_SYMLINK3args;

struct nfslog_SYMLINK3res {
	nfsstat3 status;
	union {
		post_op_fh3 obj;
	} nfslog_SYMLINK3res_u;
};
typedef struct nfslog_SYMLINK3res nfslog_SYMLINK3res;

struct nfslog_MKNOD3args {
	nfslog_diropargs3 where;
	ftype3 type;
};
typedef struct nfslog_MKNOD3args nfslog_MKNOD3args;

struct nfslog_MKNOD3res {
	nfsstat3 status;
	union {
		post_op_fh3 obj;
	} nfslog_MKNOD3res_u;
};
typedef struct nfslog_MKNOD3res nfslog_MKNOD3res;

struct nfslog_REMOVE3args {
	nfslog_diropargs3 object;
};
typedef struct nfslog_REMOVE3args nfslog_REMOVE3args;

struct nfslog_RMDIR3args {
	nfslog_diropargs3 object;
};
typedef struct nfslog_RMDIR3args nfslog_RMDIR3args;

struct nfslog_RENAME3args {
	nfslog_diropargs3 from;
	nfslog_diropargs3 to;
};
typedef struct nfslog_RENAME3args nfslog_RENAME3args;

struct nfslog_LINK3args {
	nfs_fh3 file;
	nfslog_diropargs3 link;
};
typedef struct nfslog_LINK3args nfslog_LINK3args;

struct nfslog_READDIRPLUS3args {
	nfs_fh3 dir;
	count3 dircount;
	count3 maxcount;
};
typedef struct nfslog_READDIRPLUS3args nfslog_READDIRPLUS3args;

struct nfslog_entryplus3 {
	post_op_fh3 name_handle;
	char *name;
	struct nfslog_entryplus3 *nextentry;
};
typedef struct nfslog_entryplus3 nfslog_entryplus3;

struct nfslog_dirlistplus3 {
	nfslog_entryplus3 *entries;
	bool_t eof;
};
typedef struct nfslog_dirlistplus3 nfslog_dirlistplus3;

struct nfslog_READDIRPLUS3resok {
	nfslog_dirlistplus3 reply;
};
typedef struct nfslog_READDIRPLUS3resok nfslog_READDIRPLUS3resok;

struct nfslog_READDIRPLUS3res {
	nfsstat3 status;
	union {
		nfslog_READDIRPLUS3resok ok;
	} nfslog_READDIRPLUS3res_u;
};
typedef struct nfslog_READDIRPLUS3res nfslog_READDIRPLUS3res;

struct nfslog_COMMIT3args {
	nfs_fh3 file;
	offset3 offset;
	count3 count;
};
typedef struct nfslog_COMMIT3args nfslog_COMMIT3args;

/* the xdr functions */
#ifndef _KERNEL

extern bool_t xdr_nfsstat(XDR *, nfsstat *);
extern bool_t xdr_uint64(XDR *, uint64 *);
extern bool_t xdr_uint32(XDR *, uint32 *);
extern bool_t xdr_fhandle(XDR *, fhandle_t *);
extern bool_t xdr_nfs_fh3(XDR *, nfs_fh3 *);
extern bool_t xdr_nfsstat3(XDR *, nfsstat3 *);
extern bool_t xdr_nfslog_buffer_header(XDR *, nfslog_buffer_header *);
extern bool_t xdr_nfslog_request_record(XDR *, nfslog_request_record *);
extern bool_t xdr_nfslog_sharefsargs(XDR *, nfslog_sharefsargs *);
extern bool_t xdr_nfslog_sharefsres(XDR *, nfslog_sharefsres *);
extern bool_t xdr_nfslog_getfhargs(XDR *, nfslog_getfhargs *);
extern bool_t xdr_nfslog_diropargs(XDR *, nfslog_diropargs *);
extern bool_t xdr_nfslog_diropres(XDR *, nfslog_diropres *);
extern bool_t xdr_nfslog_nfsreadargs(XDR *, nfslog_nfsreadargs *);
extern bool_t xdr_nfslog_rdresult(XDR *, nfslog_rdresult *);
extern bool_t xdr_nfslog_writeargs(XDR *, nfslog_writeargs *);
extern bool_t xdr_nfslog_writeresult(XDR *, nfslog_writeresult *);
extern bool_t xdr_nfslog_createargs(XDR *, nfslog_createargs *);
extern bool_t xdr_nfslog_setattrargs(XDR *, nfslog_setattrargs *);
extern bool_t xdr_nfslog_rdlnres(XDR *, nfslog_rdlnres *);
extern bool_t xdr_nfslog_rnmargs(XDR *, nfslog_rnmargs *);
extern bool_t xdr_nfslog_linkargs(XDR *, nfslog_linkargs *);
extern bool_t xdr_nfslog_symlinkargs(XDR *, nfslog_symlinkargs *);
extern bool_t xdr_nfslog_rddirargs(XDR *, nfslog_rddirargs *);
extern bool_t xdr_nfslog_rddirres(XDR *, nfslog_rddirres *);
extern bool_t xdr_nfslog_diropargs3(XDR *, nfslog_diropargs3 *);
extern bool_t xdr_nfslog_LOOKUP3res(XDR *, nfslog_LOOKUP3res *);
extern bool_t xdr_nfslog_CREATE3args(XDR *, nfslog_CREATE3args *);
extern bool_t xdr_nfslog_CREATE3res(XDR *, nfslog_CREATE3res *);
extern bool_t xdr_nfslog_SETATTR3args(XDR *, nfslog_SETATTR3args *);
extern bool_t xdr_nfslog_READLINK3res(XDR *, nfslog_READLINK3res *);
extern bool_t xdr_nfslog_READ3args(XDR *, nfslog_READ3args *);
extern bool_t xdr_nfslog_READ3res(XDR *, nfslog_READ3res *);
extern bool_t xdr_nfslog_WRITE3args(XDR *, nfslog_WRITE3args *);
extern bool_t xdr_nfslog_WRITE3res(XDR *, nfslog_WRITE3res *);
extern bool_t xdr_nfslog_MKDIR3args(XDR *, nfslog_MKDIR3args *);
extern bool_t xdr_nfslog_MKDIR3res(XDR *, nfslog_MKDIR3res *);
extern bool_t xdr_nfslog_SYMLINK3args(XDR *, nfslog_SYMLINK3args *);
extern bool_t xdr_nfslog_SYMLINK3res(XDR *, nfslog_SYMLINK3res *);
extern bool_t xdr_nfslog_MKNOD3args(XDR *, nfslog_MKNOD3args *);
extern bool_t xdr_nfslog_MKNOD3res(XDR *, nfslog_MKNOD3res *);
extern bool_t xdr_nfslog_REMOVE3args(XDR *, nfslog_REMOVE3args *);
extern bool_t xdr_nfslog_RMDIR3args(XDR *, nfslog_RMDIR3args *);
extern bool_t xdr_nfslog_RENAME3args(XDR *, nfslog_RENAME3args *);
extern bool_t xdr_nfslog_LINK3args(XDR *, nfslog_LINK3args *);
extern bool_t xdr_nfslog_READDIRPLUS3args(XDR *, nfslog_READDIRPLUS3args *);
extern bool_t xdr_nfslog_READDIRPLUS3res(XDR *, nfslog_READDIRPLUS3res *);
extern bool_t xdr_nfslog_COMMIT3args(XDR *, nfslog_COMMIT3args *);

#else /* !_KERNEL */

extern bool_t xdr_nfsstat(XDR *, nfsstat *);
extern bool_t xdr_nfslog_nfsreadargs(XDR *, nfslog_nfsreadargs *);
extern bool_t xdr_nfslog_sharefsres(XDR *, nfslog_sharefsres *);
extern bool_t xdr_nfslog_sharefsargs(XDR *, struct exportinfo *);
extern bool_t xdr_nfslog_getfhargs(XDR *, nfslog_getfhargs *);
extern bool_t xdr_nfslog_diropargs(XDR *, struct nfsdiropargs *);
extern bool_t xdr_nfslog_drok(XDR *, struct nfsdrok *);
extern bool_t xdr_nfslog_diropres(XDR *, struct nfsdiropres *);
extern bool_t xdr_nfslog_getattrres(XDR *, struct nfsattrstat *);
extern bool_t xdr_nfslog_rrok(XDR *, struct nfsrrok *);
extern bool_t xdr_nfslog_rdresult(XDR *, struct nfsrdresult *);
extern bool_t xdr_nfslog_writeargs(XDR *, struct nfswriteargs *);
extern bool_t xdr_nfslog_writeresult(XDR *, struct nfsattrstat *);
extern bool_t xdr_nfslog_createargs(XDR *, struct nfscreatargs *);
extern bool_t xdr_nfslog_sattr(XDR *, struct nfssattr *);
extern bool_t xdr_nfslog_setattrargs(XDR *, struct nfssaargs *);
extern bool_t xdr_nfslog_rdlnres(XDR *, struct nfsrdlnres *);
extern bool_t xdr_nfslog_rnmargs(XDR *, struct nfsrnmargs *);
extern bool_t xdr_nfslog_symlinkargs(XDR *, struct nfsslargs *);
extern bool_t xdr_nfslog_statfs(XDR *, struct nfsstatfs *);
extern bool_t xdr_nfslog_linkargs(XDR *, struct nfslinkargs *);
extern bool_t xdr_nfslog_rddirargs(XDR *, struct nfsrddirargs *);
extern bool_t xdr_nfslog_rdok(XDR *, struct nfsrdok *);
extern bool_t xdr_nfslog_rddirres(XDR *, struct nfsrddirres *);
extern bool_t xdr_nfslog_diropargs3(XDR *, diropargs3 *);
extern bool_t xdr_nfslog_LOOKUP3res(XDR *, LOOKUP3res *);
extern bool_t xdr_nfslog_createhow3(XDR *, createhow3 *);
extern bool_t xdr_nfslog_CREATE3args(XDR *, CREATE3args *);
extern bool_t xdr_nfslog_CREATE3resok(XDR *, CREATE3resok *);
extern bool_t xdr_nfslog_CREATE3res(XDR *, CREATE3res *);
extern bool_t xdr_nfslog_GETATTR3res(XDR *, GETATTR3res *);
extern bool_t xdr_nfslog_ACCESS3args(XDR *, ACCESS3args *);
extern bool_t xdr_nfslog_ACCESS3res(XDR *, ACCESS3res *);
extern bool_t xdr_nfslog_SETATTR3args(XDR *, SETATTR3args *);
extern bool_t xdr_nfslog_SETATTR3res(XDR *, SETATTR3res *);
extern bool_t xdr_nfslog_READLINK3res(XDR *, READLINK3res *);
extern bool_t xdr_nfslog_READ3args(XDR *, READ3args *);
extern bool_t xdr_nfslog_READ3resok(XDR *, READ3resok *);
extern bool_t xdr_nfslog_READ3res(XDR *, READ3res *);
extern bool_t xdr_nfslog_READ3resok(XDR *, READ3resok *);
extern bool_t xdr_nfslog_READ3res(XDR *, READ3res *);
extern bool_t xdr_nfslog_WRITE3args(XDR *, WRITE3args *);
extern bool_t xdr_nfslog_WRITE3resok(XDR *, WRITE3resok *);
extern bool_t xdr_nfslog_WRITE3res(XDR *, WRITE3res *);
extern bool_t xdr_nfslog_MKDIR3args(XDR *, MKDIR3args *);
extern bool_t xdr_nfslog_MKDIR3res(XDR *, MKDIR3res *);
extern bool_t xdr_nfslog_SYMLINK3args(XDR *, SYMLINK3args *);
extern bool_t xdr_nfslog_SYMLINK3res(XDR *, SYMLINK3res *);
extern bool_t xdr_nfslog_MKNOD3args(XDR *, MKNOD3args *);
extern bool_t xdr_nfslog_MKNOD3res(XDR *, MKNOD3res *);
extern bool_t xdr_nfslog_REMOVE3args(XDR *, REMOVE3args *);
extern bool_t xdr_nfslog_REMOVE3res(XDR *, REMOVE3res *);
extern bool_t xdr_nfslog_RMDIR3args(XDR *, RMDIR3args *);
extern bool_t xdr_nfslog_RMDIR3res(XDR *, RMDIR3res *);
extern bool_t xdr_nfslog_RENAME3args(XDR *, RENAME3args *);
extern bool_t xdr_nfslog_RENAME3res(XDR *, RENAME3res *);
extern bool_t xdr_nfslog_LINK3args(XDR *, LINK3args *);
extern bool_t xdr_nfslog_LINK3res(XDR *, LINK3res *);
extern bool_t xdr_nfslog_READDIR3args(XDR *, READDIR3args *);
extern bool_t xdr_nfslog_READDIR3res(XDR *, READDIR3res *);
extern bool_t xdr_nfslog_FSSTAT3args(XDR *, FSSTAT3args *);
extern bool_t xdr_nfslog_FSSTAT3res(XDR *, FSSTAT3res *);
extern bool_t xdr_nfslog_FSINFO3args(XDR *, FSINFO3args *);
extern bool_t xdr_nfslog_FSINFO3res(XDR *, FSINFO3res *);
extern bool_t xdr_nfslog_PATHCONF3args(XDR *, PATHCONF3args *);
extern bool_t xdr_nfslog_PATHCONF3res(XDR *, PATHCONF3res *);
extern bool_t xdr_nfslog_COMMIT3args(XDR *, COMMIT3args *);
extern bool_t xdr_nfslog_COMMIT3res(XDR *, COMMIT3res *);
extern bool_t xdr_nfslog_READDIRPLUS3args(XDR *, READDIRPLUS3args *);
extern bool_t xdr_nfslog_READDIRPLUS3res(XDR *, READDIRPLUS3res *);
extern bool_t xdr_nfslog_request_record(XDR *,	struct exportinfo *,
			struct svc_req *, cred_t *, struct netbuf *,
			unsigned int, unsigned int);


#endif /* !_KERNEL */

#ifdef _KERNEL

/*
 * Used to direct nfslog_write_record() on its behavior of
 * writing log entries
 */
#define	NFSLOG_ALL_BUFFERS	1
#define	NFSLOG_ONE_BUFFER	2

/* Sizes of the various memory allocations for encoding records */
#define	NFSLOG_SMALL_RECORD_SIZE 512
#define	NFSLOG_SMALL_REC_NAME	"nfslog_small_rec"
#define	NFSLOG_MEDIUM_RECORD_SIZE 8192
#define	NFSLOG_MEDIUM_REC_NAME	"nfslog_medium_rec"
#define	NFSLOG_LARGE_RECORD_SIZE 32768
#define	NFSLOG_LARGE_REC_NAME	"nfslog_large_rec"

/*
 * Functions used for interaction with nfs logging
 */
extern bool_t	xdr_nfslog_buffer_header(XDR *, nfslog_buffer_header *);

extern void	nfslog_share_record(struct exportinfo *exi, cred_t *cr);
extern void	nfslog_unshare_record(struct exportinfo *exi, cred_t *cr);
extern void	nfslog_getfh(struct exportinfo *, fhandle *, char *,
		enum uio_seg, cred_t *);

extern void	nfslog_init();
extern int	nfslog_setup(struct exportinfo *);
extern void	nfslog_disable(struct exportinfo *);
/*PRINTFLIKE2*/
extern void	nfslog_dprint(const int, const char *fmt, ...)
	__KPRINTFLIKE(2);
extern void	*nfslog_record_alloc(struct exportinfo *, int,
		void **, int);
extern void	nfslog_record_free(void *, void *, size_t);
extern struct	exportinfo *nfslog_get_exi(struct exportinfo *,
		struct svc_req *, caddr_t, unsigned int *);
extern void	nfslog_write_record(struct exportinfo *, struct svc_req *,
		caddr_t, caddr_t, cred_t *, struct netbuf *, unsigned int,
		unsigned int);

extern struct log_buffer *nfslog_buffer_list;

/*
 * Logging debug macro; expands to nothing for non-debug kernels.
 */
#ifndef DEBUG
#define	LOGGING_DPRINT(x)
#else
#define	LOGGING_DPRINT(x)	nfslog_dprint x
#endif

#endif

#ifdef	__cplusplus
}
#endif

#endif	/* _NFS_LOG_H */