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*9874SStephen.Hanson@Sun.COM * Copyright 2009 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 #ifdef __cplusplus 330Sstevel@tonic-gate extern "C" { 340Sstevel@tonic-gate #endif 350Sstevel@tonic-gate 360Sstevel@tonic-gate /* the "fault" field in the event struct requires the definition of nvlist_t */ 370Sstevel@tonic-gate #include <sys/fm/protocol.h> 387197Sstephh #include <fm/fmd_api.h> 390Sstevel@tonic-gate 400Sstevel@tonic-gate /* Numerical representation of propagation N value (A), short for All */ 410Sstevel@tonic-gate #define N_IS_ALL -1 420Sstevel@tonic-gate 431414Scindi /* 441414Scindi * effects_test event cached_state bits 451414Scindi * - reset on each call to effects_test() 461414Scindi */ 471414Scindi #define CREDIBLE_EFFECT 1 481414Scindi #define WAIT_EFFECT 2 491414Scindi #define PARENT_WAIT 4 501414Scindi 511414Scindi /* 521414Scindi * arrow mark bits (for K-count) 531414Scindi */ 541414Scindi #define EFFECTS_COUNTER 8 551414Scindi #define REQMNTS_COUNTER 16 561414Scindi 571414Scindi /* 581414Scindi * requirements_test event cached_state bits 591414Scindi */ 601414Scindi #define REQMNTS_CREDIBLE 32 611414Scindi #define REQMNTS_DISPROVED 64 621414Scindi #define REQMNTS_WAIT 128 631414Scindi 641414Scindi /* 651414Scindi * requirements_test bubble mark bits 661414Scindi */ 671414Scindi #define BUBBLE_ELIDED 256 681414Scindi #define BUBBLE_OK 512 691414Scindi 701414Scindi /* 711414Scindi * causes_test event cached_state bits 721414Scindi */ 731414Scindi #define CAUSES_TESTED 1024 741414Scindi 750Sstevel@tonic-gate struct event { 760Sstevel@tonic-gate struct event *suspects; 770Sstevel@tonic-gate struct event *psuspects; 780Sstevel@tonic-gate struct event *observations; /* for lists like suspect list */ 797197Sstephh fmd_event_t *ffep; 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 */ 83*9874SStephen.Hanson@Sun.COM const struct ipath *ipp_un; /* full version for Usednames */ 840Sstevel@tonic-gate struct lut *props; /* instanced version of nvpairs */ 851414Scindi struct lut *payloadprops; /* nvpairs for problem payload */ 867197Sstephh struct lut *serdprops; /* nvpairs for dynamic serd args */ 870Sstevel@tonic-gate int count; /* for reports, number seen */ 884436Sstephh enum nametype t:3; /* defined in tree.h */ 894436Sstephh int is_suspect:1; /* true if on suspect list */ 904436Sstephh int keep_in_tree:1; 914436Sstephh int cached_state:11; 921414Scindi unsigned long long cached_delay; 930Sstevel@tonic-gate struct bubble { 940Sstevel@tonic-gate struct bubble *next; 954436Sstephh struct event *myevent; 960Sstevel@tonic-gate int gen; /* generation # */ 974436Sstephh int nork; 984436Sstephh int mark:11; 990Sstevel@tonic-gate enum bubbletype { 1004436Sstephh B_FROM, 1010Sstevel@tonic-gate B_TO, 1020Sstevel@tonic-gate B_INHIBIT 1034436Sstephh } t:2; 1040Sstevel@tonic-gate struct arrowlist { 1050Sstevel@tonic-gate struct arrowlist *next; 1060Sstevel@tonic-gate struct arrow { 1070Sstevel@tonic-gate struct bubble *head; 1080Sstevel@tonic-gate struct bubble *tail; 1090Sstevel@tonic-gate /* prop node in parse tree */ 1100Sstevel@tonic-gate struct node *pnode; 1110Sstevel@tonic-gate struct constraintlist { 1120Sstevel@tonic-gate struct constraintlist *next; 1130Sstevel@tonic-gate /* deferred constraints */ 1140Sstevel@tonic-gate struct node *cnode; 1150Sstevel@tonic-gate } *constraints; 1164436Sstephh int forever_false:1; 1174436Sstephh int forever_true:1; 1184436Sstephh int arrow_marked:1; 1194436Sstephh int mark:11; 1200Sstevel@tonic-gate unsigned long long mindelay; 1210Sstevel@tonic-gate unsigned long long maxdelay; 1220Sstevel@tonic-gate } *arrowp; 1230Sstevel@tonic-gate } *arrows; 1240Sstevel@tonic-gate } *bubbles; 1250Sstevel@tonic-gate }; 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate /* 1280Sstevel@tonic-gate * struct iterinfo is the stuff we store in the dictionary of iterators 1290Sstevel@tonic-gate * when we assign a value to an iterator. it not only contains the value 1300Sstevel@tonic-gate * we assigned to the iterator, it contains a node pointer which we use to 1310Sstevel@tonic-gate * determine if we're the one that defined the value when popping [vh]match() 1320Sstevel@tonic-gate * recursion. 1330Sstevel@tonic-gate */ 1340Sstevel@tonic-gate struct iterinfo { 1350Sstevel@tonic-gate int num; 1360Sstevel@tonic-gate struct node *np; 1370Sstevel@tonic-gate }; 1380Sstevel@tonic-gate 1390Sstevel@tonic-gate struct lut *itree_create(struct config *croot); 1400Sstevel@tonic-gate void itree_free(struct lut *itp); 1411865Sdilpreet void itree_prune(struct lut *itp); 1420Sstevel@tonic-gate struct event *itree_lookup(struct lut *itp, 1430Sstevel@tonic-gate const char *ename, const struct ipath *ipp); 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate struct arrowlist *itree_next_arrow(struct bubble *bubblep, 1460Sstevel@tonic-gate struct arrowlist *last); 1470Sstevel@tonic-gate struct bubble *itree_next_bubble(struct event *eventp, struct bubble *last); 1480Sstevel@tonic-gate struct constraintlist *itree_next_constraint(struct arrow *arrowp, 1490Sstevel@tonic-gate struct constraintlist *last); 1500Sstevel@tonic-gate 1510Sstevel@tonic-gate void itree_pevent_brief(int flags, struct event *eventp); 1520Sstevel@tonic-gate void itree_ptree(int flags, struct lut *itp); 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate const char *itree_bubbletype2str(enum bubbletype t); 1550Sstevel@tonic-gate 1560Sstevel@tonic-gate void itree_fini(void); 1570Sstevel@tonic-gate 1580Sstevel@tonic-gate #ifdef __cplusplus 1590Sstevel@tonic-gate } 1600Sstevel@tonic-gate #endif 1610Sstevel@tonic-gate 1620Sstevel@tonic-gate #endif /* _EFT_ITREE_H */ 163