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 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 * 26 * itree.h -- public definitions for itree module 27 * 28 */ 29 30 #ifndef _EFT_ITREE_H 31 #define _EFT_ITREE_H 32 33 #pragma ident "%Z%%M% %I% %E% SMI" 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 /* the "fault" field in the event struct requires the definition of nvlist_t */ 40 #include <sys/fm/protocol.h> 41 42 /* Numerical representation of propagation N value (A), short for All */ 43 #define N_IS_ALL -1 44 45 /* 46 * effects_test event cached_state bits 47 * - reset on each call to effects_test() 48 */ 49 #define CREDIBLE_EFFECT 1 50 #define WAIT_EFFECT 2 51 #define PARENT_WAIT 4 52 53 /* 54 * arrow mark bits (for K-count) 55 */ 56 #define EFFECTS_COUNTER 8 57 #define REQMNTS_COUNTER 16 58 59 /* 60 * requirements_test event cached_state bits 61 */ 62 #define REQMNTS_CREDIBLE 32 63 #define REQMNTS_DISPROVED 64 64 #define REQMNTS_WAIT 128 65 66 /* 67 * requirements_test bubble mark bits 68 */ 69 #define BUBBLE_ELIDED 256 70 #define BUBBLE_OK 512 71 72 /* 73 * causes_test event cached_state bits 74 */ 75 #define CAUSES_TESTED 1024 76 77 struct event { 78 enum nametype t; /* defined in tree.h */ 79 struct event *suspects; 80 struct event *psuspects; 81 struct event *observations; /* for lists like suspect list */ 82 nvlist_t *nvp; /* payload nvp for ereports */ 83 int is_suspect; /* true if on suspect list */ 84 struct node *enode; /* event node in parse tree */ 85 const struct ipath *ipp; /* instanced version of event */ 86 struct lut *props; /* instanced version of nvpairs */ 87 struct lut *payloadprops; /* nvpairs for problem payload */ 88 int count; /* for reports, number seen */ 89 int cached_state; 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 struct event *itree_lookup(struct lut *itp, 139 const char *ename, const struct ipath *ipp); 140 141 struct arrowlist *itree_next_arrow(struct bubble *bubblep, 142 struct arrowlist *last); 143 struct bubble *itree_next_bubble(struct event *eventp, struct bubble *last); 144 struct constraintlist *itree_next_constraint(struct arrow *arrowp, 145 struct constraintlist *last); 146 147 void itree_pevent_brief(int flags, struct event *eventp); 148 void itree_ptree(int flags, struct lut *itp); 149 150 const char *itree_bubbletype2str(enum bubbletype t); 151 152 void itree_fini(void); 153 154 #ifdef __cplusplus 155 } 156 #endif 157 158 #endif /* _EFT_ITREE_H */ 159