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 (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 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. 12 * 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] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 * 25 * itree.h -- public definitions for itree module 26 * 27 */ 28 29 #ifndef _EFT_ITREE_H 30 #define _EFT_ITREE_H 31 32 #pragma ident "%Z%%M% %I% %E% SMI" 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 /* the "fault" field in the event struct requires the definition of nvlist_t */ 39 #include <sys/fm/protocol.h> 40 41 /* Numerical representation of propagation N value (A), short for All */ 42 #define N_IS_ALL -1 43 44 /* 45 * effects_test event cached_state bits 46 * - reset on each call to effects_test() 47 */ 48 #define CREDIBLE_EFFECT 1 49 #define WAIT_EFFECT 2 50 #define PARENT_WAIT 4 51 52 /* 53 * arrow mark bits (for K-count) 54 */ 55 #define EFFECTS_COUNTER 8 56 #define REQMNTS_COUNTER 16 57 58 /* 59 * requirements_test event cached_state bits 60 */ 61 #define REQMNTS_CREDIBLE 32 62 #define REQMNTS_DISPROVED 64 63 #define REQMNTS_WAIT 128 64 65 /* 66 * requirements_test bubble mark bits 67 */ 68 #define BUBBLE_ELIDED 256 69 #define BUBBLE_OK 512 70 71 /* 72 * causes_test event cached_state bits 73 */ 74 #define CAUSES_TESTED 1024 75 76 struct event { 77 enum nametype t; /* defined in tree.h */ 78 struct event *suspects; 79 struct event *psuspects; 80 struct event *observations; /* for lists like suspect list */ 81 nvlist_t *nvp; /* payload nvp for ereports */ 82 int is_suspect; /* true if on suspect list */ 83 struct node *enode; /* event node in parse tree */ 84 const struct ipath *ipp; /* instanced version of event */ 85 struct lut *props; /* instanced version of nvpairs */ 86 struct lut *payloadprops; /* nvpairs for problem payload */ 87 int count; /* for reports, number seen */ 88 int cached_state; 89 int keep_in_tree; 90 unsigned long long cached_delay; 91 struct bubble { 92 struct bubble *next; 93 int gen; /* generation # */ 94 enum bubbletype { 95 B_FROM = 4000, 96 B_TO, 97 B_INHIBIT 98 } t; 99 struct event *myevent; 100 int nork; 101 int mark; 102 struct arrowlist { 103 struct arrowlist *next; 104 struct arrow { 105 struct bubble *head; 106 struct bubble *tail; 107 /* prop node in parse tree */ 108 struct node *pnode; 109 struct constraintlist { 110 struct constraintlist *next; 111 /* deferred constraints */ 112 struct node *cnode; 113 } *constraints; 114 int forever_false; 115 int mark; 116 unsigned long long mindelay; 117 unsigned long long maxdelay; 118 } *arrowp; 119 } *arrows; 120 } *bubbles; 121 nvlist_t *fault; 122 }; 123 124 /* 125 * struct iterinfo is the stuff we store in the dictionary of iterators 126 * when we assign a value to an iterator. it not only contains the value 127 * we assigned to the iterator, it contains a node pointer which we use to 128 * determine if we're the one that defined the value when popping [vh]match() 129 * recursion. 130 */ 131 struct iterinfo { 132 int num; 133 struct node *np; 134 }; 135 136 struct lut *itree_create(struct config *croot); 137 void itree_free(struct lut *itp); 138 void itree_prune(struct lut *itp); 139 struct event *itree_lookup(struct lut *itp, 140 const char *ename, const struct ipath *ipp); 141 142 struct arrowlist *itree_next_arrow(struct bubble *bubblep, 143 struct arrowlist *last); 144 struct bubble *itree_next_bubble(struct event *eventp, struct bubble *last); 145 struct constraintlist *itree_next_constraint(struct arrow *arrowp, 146 struct constraintlist *last); 147 148 void itree_pevent_brief(int flags, struct event *eventp); 149 void itree_ptree(int flags, struct lut *itp); 150 151 const char *itree_bubbletype2str(enum bubbletype t); 152 153 void itree_fini(void); 154 155 #ifdef __cplusplus 156 } 157 #endif 158 159 #endif /* _EFT_ITREE_H */ 160