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