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
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.
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]
23 * Copyright (c) 1999-2001 by Sun Microsystems, Inc.
24 * All rights reserved.
37 typedef uint64_t picl_hdl_t
;
40 * Hash table size of Ptree and PICL tables
42 #define HASH_TBL_SIZE 128
43 #define HASH_INDEX(s, x) ((int)((x) & ((s) - 1)))
48 #define PICL_INVALID_PICLHDL (picl_hdl_t)0
51 * Is the object PICLized?
53 #define IS_PICLIZED(x) ((x)->picl_hdl != 0)
56 * A handle is a 64-bit quantity with the daemon's pid value in top 32 bits
57 * and the raw handle value in the lower 32 bits.
59 #define HASH_VAL(x) ((x) & 0xFFFFFFFF)
60 #define GET_PID(x) ((x) >> 32)
61 #define MAKE_HANDLE(x, y) (((picl_hdl_t)(x) << 32) | (y))
64 * Lock type when locking a node
70 * Property access operation
78 typedef struct picl_obj picl_obj_t
;
81 * Hash table structure
89 struct hash_elem
*next
;
91 typedef struct hash_elem hash_elem_t
;
92 #define hash_obj u.data
93 #define hash_hdl u.ptreeh
101 * Property expression list
103 typedef struct prop_list
{
106 struct prop_list
*next
;
110 * PICL property (scalar or a table entry)
113 ptree_propinfo_t info
;
115 picl_obj_t
*nodep
; /* prop's node or table */
116 picl_obj_t
*next_in_list
;
117 picl_obj_t
*next_by_row
;
118 picl_obj_t
*next_by_col
;
120 typedef struct picl_prop picl_prop_t
;
126 rwlock_t rwlock
; /* protects properties */
127 picl_obj_t
*firstprop
;
129 picl_obj_t
*parent
; /* protected by ptree lock */
130 picl_obj_t
*child
; /* protected by ptree lock */
131 picl_obj_t
*sibling
; /* protected by ptree lock */
133 typedef struct picl_node picl_node_t
;
138 #define PICL_OBJ_NODE 0x1
139 #define PICL_OBJ_PROP 0x2
140 #define PICL_OBJ_TABLE 0x4
141 #define PICL_OBJ_TABLEENTRY 0x8
148 picl_hdl_t ptree_hdl
; /* ptree handle */
149 picl_hdl_t picl_hdl
; /* client handle */
156 #define pinfo_ver u.prop.info.version
157 #define prop_type u.prop.info.piclinfo.type
158 #define prop_size u.prop.info.piclinfo.size
159 #define prop_mode u.prop.info.piclinfo.accessmode
160 #define prop_name u.prop.info.piclinfo.name
161 #define prop_val u.prop.pvalue
162 #define next_row u.prop.next_by_row
163 #define next_col u.prop.next_by_col
164 #define next_prop u.prop.next_in_list
165 #define table_prop u.prop.next_in_list
166 #define prop_node u.prop.nodep
167 #define prop_table u.prop.nodep
168 #define read_func u.prop.info.read
169 #define write_func u.prop.info.write
171 #define first_prop u.node.firstprop
172 #define node_lock u.node.rwlock
173 #define child_node u.node.child
174 #define sibling_node u.node.sibling
175 #define parent_node u.node.parent
176 #define node_classname u.node.classname
179 * PICL event queue structures
185 void (*completion_handler
)(char *ename
, void *earg
,
189 typedef struct eventq eventq_t
;
197 void (*evt_handler
)(const char *ename
, const void *earg
,
198 size_t size
, void *cookie
);
202 struct eh_list
*next
;
204 typedef struct eh_list evt_handler_t
;
208 #define MIN(x, y) ((x) < (y) ? (x) : (y))
210 typedef struct picld_plugin_reg_list
{
211 picld_plugin_reg_t reg
;
212 struct picld_plugin_reg_list
*next
;
213 } picld_plugin_reg_list_t
;
215 typedef struct picld_plinfo
{
219 struct picld_plinfo
*next
;
220 } picld_plugin_desc_t
;
222 extern int xptree_initialize(int);
223 extern void xptree_destroy(void);
224 extern int xptree_reinitialize(void);
225 extern int xptree_refresh_notify(uint32_t secs
);
226 extern int cvt_picl2ptree(picl_hdl_t piclh
, picl_hdl_t
*ptreeh
);
227 extern void cvt_ptree2picl(picl_hdl_t
*vbuf
);
228 extern int xptree_get_propinfo_by_name(picl_nodehdl_t nodeh
,
229 const char *pname
, ptree_propinfo_t
*pinfo
);
230 extern int xptree_get_propval_with_cred(picl_prophdl_t proph
, void *valbuf
,
231 size_t size
, door_cred_t cred
);
232 extern int xptree_get_propval_by_name_with_cred(picl_nodehdl_t nodeh
,
233 const char *propname
, void *valbuf
, size_t sz
,
235 extern int xptree_update_propval_with_cred(picl_prophdl_t proph
,
236 const void *valbuf
, size_t sz
, door_cred_t cred
);
237 extern int xptree_update_propval_by_name_with_cred(picl_nodehdl_t nodeh
,
238 const char *propname
, const void *valbuf
, size_t sz
,
242 * PICL daemon verbose level flag
244 extern int verbose_level
;
245 extern void dbg_print(int level
, const char *fmt
, ...);
246 extern void dbg_exec(int level
, void (*fn
)(void *), void *arg
);
252 #endif /* _PTREE_IMPL_H */