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