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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FMD_LOG_IMPL_H
28 #define	_FMD_LOG_IMPL_H
29 
30 #include <sys/types.h>
31 #include <sys/stat.h>
32 #include <exacct.h>
33 #include <fmd_log.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 struct fmd_log {
40 	struct stat64 log_stat;		/* fstat64() information for log file */
41 	ea_file_t log_ea;		/* libexacct handle for log file */
42 	char *log_path;			/* log file pathname used for open */
43 	char *log_version;		/* creator version string */
44 	char *log_label;		/* label indicating type */
45 	char *log_osrelease;		/* uname -r at log creation time */
46 	char *log_osversion;		/* uname -v at log creation time */
47 	char *log_platform;		/* uname -i at log creation time */
48 	char *log_uuid;			/* log file uuid string */
49 	int log_abi;			/* abi version of library client */
50 	int log_errno;			/* err from last library call */
51 	int log_fd;			/* file descriptor for log */
52 	int log_flags;			/* miscellaneous flags (see below) */
53 	struct fmd_log *log_xrefs;	/* list of cross-referenced logs */
54 	struct fmd_log *log_xnext;	/* next log on cross-reference list */
55 };
56 
57 #define	FMD_LF_EAOPEN	0x1		/* log_ea is open and active */
58 #define	FMD_LF_START	0x2		/* log is at start of iter */
59 #define	FMD_LF_XREFS	0x4		/* log xrefs have been loaded */
60 #define	FMD_LF_DEBUG	0x8		/* print debug messages for this log */
61 
62 typedef struct fmd_log_filtvec {
63 	const fmd_log_filter_t *filt_argv; /* set of equivalent filters to OR */
64 	uint_t filt_argc;		/* number of total filters to AND */
65 } fmd_log_filtvec_t;
66 
67 #define	EFDL_BASE	1000		/* base value for libfmd_log errnos */
68 
69 enum {
70 	EFDL_VERSION = EFDL_BASE,	/* invalid library client version */
71 	EFDL_NOMEM,			/* memory allocation failure */
72 	EFDL_BADHDR,			/* invalid fmd file header */
73 	EFDL_NOCLASS,			/* record does not contain class */
74 	EFDL_BADTAG,			/* invalid exacct catalog tag */
75 	EFDL_BADREF,			/* invalid cross-reference group */
76 	EFDL_BADDEV,			/* invalid cross-reference dev_t */
77 	/*
78 	 * Note: EFDL_EXACCT must be the final internal errno definition so we
79 	 * can store libexacct ea_error() values as EFDL_EXACCT + ea_error().
80 	 */
81 	EFDL_EXACCT			/* exacct error (must be last!) */
82 };
83 
84 #ifdef	__cplusplus
85 }
86 #endif
87 
88 #endif	/* _FMD_LOG_IMPL_H */
89