17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5d96ce684Sstephh * Common Development and Distribution License (the "License"). 6d96ce684Sstephh * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*44ed9dbbSStephen Hanson * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 237c478bd9Sstevel@tonic-gate * 247c478bd9Sstevel@tonic-gate * config.h -- public definitions for config module 257c478bd9Sstevel@tonic-gate * 267c478bd9Sstevel@tonic-gate * this module supports management of system configuration information 277c478bd9Sstevel@tonic-gate * 287c478bd9Sstevel@tonic-gate */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifndef _EFT_CONFIG_H 317c478bd9Sstevel@tonic-gate #define _EFT_CONFIG_H 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #include <sys/types.h> 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 367c478bd9Sstevel@tonic-gate extern "C" { 377c478bd9Sstevel@tonic-gate #endif 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #include "tree.h" 407c478bd9Sstevel@tonic-gate #include "lut.h" 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate struct cfgdata { 43b5016cbbSstephh int raw_refcnt; 447c478bd9Sstevel@tonic-gate /* 457c478bd9Sstevel@tonic-gate * The begin field points to the first byte of raw 467c478bd9Sstevel@tonic-gate * configuration information and end to the byte past the last 477c478bd9Sstevel@tonic-gate * byte where configuration information may be stored. 487c478bd9Sstevel@tonic-gate * nextfree points to where the next string may be added. 497c478bd9Sstevel@tonic-gate */ 507c478bd9Sstevel@tonic-gate char *begin; 517c478bd9Sstevel@tonic-gate char *end; 527c478bd9Sstevel@tonic-gate char *nextfree; 537c478bd9Sstevel@tonic-gate struct config *cooked; 547c478bd9Sstevel@tonic-gate struct lut *devcache; 55602ca9eaScth struct lut *devidcache; 56*44ed9dbbSStephen Hanson struct lut *tpcache; 577c478bd9Sstevel@tonic-gate struct lut *cpucache; 587c478bd9Sstevel@tonic-gate }; 597c478bd9Sstevel@tonic-gate 60e5ba14ffSstephh void structconfig_free(struct config *cp); 617c478bd9Sstevel@tonic-gate struct cfgdata *config_snapshot(void); 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate void config_cook(struct cfgdata *cdata); 647c478bd9Sstevel@tonic-gate void config_free(struct cfgdata *cdata); 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate struct config *config_lookup(struct config *croot, char *path, int add); 677c478bd9Sstevel@tonic-gate struct config *config_next(struct config *cp); 687c478bd9Sstevel@tonic-gate struct config *config_child(struct config *cp); 69b5016cbbSstephh struct config *config_parent(struct config *cp); 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate const char *config_getprop(struct config *cp, const char *name); 727c478bd9Sstevel@tonic-gate void config_setprop(struct config *cp, const char *name, const char *val); 737c478bd9Sstevel@tonic-gate void config_getcompname(struct config *cp, char **name, int *inst); 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate int config_is_connected(struct node *np, struct config *croot, 767c478bd9Sstevel@tonic-gate struct evalue *valuep); 777c478bd9Sstevel@tonic-gate int config_is_type(struct node *np, struct config *croot, 787c478bd9Sstevel@tonic-gate struct evalue *valuep); 797c478bd9Sstevel@tonic-gate int config_is_on(struct node *np, struct config *croot, struct evalue *valuep); 807c478bd9Sstevel@tonic-gate int config_is_present(struct node *np, struct config *croot, 817c478bd9Sstevel@tonic-gate struct evalue *valuep); 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate void config_print(int flags, struct config *croot); 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate struct node *config_bydev_lookup(struct cfgdata *, const char *); 867c478bd9Sstevel@tonic-gate struct node *config_bycpuid_lookup(struct cfgdata *, uint32_t); 87602ca9eaScth struct node *config_bydevid_lookup(struct cfgdata *, const char *); 88*44ed9dbbSStephen Hanson struct node *config_bytp_lookup(struct cfgdata *, const char *); 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate #ifdef __cplusplus 917c478bd9Sstevel@tonic-gate } 927c478bd9Sstevel@tonic-gate #endif 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate #endif /* _EFT_CONFIG_H */ 95