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
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or https://opensource.org/licenses/CDDL-1.0.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
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]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2016, Intel Corporation.
39 typedef struct fmd_serd_elem
{
40 list_node_t se_list
; /* linked list forward/back pointers */
41 hrtime_t se_hrt
; /* upper bound on event hrtime */
44 typedef struct fmd_serd_eng
{
45 char *sg_name
; /* string name for this engine */
46 struct fmd_serd_eng
*sg_next
; /* next engine on hash chain */
47 list_t sg_list
; /* list of fmd_serd_elem_t's */
48 uint_t sg_count
; /* count of events in sg_list */
49 uint_t sg_flags
; /* engine flags (see below) */
50 uint_t sg_n
; /* engine N parameter (event count) */
51 hrtime_t sg_t
; /* engine T parameter (nanoseconds) */
54 #define FMD_SERD_FIRED 0x1 /* error rate has exceeded threshold */
55 #define FMD_SERD_DIRTY 0x2 /* engine needs to be checkpointed */
57 typedef void fmd_serd_eng_f(fmd_serd_eng_t
*, void *);
59 typedef struct fmd_serd_hash
{
60 fmd_serd_eng_t
**sh_hash
; /* hash bucket array for buffers */
61 uint_t sh_hashlen
; /* length of hash bucket array */
62 uint_t sh_count
; /* count of engines in hash */
65 extern void fmd_serd_hash_create(fmd_serd_hash_t
*);
66 extern void fmd_serd_hash_destroy(fmd_serd_hash_t
*);
67 extern void fmd_serd_hash_apply(fmd_serd_hash_t
*, fmd_serd_eng_f
*, void *);
69 extern fmd_serd_eng_t
*fmd_serd_eng_insert(fmd_serd_hash_t
*,
70 const char *, uint32_t, hrtime_t
);
72 extern fmd_serd_eng_t
*fmd_serd_eng_lookup(fmd_serd_hash_t
*, const char *);
73 extern void fmd_serd_eng_delete(fmd_serd_hash_t
*, const char *);
75 extern int fmd_serd_eng_record(fmd_serd_eng_t
*, hrtime_t
);
76 extern int fmd_serd_eng_fired(fmd_serd_eng_t
*);
77 extern int fmd_serd_eng_empty(fmd_serd_eng_t
*);
79 extern void fmd_serd_eng_reset(fmd_serd_eng_t
*);
80 extern void fmd_serd_eng_gc(fmd_serd_eng_t
*, void *);
86 #endif /* _FMD_SERD_H */