4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 * Header file of checkpointing ereports for persistence
41 #include <fm/fmd_api.h>
43 #define ETM_CKPT_VERSION 0x10
44 #define ETM_CKPT_ERPT_PREFIX "ev"
45 #define ETM_LINE_LEN 256
48 * Format of a named buffer that stores an ereport.
50 typedef struct etm_ckpt_erpt_buf
{
51 uint8_t eb_ver
; /* version major.minor */
52 uint8_t eb_rev
; /* reserved field */
53 uint16_t eb_len
; /* size of packed ereport */
54 /* nvlist packed erpt event */
55 } etm_ckpt_erpt_buf_t
;
59 * Each ereport, which is stored in a named buffer, is uniquely identified by
60 * fields in the ereport. The named buffer name is derived from this struct
62 * ev_${ena}_${hash{class)}_${tod[1]}_${primary}
64 typedef struct etm_ckpt_erpt_id
{
65 uint64_t ei_ena
; /* ereport ena */
66 uint32_t ei_tod1
; /* tod[1]: fractional second */
67 uint16_t ei_hash
; /* hash(ereport class name) */
68 uint8_t ei_pri
; /* primary field */
69 uint8_t ei_rev
; /* reserved field */
73 * A circular list of ereport ids
75 typedef struct etm_ckpt_id_list
{
76 uint8_t il_ver
; /* version major.minor */
77 uint8_t il_rev1
; /* reserve field */
78 uint16_t il_max
; /* max number of erpt ids in list */
79 uint16_t il_cnt
; /* number of valid ids in list */
80 uint16_t il_head
; /* head of the list */
81 uint16_t il_tail
; /* tail of the list */
82 uint16_t il_ids_sz
; /* size of the array of ids */
83 uint32_t il_rev2
; /* reserve field */
87 #define ETM_CKPT_IL_BUF "idlist"
88 #define ETM_CKPT_IL_MIN_SIZE 0x8
93 #define ETM_CKPT_NOOP 0x0
94 #define ETM_CKPT_SAVE 0x1
95 #define ETM_CKPT_RESTORE 0x2
97 void etm_ckpt_recover(fmd_hdl_t
*hdl
);
98 int etm_ckpt_add(fmd_hdl_t
*hdl
, nvlist_t
*evp
);
99 int etm_ckpt_delete(fmd_hdl_t
*hdl
, nvlist_t
*evp
);
101 void etm_ckpt_init(fmd_hdl_t
*hdl
);
102 void etm_ckpt_fini(fmd_hdl_t
*hdl
);
108 #endif /* _ETM_CKPT_H */