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.
30 #pragma ident "%Z%%M% %I% %E% SMI"
39 typedef uint64_t picl_hdl_t
;
42 * Hash table size of Ptree and PICL tables
44 #define HASH_TBL_SIZE 128
45 #define HASH_INDEX(s, x) ((int)((x) & ((s) - 1)))
50 #define PICL_INVALID_PICLHDL (picl_hdl_t)0
53 * Is the object PICLized?
55 #define IS_PICLIZED(x) ((x)->picl_hdl != NULL)
58 * A handle is a 64-bit quantity with the daemon's pid value in top 32 bits
59 * and the raw handle value in the lower 32 bits.
61 #define HASH_VAL(x) ((x) & 0xFFFFFFFF)
62 #define GET_PID(x) ((x) >> 32)
63 #define MAKE_HANDLE(x, y) (((picl_hdl_t)(x) << 32) | (y))
66 * Lock type when locking a node
72 * Property access operation
80 typedef struct picl_obj picl_obj_t
;
83 * Hash table structure
91 struct hash_elem
*next
;
93 typedef struct hash_elem hash_elem_t
;
94 #define hash_obj u.data
95 #define hash_hdl u.ptreeh
103 * Property expression list
105 typedef struct prop_list
{
108 struct prop_list
*next
;
112 * PICL property (scalar or a table entry)
115 ptree_propinfo_t info
;
117 picl_obj_t
*nodep
; /* prop's node or table */
118 picl_obj_t
*next_in_list
;
119 picl_obj_t
*next_by_row
;
120 picl_obj_t
*next_by_col
;
122 typedef struct picl_prop picl_prop_t
;
128 rwlock_t rwlock
; /* protects properties */
129 picl_obj_t
*firstprop
;
131 picl_obj_t
*parent
; /* protected by ptree lock */
132 picl_obj_t
*child
; /* protected by ptree lock */
133 picl_obj_t
*sibling
; /* protected by ptree lock */
135 typedef struct picl_node picl_node_t
;
140 #define PICL_OBJ_NODE 0x1
141 #define PICL_OBJ_PROP 0x2
142 #define PICL_OBJ_TABLE 0x4
143 #define PICL_OBJ_TABLEENTRY 0x8
150 picl_hdl_t ptree_hdl
; /* ptree handle */
151 picl_hdl_t picl_hdl
; /* client handle */
158 #define pinfo_ver u.prop.info.version
159 #define prop_type u.prop.info.piclinfo.type
160 #define prop_size u.prop.info.piclinfo.size
161 #define prop_mode u.prop.info.piclinfo.accessmode
162 #define prop_name u.prop.info.piclinfo.name
163 #define prop_val u.prop.pvalue
164 #define next_row u.prop.next_by_row
165 #define next_col u.prop.next_by_col
166 #define next_prop u.prop.next_in_list
167 #define table_prop u.prop.next_in_list
168 #define prop_node u.prop.nodep
169 #define prop_table u.prop.nodep
170 #define read_func u.prop.info.read
171 #define write_func u.prop.info.write
173 #define first_prop u.node.firstprop
174 #define node_lock u.node.rwlock
175 #define child_node u.node.child
176 #define sibling_node u.node.sibling
177 #define parent_node u.node.parent
178 #define node_classname u.node.classname
181 * PICL event queue structures
187 void (*completion_handler
)(char *ename
, void *earg
,
191 typedef struct eventq eventq_t
;
199 void (*evt_handler
)(const char *ename
, const void *earg
,
200 size_t size
, void *cookie
);
204 struct eh_list
*next
;
206 typedef struct eh_list evt_handler_t
;
210 #define MIN(x, y) ((x) < (y) ? (x) : (y))
212 typedef struct picld_plugin_reg_list
{
213 picld_plugin_reg_t reg
;
214 struct picld_plugin_reg_list
*next
;
215 } picld_plugin_reg_list_t
;
217 typedef struct picld_plinfo
{
221 struct picld_plinfo
*next
;
222 } picld_plugin_desc_t
;
224 extern int xptree_initialize(int);
225 extern void xptree_destroy(void);
226 extern int xptree_reinitialize(void);
227 extern int xptree_refresh_notify(uint32_t secs
);
228 extern int cvt_picl2ptree(picl_hdl_t piclh
, picl_hdl_t
*ptreeh
);
229 extern void cvt_ptree2picl(picl_hdl_t
*vbuf
);
230 extern int xptree_get_propinfo_by_name(picl_nodehdl_t nodeh
,
231 const char *pname
, ptree_propinfo_t
*pinfo
);
232 extern int xptree_get_propval_with_cred(picl_prophdl_t proph
, void *valbuf
,
233 size_t size
, door_cred_t cred
);
234 extern int xptree_get_propval_by_name_with_cred(picl_nodehdl_t nodeh
,
235 const char *propname
, void *valbuf
, size_t sz
,
237 extern int xptree_update_propval_with_cred(picl_prophdl_t proph
,
238 const void *valbuf
, size_t sz
, door_cred_t cred
);
239 extern int xptree_update_propval_by_name_with_cred(picl_nodehdl_t nodeh
,
240 const char *propname
, const void *valbuf
, size_t sz
,
244 * PICL daemon verbose level flag
246 extern int verbose_level
;
247 extern void dbg_print(int level
, const char *fmt
, ...);
248 extern void dbg_exec(int level
, void (*fn
)(void *), void *arg
);
254 #endif /* _PTREE_IMPL_H */