xref: /illumos-gate/usr/src/lib/fm/topo/libtopo/common/topo_prop.h (revision 4e93fb0f6383eaac21897dcdae56b87118131e4d)
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 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _TOPO_PROP_H
27 #define	_TOPO_PROP_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <fm/libtopo.h>
32 
33 #include <topo_list.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 typedef struct topo_ipgroup_info {
40 	char *tpi_name;			/* property group name */
41 	topo_stability_t tpi_namestab;	/* stability of group name */
42 	topo_stability_t tpi_datastab;	/* stability of all property values */
43 	topo_version_t  tpi_version;	/* version of pgroup definition */
44 } topo_ipgroup_info_t;
45 
46 typedef struct topo_pgroup {
47 	topo_list_t tpg_list;		/* next/prev pointers */
48 	topo_ipgroup_info_t *tpg_info;	/* name, version, stability */
49 	topo_list_t tpg_pvals;		/* property values */
50 } topo_pgroup_t;
51 
52 typedef struct topo_propval {
53 	char *tp_name;			/* prop name */
54 	topo_type_t tp_type;		/* prop type */
55 	int tp_flag;			/* dynamic property */
56 	int tp_refs;			/* ref count for this prop val */
57 	topo_hdl_t *tp_hdl;		/* handle pointer for allocations */
58 	void (*tp_free)(struct topo_propval *); /* prop value destructor */
59 	nvlist_t *tp_val;
60 } topo_propval_t;
61 
62 typedef struct topo_proplist {
63 	topo_list_t tp_list;		/* next/prev pointers */
64 	topo_propval_t *tp_pval;	/* actual value */
65 } topo_proplist_t;
66 
67 extern void topo_prop_hold(topo_propval_t *);
68 extern void topo_prop_rele(topo_propval_t *);
69 extern void topo_pgroup_destroy_all(tnode_t *);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif	/* _TOPO_PROP_H */
76