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 52318Sstephh * Common Development and Distribution License (the "License"). 62318Sstephh * 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*12106SStephen.Hanson@Sun.COM * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 230Sstevel@tonic-gate * 240Sstevel@tonic-gate * config.h -- public definitions for config module 250Sstevel@tonic-gate * 260Sstevel@tonic-gate * this module supports management of system configuration information 270Sstevel@tonic-gate * 280Sstevel@tonic-gate */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifndef _EFT_CONFIG_H 310Sstevel@tonic-gate #define _EFT_CONFIG_H 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/types.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate #include "tree.h" 400Sstevel@tonic-gate #include "lut.h" 410Sstevel@tonic-gate 420Sstevel@tonic-gate struct cfgdata { 434436Sstephh int raw_refcnt; 440Sstevel@tonic-gate /* 450Sstevel@tonic-gate * The begin field points to the first byte of raw 460Sstevel@tonic-gate * configuration information and end to the byte past the last 470Sstevel@tonic-gate * byte where configuration information may be stored. 480Sstevel@tonic-gate * nextfree points to where the next string may be added. 490Sstevel@tonic-gate */ 500Sstevel@tonic-gate char *begin; 510Sstevel@tonic-gate char *end; 520Sstevel@tonic-gate char *nextfree; 530Sstevel@tonic-gate struct config *cooked; 540Sstevel@tonic-gate struct lut *devcache; 556640Scth struct lut *devidcache; 56*12106SStephen.Hanson@Sun.COM struct lut *tpcache; 570Sstevel@tonic-gate struct lut *cpucache; 580Sstevel@tonic-gate }; 590Sstevel@tonic-gate 605204Sstephh void structconfig_free(struct config *cp); 610Sstevel@tonic-gate struct cfgdata *config_snapshot(void); 620Sstevel@tonic-gate 630Sstevel@tonic-gate void config_cook(struct cfgdata *cdata); 640Sstevel@tonic-gate void config_free(struct cfgdata *cdata); 650Sstevel@tonic-gate 660Sstevel@tonic-gate struct config *config_lookup(struct config *croot, char *path, int add); 670Sstevel@tonic-gate struct config *config_next(struct config *cp); 680Sstevel@tonic-gate struct config *config_child(struct config *cp); 694436Sstephh struct config *config_parent(struct config *cp); 700Sstevel@tonic-gate 710Sstevel@tonic-gate const char *config_getprop(struct config *cp, const char *name); 720Sstevel@tonic-gate void config_setprop(struct config *cp, const char *name, const char *val); 730Sstevel@tonic-gate void config_getcompname(struct config *cp, char **name, int *inst); 740Sstevel@tonic-gate 750Sstevel@tonic-gate int config_is_connected(struct node *np, struct config *croot, 760Sstevel@tonic-gate struct evalue *valuep); 770Sstevel@tonic-gate int config_is_type(struct node *np, struct config *croot, 780Sstevel@tonic-gate struct evalue *valuep); 790Sstevel@tonic-gate int config_is_on(struct node *np, struct config *croot, struct evalue *valuep); 800Sstevel@tonic-gate int config_is_present(struct node *np, struct config *croot, 810Sstevel@tonic-gate struct evalue *valuep); 820Sstevel@tonic-gate 830Sstevel@tonic-gate void config_print(int flags, struct config *croot); 840Sstevel@tonic-gate 850Sstevel@tonic-gate struct node *config_bydev_lookup(struct cfgdata *, const char *); 860Sstevel@tonic-gate struct node *config_bycpuid_lookup(struct cfgdata *, uint32_t); 876640Scth struct node *config_bydevid_lookup(struct cfgdata *, const char *); 88*12106SStephen.Hanson@Sun.COM struct node *config_bytp_lookup(struct cfgdata *, const char *); 890Sstevel@tonic-gate 900Sstevel@tonic-gate #ifdef __cplusplus 910Sstevel@tonic-gate } 920Sstevel@tonic-gate #endif 930Sstevel@tonic-gate 940Sstevel@tonic-gate #endif /* _EFT_CONFIG_H */ 95