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