1 0 stevel /* 2 0 stevel * CDDL HEADER START 3 0 stevel * 4 0 stevel * The contents of this file are subject to the terms of the 5 2318 stephh * Common Development and Distribution License (the "License"). 6 2318 stephh * You may not use this file except in compliance with the License. 7 0 stevel * 8 0 stevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 0 stevel * or http://www.opensolaris.org/os/licensing. 10 0 stevel * See the License for the specific language governing permissions 11 0 stevel * and limitations under the License. 12 0 stevel * 13 0 stevel * When distributing Covered Code, include this CDDL HEADER in each 14 0 stevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 0 stevel * If applicable, add the following below this CDDL HEADER, with the 16 0 stevel * fields enclosed by brackets "[]" replaced with your own identifying 17 0 stevel * information: Portions Copyright [yyyy] [name of copyright owner] 18 0 stevel * 19 0 stevel * CDDL HEADER END 20 0 stevel */ 21 0 stevel /* 22 6640 cth * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 0 stevel * Use is subject to license terms. 24 0 stevel * 25 0 stevel * config.h -- public definitions for config module 26 0 stevel * 27 0 stevel * this module supports management of system configuration information 28 0 stevel * 29 0 stevel */ 30 0 stevel 31 0 stevel #ifndef _EFT_CONFIG_H 32 0 stevel #define _EFT_CONFIG_H 33 0 stevel 34 0 stevel #pragma ident "%Z%%M% %I% %E% SMI" 35 0 stevel 36 0 stevel #include <sys/types.h> 37 0 stevel 38 0 stevel #ifdef __cplusplus 39 0 stevel extern "C" { 40 0 stevel #endif 41 0 stevel 42 0 stevel #include "tree.h" 43 0 stevel #include "lut.h" 44 0 stevel 45 0 stevel struct cfgdata { 46 4436 stephh int raw_refcnt; 47 0 stevel /* 48 0 stevel * The begin field points to the first byte of raw 49 0 stevel * configuration information and end to the byte past the last 50 0 stevel * byte where configuration information may be stored. 51 0 stevel * nextfree points to where the next string may be added. 52 0 stevel */ 53 0 stevel char *begin; 54 0 stevel char *end; 55 0 stevel char *nextfree; 56 0 stevel struct config *cooked; 57 0 stevel struct lut *devcache; 58 6640 cth struct lut *devidcache; 59 0 stevel struct lut *cpucache; 60 0 stevel }; 61 0 stevel 62 5204 stephh void structconfig_free(struct config *cp); 63 0 stevel struct cfgdata *config_snapshot(void); 64 0 stevel 65 0 stevel void config_cook(struct cfgdata *cdata); 66 0 stevel void config_free(struct cfgdata *cdata); 67 0 stevel 68 0 stevel struct config *config_lookup(struct config *croot, char *path, int add); 69 0 stevel struct config *config_next(struct config *cp); 70 0 stevel struct config *config_child(struct config *cp); 71 4436 stephh struct config *config_parent(struct config *cp); 72 0 stevel 73 0 stevel const char *config_getprop(struct config *cp, const char *name); 74 0 stevel void config_setprop(struct config *cp, const char *name, const char *val); 75 0 stevel void config_getcompname(struct config *cp, char **name, int *inst); 76 0 stevel 77 0 stevel int config_is_connected(struct node *np, struct config *croot, 78 0 stevel struct evalue *valuep); 79 0 stevel int config_is_type(struct node *np, struct config *croot, 80 0 stevel struct evalue *valuep); 81 0 stevel int config_is_on(struct node *np, struct config *croot, struct evalue *valuep); 82 0 stevel int config_is_present(struct node *np, struct config *croot, 83 0 stevel struct evalue *valuep); 84 0 stevel 85 0 stevel void config_print(int flags, struct config *croot); 86 0 stevel 87 0 stevel struct node *config_bydev_lookup(struct cfgdata *, const char *); 88 0 stevel struct node *config_bycpuid_lookup(struct cfgdata *, uint32_t); 89 6640 cth struct node *config_bydevid_lookup(struct cfgdata *, const char *); 90 0 stevel 91 0 stevel #ifdef __cplusplus 92 0 stevel } 93 0 stevel #endif 94 0 stevel 95 0 stevel #endif /* _EFT_CONFIG_H */ 96