xref: /onnv-gate/usr/src/lib/fm/topo/libtopo/common/topo_prop.h (revision 4087:b986877655d2)
11414Scindi /*
21414Scindi  * CDDL HEADER START
31414Scindi  *
41414Scindi  * The contents of this file are subject to the terms of the
53062Scindi  * Common Development and Distribution License (the "License").
63062Scindi  * You may not use this file except in compliance with the License.
71414Scindi  *
81414Scindi  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91414Scindi  * or http://www.opensolaris.org/os/licensing.
101414Scindi  * See the License for the specific language governing permissions
111414Scindi  * and limitations under the License.
121414Scindi  *
131414Scindi  * When distributing Covered Code, include this CDDL HEADER in each
141414Scindi  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151414Scindi  * If applicable, add the following below this CDDL HEADER, with the
161414Scindi  * fields enclosed by brackets "[]" replaced with your own identifying
171414Scindi  * information: Portions Copyright [yyyy] [name of copyright owner]
181414Scindi  *
191414Scindi  * CDDL HEADER END
201414Scindi  */
211414Scindi /*
22*4087Scindi  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
231414Scindi  * Use is subject to license terms.
241414Scindi  */
251414Scindi 
261414Scindi #ifndef _TOPO_PROP_H
271414Scindi #define	_TOPO_PROP_H
281414Scindi 
291414Scindi #pragma ident	"%Z%%M%	%I%	%E% SMI"
301414Scindi 
311414Scindi #include <fm/libtopo.h>
321414Scindi 
331414Scindi #include <topo_list.h>
341414Scindi 
351414Scindi #ifdef __cplusplus
361414Scindi extern "C" {
371414Scindi #endif
381414Scindi 
393062Scindi typedef struct topo_ipgroup_info {
403062Scindi 	char *tpi_name;			/* property group name */
413062Scindi 	topo_stability_t tpi_namestab;	/* stability of group name */
423062Scindi 	topo_stability_t tpi_datastab;	/* stability of all property values */
433062Scindi 	topo_version_t  tpi_version;	/* version of pgroup definition */
443062Scindi } topo_ipgroup_info_t;
453062Scindi 
461414Scindi typedef struct topo_pgroup {
471414Scindi 	topo_list_t tpg_list;		/* next/prev pointers */
483062Scindi 	topo_ipgroup_info_t *tpg_info;	/* name, version, stability */
493062Scindi 	topo_list_t tpg_pvals;		/* property values */
501414Scindi } topo_pgroup_t;
511414Scindi 
52*4087Scindi typedef struct topo_propmethod {
53*4087Scindi 	char *tpm_name;			/* property method name */
54*4087Scindi 	topo_version_t tpm_version;	/* method version */
55*4087Scindi 	nvlist_t *tpm_args;		/* in args for method */
56*4087Scindi } topo_propmethod_t;
57*4087Scindi 
581414Scindi typedef struct topo_propval {
593062Scindi 	char *tp_name;			/* prop name */
603062Scindi 	topo_type_t tp_type;		/* prop type */
613062Scindi 	int tp_flag;			/* dynamic property */
621414Scindi 	int tp_refs;			/* ref count for this prop val */
631414Scindi 	topo_hdl_t *tp_hdl;		/* handle pointer for allocations */
643062Scindi 	void (*tp_free)(struct topo_propval *); /* prop value destructor */
653062Scindi 	nvlist_t *tp_val;
66*4087Scindi 	topo_propmethod_t *tp_method;	/* Method for accessing dynamic prop */
671414Scindi } topo_propval_t;
681414Scindi 
691414Scindi typedef struct topo_proplist {
701414Scindi 	topo_list_t tp_list;		/* next/prev pointers */
711414Scindi 	topo_propval_t *tp_pval;	/* actual value */
721414Scindi } topo_proplist_t;
731414Scindi 
741414Scindi extern void topo_prop_hold(topo_propval_t *);
751414Scindi extern void topo_prop_rele(topo_propval_t *);
761414Scindi extern void topo_pgroup_destroy_all(tnode_t *);
77*4087Scindi extern nvlist_t *topo_prop_get(tnode_t *, const char *, const char *,
78*4087Scindi     topo_type_t, nvlist_t *, int *err);
791414Scindi 
801414Scindi #ifdef __cplusplus
811414Scindi }
821414Scindi #endif
831414Scindi 
841414Scindi #endif	/* _TOPO_PROP_H */
85