xref: /illumos-gate/usr/src/cmd/fs.d/nfs/lib/nfslog_config.h (revision 71269a2275bf5a143dad6461eee2710a344e7261)
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 (c) 1999 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _NFS_NFSLOG_CONFIG_H
28 #define	_NFS_NFSLOG_CONFIG_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Internal configuration file API for NFS logging.
34  *
35  * Warning: This code is likely to change drastically in future releases.
36  */
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 #ifndef LINTHAPPY
43 #define	LINTHAPPY
44 #endif
45 
46 #define	MAX_LINESZ		4096
47 
48 #define	NFSL_CONFIG_FILE_PATH	"/etc/nfs/nfslog.conf"
49 #define	DEFAULTTAG		"global"
50 #define	DEFAULTRAWTAG		"global-raw"
51 #define	DEFAULTDIR		"/var/nfs"
52 #define	BUFFERPATH		"nfslog_workbuffer"
53 #define	FHPATH			"fhtable"
54 #define	LOGPATH			"nfslog"
55 
56 enum translog_format {
57 	TRANSLOG_BASIC, TRANSLOG_EXTENDED
58 };
59 
60 /*
61  * This struct is used to get or set the logging state for a filesystem.
62  * Using a single struct like this is okay for for releases where it's
63  * private, but it's questionable as a
64  * public API, because of extensibility and binary compatibility issues.
65  *
66  * Relative paths are interpreted relative to the root of the exported
67  * directory tree.
68  */
69 typedef struct nfsl_config {
70 	uint_t			nc_flags;
71 	char			*nc_name;	/* tag or "global" */
72 	char			*nc_defaultdir;
73 	char			*nc_logpath;
74 	char			*nc_fhpath;
75 	char			*nc_bufferpath;
76 	char			*nc_rpclogpath;
77 	enum translog_format	nc_logformat;
78 	void			*nc_elfcookie;	/* for rpclogfile processing */
79 	void			*nc_transcookie; /* for logfile processing */
80 	struct nfsl_config	*nc_next;
81 } nfsl_config_t;
82 
83 #define	NC_UPDATED		0x001	/* set when an existing entry is */
84 					/* modified after detecting changes */
85 					/* in the configuration file. */
86 					/* Not set on creation of entry. */
87 
88 #define	NC_NOTAG_PRINTED	0x002	/* 'missing tag' syslogged */
89 
90 extern boolean_t	nfsl_errs_to_syslog;
91 
92 extern int	nfsl_getconfig_list(nfsl_config_t **listpp);
93 extern int	nfsl_checkconfig_list(nfsl_config_t **listpp, boolean_t *);
94 extern void	nfsl_freeconfig_list(nfsl_config_t **listpp);
95 extern nfsl_config_t *nfsl_findconfig(nfsl_config_t *, char *, int *);
96 #ifndef	LINTHAPPY
97 extern void	nfsl_printconfig_list(nfsl_config_t *config);
98 #endif
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* _NFS_NFSLOG_CONFIG_H */
105