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