10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51865Sdilpreet * Common Development and Distribution License (the "License"). 61865Sdilpreet * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*4436Sstephh * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate * 250Sstevel@tonic-gate * itree.h -- public definitions for itree module 260Sstevel@tonic-gate * 270Sstevel@tonic-gate */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifndef _EFT_ITREE_H 300Sstevel@tonic-gate #define _EFT_ITREE_H 310Sstevel@tonic-gate 320Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 330Sstevel@tonic-gate 340Sstevel@tonic-gate #ifdef __cplusplus 350Sstevel@tonic-gate extern "C" { 360Sstevel@tonic-gate #endif 370Sstevel@tonic-gate 380Sstevel@tonic-gate /* the "fault" field in the event struct requires the definition of nvlist_t */ 390Sstevel@tonic-gate #include <sys/fm/protocol.h> 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* Numerical representation of propagation N value (A), short for All */ 420Sstevel@tonic-gate #define N_IS_ALL -1 430Sstevel@tonic-gate 441414Scindi /* 451414Scindi * effects_test event cached_state bits 461414Scindi * - reset on each call to effects_test() 471414Scindi */ 481414Scindi #define CREDIBLE_EFFECT 1 491414Scindi #define WAIT_EFFECT 2 501414Scindi #define PARENT_WAIT 4 511414Scindi 521414Scindi /* 531414Scindi * arrow mark bits (for K-count) 541414Scindi */ 551414Scindi #define EFFECTS_COUNTER 8 561414Scindi #define REQMNTS_COUNTER 16 571414Scindi 581414Scindi /* 591414Scindi * requirements_test event cached_state bits 601414Scindi */ 611414Scindi #define REQMNTS_CREDIBLE 32 621414Scindi #define REQMNTS_DISPROVED 64 631414Scindi #define REQMNTS_WAIT 128 641414Scindi 651414Scindi /* 661414Scindi * requirements_test bubble mark bits 671414Scindi */ 681414Scindi #define BUBBLE_ELIDED 256 691414Scindi #define BUBBLE_OK 512 701414Scindi 711414Scindi /* 721414Scindi * causes_test event cached_state bits 731414Scindi */ 741414Scindi #define CAUSES_TESTED 1024 751414Scindi 760Sstevel@tonic-gate struct event { 770Sstevel@tonic-gate struct event *suspects; 780Sstevel@tonic-gate struct event *psuspects; 790Sstevel@tonic-gate struct event *observations; /* for lists like suspect list */ 800Sstevel@tonic-gate nvlist_t *nvp; /* payload nvp for ereports */ 810Sstevel@tonic-gate struct node *enode; /* event node in parse tree */ 820Sstevel@tonic-gate const struct ipath *ipp; /* instanced version of event */ 830Sstevel@tonic-gate struct lut *props; /* instanced version of nvpairs */ 841414Scindi struct lut *payloadprops; /* nvpairs for problem payload */ 850Sstevel@tonic-gate int count; /* for reports, number seen */ 86*4436Sstephh enum nametype t:3; /* defined in tree.h */ 87*4436Sstephh int is_suspect:1; /* true if on suspect list */ 88*4436Sstephh int keep_in_tree:1; 89*4436Sstephh int cached_state:11; 901414Scindi unsigned long long cached_delay; 910Sstevel@tonic-gate struct bubble { 920Sstevel@tonic-gate struct bubble *next; 93*4436Sstephh struct event *myevent; 940Sstevel@tonic-gate int gen; /* generation # */ 95*4436Sstephh int nork; 96*4436Sstephh int mark:11; 970Sstevel@tonic-gate enum bubbletype { 98*4436Sstephh B_FROM, 990Sstevel@tonic-gate B_TO, 1000Sstevel@tonic-gate B_INHIBIT 101*4436Sstephh } t:2; 1020Sstevel@tonic-gate struct arrowlist { 1030Sstevel@tonic-gate struct arrowlist *next; 1040Sstevel@tonic-gate struct arrow { 1050Sstevel@tonic-gate struct bubble *head; 1060Sstevel@tonic-gate struct bubble *tail; 1070Sstevel@tonic-gate /* prop node in parse tree */ 1080Sstevel@tonic-gate struct node *pnode; 1090Sstevel@tonic-gate struct constraintlist { 1100Sstevel@tonic-gate struct constraintlist *next; 1110Sstevel@tonic-gate /* deferred constraints */ 1120Sstevel@tonic-gate struct node *cnode; 1130Sstevel@tonic-gate } *constraints; 114*4436Sstephh int forever_false:1; 115*4436Sstephh int forever_true:1; 116*4436Sstephh int arrow_marked:1; 117*4436Sstephh int mark:11; 1180Sstevel@tonic-gate unsigned long long mindelay; 1190Sstevel@tonic-gate unsigned long long maxdelay; 1200Sstevel@tonic-gate } *arrowp; 1210Sstevel@tonic-gate } *arrows; 1220Sstevel@tonic-gate } *bubbles; 1230Sstevel@tonic-gate }; 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate /* 1260Sstevel@tonic-gate * struct iterinfo is the stuff we store in the dictionary of iterators 1270Sstevel@tonic-gate * when we assign a value to an iterator. it not only contains the value 1280Sstevel@tonic-gate * we assigned to the iterator, it contains a node pointer which we use to 1290Sstevel@tonic-gate * determine if we're the one that defined the value when popping [vh]match() 1300Sstevel@tonic-gate * recursion. 1310Sstevel@tonic-gate */ 1320Sstevel@tonic-gate struct iterinfo { 1330Sstevel@tonic-gate int num; 1340Sstevel@tonic-gate struct node *np; 1350Sstevel@tonic-gate }; 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate struct lut *itree_create(struct config *croot); 1380Sstevel@tonic-gate void itree_free(struct lut *itp); 1391865Sdilpreet void itree_prune(struct lut *itp); 1400Sstevel@tonic-gate struct event *itree_lookup(struct lut *itp, 1410Sstevel@tonic-gate const char *ename, const struct ipath *ipp); 1420Sstevel@tonic-gate 1430Sstevel@tonic-gate struct arrowlist *itree_next_arrow(struct bubble *bubblep, 1440Sstevel@tonic-gate struct arrowlist *last); 1450Sstevel@tonic-gate struct bubble *itree_next_bubble(struct event *eventp, struct bubble *last); 1460Sstevel@tonic-gate struct constraintlist *itree_next_constraint(struct arrow *arrowp, 1470Sstevel@tonic-gate struct constraintlist *last); 1480Sstevel@tonic-gate 1490Sstevel@tonic-gate void itree_pevent_brief(int flags, struct event *eventp); 1500Sstevel@tonic-gate void itree_ptree(int flags, struct lut *itp); 1510Sstevel@tonic-gate 1520Sstevel@tonic-gate const char *itree_bubbletype2str(enum bubbletype t); 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate void itree_fini(void); 1550Sstevel@tonic-gate 1560Sstevel@tonic-gate #ifdef __cplusplus 1570Sstevel@tonic-gate } 1580Sstevel@tonic-gate #endif 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate #endif /* _EFT_ITREE_H */ 161