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