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 2004 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 struct event { 46 enum nametype t; /* defined in tree.h */ 47 struct event *suspects; 48 struct event *psuspects; 49 struct event *observations; /* for lists like suspect list */ 50 nvlist_t *nvp; /* payload nvp for ereports */ 51 int is_suspect; /* true if on suspect list */ 52 struct node *enode; /* event node in parse tree */ 53 const struct ipath *ipp; /* instanced version of event */ 54 struct lut *props; /* instanced version of nvpairs */ 55 int count; /* for reports, number seen */ 56 struct bubble { 57 struct bubble *next; 58 int gen; /* generation # */ 59 enum bubbletype { 60 B_FROM = 4000, 61 B_TO, 62 B_INHIBIT 63 } t; 64 struct event *myevent; 65 int nork; 66 int mark; 67 struct arrowlist { 68 struct arrowlist *next; 69 struct arrow { 70 struct bubble *head; 71 struct bubble *tail; 72 /* prop node in parse tree */ 73 struct node *pnode; 74 struct constraintlist { 75 struct constraintlist *next; 76 /* deferred constraints */ 77 struct node *cnode; 78 } *constraints; 79 int causes_tested; 80 unsigned long long mindelay; 81 unsigned long long maxdelay; 82 } *arrowp; 83 } *arrows; 84 } *bubbles; 85 nvlist_t *fault; 86 }; 87 88 /* 89 * struct iterinfo is the stuff we store in the dictionary of iterators 90 * when we assign a value to an iterator. it not only contains the value 91 * we assigned to the iterator, it contains a node pointer which we use to 92 * determine if we're the one that defined the value when popping [vh]match() 93 * recursion. 94 */ 95 struct iterinfo { 96 int num; 97 struct node *np; 98 }; 99 100 struct lut *itree_create(struct config *croot); 101 void itree_free(struct lut *itp); 102 struct event *itree_lookup(struct lut *itp, 103 const char *ename, const struct ipath *ipp); 104 105 struct arrowlist *itree_next_arrow(struct bubble *bubblep, 106 struct arrowlist *last); 107 struct bubble *itree_next_bubble(struct event *eventp, struct bubble *last); 108 struct constraintlist *itree_next_constraint(struct arrow *arrowp, 109 struct constraintlist *last); 110 111 void itree_pevent_brief(int flags, struct event *eventp); 112 void itree_ptree(int flags, struct lut *itp); 113 114 const char *itree_bubbletype2str(enum bubbletype t); 115 116 void itree_fini(void); 117 118 #ifdef __cplusplus 119 } 120 #endif 121 122 #endif /* _EFT_ITREE_H */ 123