xref: /onnv-gate/usr/src/cmd/fm/modules/common/eversholt/config.h (revision 4436:35b72f77cdd9)
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*4436Sstephh  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  *
250Sstevel@tonic-gate  * config.h -- public definitions for config module
260Sstevel@tonic-gate  *
270Sstevel@tonic-gate  * this module supports management of system configuration information
280Sstevel@tonic-gate  *
290Sstevel@tonic-gate  */
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifndef	_EFT_CONFIG_H
320Sstevel@tonic-gate #define	_EFT_CONFIG_H
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #include <sys/types.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #ifdef	__cplusplus
390Sstevel@tonic-gate extern "C" {
400Sstevel@tonic-gate #endif
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #include "tree.h"
430Sstevel@tonic-gate #include "lut.h"
440Sstevel@tonic-gate 
450Sstevel@tonic-gate struct cfgdata {
46*4436Sstephh 	int raw_refcnt;
47*4436Sstephh 	int cooked_refcnt;
480Sstevel@tonic-gate 	/*
490Sstevel@tonic-gate 	 * The begin field points to the first byte of raw
500Sstevel@tonic-gate 	 * configuration information and end to the byte past the last
510Sstevel@tonic-gate 	 * byte where configuration information may be stored.
520Sstevel@tonic-gate 	 * nextfree points to where the next string may be added.
530Sstevel@tonic-gate 	 */
540Sstevel@tonic-gate 	char *begin;
550Sstevel@tonic-gate 	char *end;
560Sstevel@tonic-gate 	char *nextfree;
570Sstevel@tonic-gate 	struct config *cooked;
580Sstevel@tonic-gate 	struct lut *devcache;
590Sstevel@tonic-gate 	struct lut *cpucache;
600Sstevel@tonic-gate };
610Sstevel@tonic-gate 
620Sstevel@tonic-gate struct cfgdata *config_snapshot(void);
630Sstevel@tonic-gate 
640Sstevel@tonic-gate void config_cook(struct cfgdata *cdata);
650Sstevel@tonic-gate void config_free(struct cfgdata *cdata);
660Sstevel@tonic-gate 
670Sstevel@tonic-gate struct config *config_lookup(struct config *croot, char *path, int add);
680Sstevel@tonic-gate struct config *config_next(struct config *cp);
690Sstevel@tonic-gate struct config *config_child(struct config *cp);
70*4436Sstephh struct config *config_parent(struct config *cp);
710Sstevel@tonic-gate 
720Sstevel@tonic-gate const char *config_getprop(struct config *cp, const char *name);
730Sstevel@tonic-gate void config_setprop(struct config *cp, const char *name, const char *val);
740Sstevel@tonic-gate void config_getcompname(struct config *cp, char **name, int *inst);
750Sstevel@tonic-gate 
760Sstevel@tonic-gate int config_is_connected(struct node *np, struct config *croot,
770Sstevel@tonic-gate 			struct evalue *valuep);
780Sstevel@tonic-gate int config_is_type(struct node *np, struct config *croot,
790Sstevel@tonic-gate 		    struct evalue *valuep);
800Sstevel@tonic-gate int config_is_on(struct node *np, struct config *croot, struct evalue *valuep);
810Sstevel@tonic-gate int config_is_present(struct node *np, struct config *croot,
820Sstevel@tonic-gate 		    struct evalue *valuep);
830Sstevel@tonic-gate 
840Sstevel@tonic-gate void config_print(int flags, struct config *croot);
850Sstevel@tonic-gate 
860Sstevel@tonic-gate struct node *config_bydev_lookup(struct cfgdata *, const char *);
870Sstevel@tonic-gate struct node *config_bycpuid_lookup(struct cfgdata *, uint32_t);
880Sstevel@tonic-gate 
890Sstevel@tonic-gate #ifdef	__cplusplus
900Sstevel@tonic-gate }
910Sstevel@tonic-gate #endif
920Sstevel@tonic-gate 
930Sstevel@tonic-gate #endif	/* _EFT_CONFIG_H */
94