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.
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.
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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _LOWLEVEL_IMPL_H
27 #define _LOWLEVEL_IMPL_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include "libscf_impl.h"
39 #include "repcache_protocol.h"
45 typedef struct scf_datael
{
46 scf_handle_t
*rd_handle
;
50 uu_list_node_t rd_node
;
52 #define DATAEL_VALID 0x0001
57 * Access to handles is serialized -- access to and modification of a handle
58 * and all of its children is protected by rh_lock.
60 * Different handles don't interfere with each other.
63 pthread_mutex_t rh_lock
;
67 uint32_t rh_nextentity
;
68 uint32_t rh_nextchangeid
;
71 int rh_doorfd_old
; /* fd to close once rh_fd_users == 0 */
73 pid_t rh_doorpid
; /* pid at bind time */
77 uint32_t rh_flags
; /* HANDLE_*, below */
78 uint32_t rh_fd_users
; /* non-locked users of rh_doorfd */
80 uu_list_t
*rh_dataels
;
85 long rh_extrefs
; /* user-created subhandle count */
86 long rh_intrefs
; /* handle-internal subhandle count */
88 char rh_doorpath
[PATH_MAX
+ 1];
90 pthread_t rh_holder
; /* thread using subhandles */
91 uint32_t rh_hold_flags
; /* which are in use */
94 scf_scope_t
*rh_scope
;
95 scf_service_t
*rh_service
;
96 scf_instance_t
*rh_instance
;
97 scf_snapshot_t
*rh_snapshot
;
98 scf_snaplevel_t
*rh_snaplvl
;
99 scf_propertygroup_t
*rh_pg
;
100 scf_property_t
*rh_property
;
101 scf_value_t
*rh_value
;
103 #define HANDLE_DEAD 0x0001
104 #define HANDLE_UNREFED 0x0002
105 #define HANDLE_WRAPPED_ENTITY 0x0004
106 #define HANDLE_WRAPPED_ITER 0x0008
108 #define RH_HOLD_ITER 0x0001
109 #define RH_HOLD_SCOPE 0x0002
110 #define RH_HOLD_SERVICE 0x0004
111 #define RH_HOLD_INSTANCE 0x0008
112 #define RH_HOLD_SNAPSHOT 0x0010
113 #define RH_HOLD_SNAPLVL 0x0020
114 #define RH_HOLD_PG 0x0040
115 #define RH_HOLD_PROPERTY 0x0080
116 #define RH_HOLD_VALUE 0x0100
118 #define RH_HOLD_ALL 0x01ff
128 struct scf_instance
{
132 struct scf_snapshot
{
137 * note: be careful of adding more state here -- snaplevel_next() relies on
138 * the fact that the entityid is the only library-level state.
140 struct scf_snaplevel
{
144 struct scf_propertygroup
{
148 struct scf_property
{
153 scf_handle_t
*value_handle
;
154 scf_value_t
*value_next
;
155 scf_transaction_entry_t
*value_tx
;
157 rep_protocol_value_type_t value_type
;
158 size_t value_size
; /* only for opaque values */
159 char value_value
[REP_PROTOCOL_VALUE_LEN
];
162 enum scf_entry_state
{
164 ENTRY_STATE_IN_TX_ACTION
166 struct scf_transaction_entry
{
167 const char *entry_property
;
168 scf_handle_t
*entry_handle
;
169 scf_transaction_t
*entry_tx
;
170 enum scf_entry_state entry_state
;
171 uu_list_node_t entry_link
; /* for property name list */
173 scf_value_t
*entry_head
;
174 scf_value_t
*entry_tail
; /* for linked values */
176 enum rep_protocol_transaction_action entry_action
;
177 rep_protocol_value_type_t entry_type
;
178 char entry_namebuf
[REP_PROTOCOL_NAME_LEN
];
187 struct scf_transaction
{
188 enum scf_tx_state tran_state
;
189 scf_propertygroup_t tran_pg
;
191 uu_list_t
*tran_props
;
195 scf_handle_t
*iter_handle
;
198 uint32_t iter_sequence
;
199 uu_list_node_t iter_node
;
206 #endif /* _LOWLEVEL_IMPL_H */