nfs_log.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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
* 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
#define LOG_INPROG_STRING "_log_in_process"
/*
* Definition of dummy program for logging special non-nfs reqs
*/
#define NFSLOG_NULL ((rpcproc_t)0)
/*
* Version of the on disk log file
*/
/*
* 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 {
};
typedef struct nfslog_buffer_header_1 nfslog_buffer_header_1;
/*
* For the current version 2, which supports largefiles
*/
struct nfslog_buffer_header_2 {
};
typedef struct nfslog_buffer_header_2 nfslog_buffer_header_2;
typedef struct nfslog_buffer_header_2 nfslog_buffer_header;
/* bh_flags values */
/*
* 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 {
};
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 {
char *re_principal_name; /* Principal name of caller */
char *re_netid; /* Netid used for request */
char *re_tag; /* Log buffer tag for file system */
};
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.
*/
struct nfslog_sharefsargs {
int sh_flags;
char *sh_path;
};
typedef struct nfslog_sharefsargs nfslog_sharefsargs;
typedef nfsstat nfslog_sharefsres;
struct nfslog_getfhargs {
char *gfh_path;
};
typedef struct nfslog_getfhargs nfslog_getfhargs;
struct nfslog_diropargs {
char *da_name;
};
typedef struct nfslog_diropargs nfslog_diropargs;
struct nfslog_drok {
};
typedef struct nfslog_drok nfslog_drok;
struct nfslog_diropres {
union {
};
typedef struct nfslog_diropres nfslog_diropres;
typedef struct nfsreadargs nfslog_nfsreadargs;
struct nfslog_rrok {
};
typedef struct nfslog_rrok nfslog_rrok;
struct nfslog_rdresult {
union {
};
typedef struct nfslog_rdresult nfslog_rdresult;
struct nfslog_writeargs {
};
typedef struct nfslog_writeargs nfslog_writeargs;
struct nfslog_writeresult {
union {
};
typedef struct nfslog_writeresult nfslog_writeresult;
struct nfslog_sattr {
};
typedef struct nfslog_sattr nfslog_sattr;
struct nfslog_createargs {
};
typedef struct nfslog_createargs nfslog_createargs;
struct nfslog_setattrargs {
};
typedef struct nfslog_setattrargs nfslog_setattrargs;
struct nfslog_rdlnres {
union {
char *rl_ok;
};
typedef struct nfslog_rdlnres nfslog_rdlnres;
struct nfslog_rnmargs {
};
typedef struct nfslog_rnmargs nfslog_rnmargs;
struct nfslog_linkargs {
};
typedef struct nfslog_linkargs nfslog_linkargs;
struct nfslog_symlinkargs {
char *sla_tnm;
};
typedef struct nfslog_symlinkargs nfslog_symlinkargs;
struct nfslog_rddirargs {
};
typedef struct nfslog_rddirargs nfslog_rddirargs;
struct nfslog_rdok {
};
typedef struct nfslog_rdok nfslog_rdok;
struct nfslog_rddirres {
union {
};
typedef struct nfslog_rddirres nfslog_rddirres;
struct nfslog_diropargs3 {
char *name;
};
typedef struct nfslog_diropargs3 nfslog_diropargs3;
struct nfslog_LOOKUP3res {
union {
};
typedef struct nfslog_LOOKUP3res nfslog_LOOKUP3res;
struct nfslog_createhow3 {
union {
};
typedef struct nfslog_createhow3 nfslog_createhow3;
struct nfslog_CREATE3args {
};
typedef struct nfslog_CREATE3args nfslog_CREATE3args;
struct nfslog_CREATE3resok {
};
typedef struct nfslog_CREATE3resok nfslog_CREATE3resok;
struct nfslog_CREATE3res {
union {
};
typedef struct nfslog_CREATE3res nfslog_CREATE3res;
struct nfslog_SETATTR3args {
};
typedef struct nfslog_SETATTR3args nfslog_SETATTR3args;
struct nfslog_READLINK3res {
union {
char *data;
};
typedef struct nfslog_READLINK3res nfslog_READLINK3res;
struct nfslog_READ3args {
};
typedef struct nfslog_READ3args nfslog_READ3args;
struct nfslog_READ3resok {
};
typedef struct nfslog_READ3resok nfslog_READ3resok;
struct nfslog_READ3res {
union {
};
typedef struct nfslog_READ3res nfslog_READ3res;
struct nfslog_WRITE3args {
};
typedef struct nfslog_WRITE3args nfslog_WRITE3args;
struct nfslog_WRITE3resok {
};
typedef struct nfslog_WRITE3resok nfslog_WRITE3resok;
struct nfslog_WRITE3res {
union {
};
typedef struct nfslog_WRITE3res nfslog_WRITE3res;
struct nfslog_MKDIR3args {
};
typedef struct nfslog_MKDIR3args nfslog_MKDIR3args;
struct nfslog_MKDIR3res {
union {
};
typedef struct nfslog_MKDIR3res nfslog_MKDIR3res;
struct nfslog_SYMLINK3args {
char *symlink_data;
};
typedef struct nfslog_SYMLINK3args nfslog_SYMLINK3args;
struct nfslog_SYMLINK3res {
union {
};
typedef struct nfslog_SYMLINK3res nfslog_SYMLINK3res;
struct nfslog_MKNOD3args {
};
typedef struct nfslog_MKNOD3args nfslog_MKNOD3args;
struct nfslog_MKNOD3res {
union {
};
typedef struct nfslog_MKNOD3res nfslog_MKNOD3res;
struct nfslog_REMOVE3args {
};
typedef struct nfslog_REMOVE3args nfslog_REMOVE3args;
struct nfslog_RMDIR3args {
};
typedef struct nfslog_RMDIR3args nfslog_RMDIR3args;
struct nfslog_RENAME3args {
};
typedef struct nfslog_RENAME3args nfslog_RENAME3args;
struct nfslog_LINK3args {
};
typedef struct nfslog_LINK3args nfslog_LINK3args;
struct nfslog_READDIRPLUS3args {
};
typedef struct nfslog_READDIRPLUS3args nfslog_READDIRPLUS3args;
struct nfslog_entryplus3 {
char *name;
struct nfslog_entryplus3 *nextentry;
};
typedef struct nfslog_entryplus3 nfslog_entryplus3;
struct nfslog_dirlistplus3 {
};
typedef struct nfslog_dirlistplus3 nfslog_dirlistplus3;
struct nfslog_READDIRPLUS3resok {
};
typedef struct nfslog_READDIRPLUS3resok nfslog_READDIRPLUS3resok;
struct nfslog_READDIRPLUS3res {
union {
};
typedef struct nfslog_READDIRPLUS3res nfslog_READDIRPLUS3res;
struct nfslog_COMMIT3args {
};
typedef struct nfslog_COMMIT3args nfslog_COMMIT3args;
/* the xdr functions */
#ifndef _KERNEL
#else /* !_KERNEL */
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 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);
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 */