xref: /illumos-gate/usr/src/lib/fm/topo/libtopo/common/topo_prop.h (revision a07094369b21309434206d9b3601d162693466fc)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _TOPO_PROP_H
28 #define	_TOPO_PROP_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <fm/libtopo.h>
33 
34 #include <topo_list.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 typedef struct topo_pgroup {
41 	topo_list_t tpg_list;		/* next/prev pointers */
42 	char *tpg_name;			/* Group name */
43 	topo_stability_t tpg_stability;	/* SMI Stability level */
44 	topo_list_t tpg_pvals;		/* Property values */
45 } topo_pgroup_t;
46 
47 typedef struct topo_propval {
48 	char *tp_name;			/* Prop name */
49 	topo_type_t tp_type;		/* Prop type */
50 	int tp_flag;			/* Dynamic property */
51 	int tp_refs;			/* ref count for this prop val */
52 	topo_hdl_t *tp_hdl;		/* handle pointer for allocations */
53 	void (*tp_free)(struct topo_propval *); /* Prop value destructor */
54 	union {
55 		int32_t tp_int32;
56 		int32_t tp_uint32;
57 		int64_t tp_int64;
58 		int64_t tp_uint64;
59 		char *tp_string;
60 		nvlist_t *tp_fmri;
61 	} tp_u;
62 } topo_propval_t;
63 
64 typedef struct topo_proplist {
65 	topo_list_t tp_list;		/* next/prev pointers */
66 	topo_propval_t *tp_pval;	/* actual value */
67 } topo_proplist_t;
68 
69 extern int topo_prop_inherit(tnode_t *, const char *, const char *, int *);
70 extern void topo_prop_hold(topo_propval_t *);
71 extern void topo_prop_rele(topo_propval_t *);
72 extern void topo_pgroup_destroy_all(tnode_t *);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif	/* _TOPO_PROP_H */
79