1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _CONFIGD_H 28*0Sstevel@tonic-gate #define _CONFIGD_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <door.h> 33*0Sstevel@tonic-gate #include <pthread.h> 34*0Sstevel@tonic-gate #include <string.h> 35*0Sstevel@tonic-gate #include <sys/types.h> 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate #include <libscf.h> 38*0Sstevel@tonic-gate #include <repcache_protocol.h> 39*0Sstevel@tonic-gate #include <libuutil.h> 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #include <configd_exit.h> 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gate #ifdef __cplusplus 44*0Sstevel@tonic-gate extern "C" { 45*0Sstevel@tonic-gate #endif 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gate /* 48*0Sstevel@tonic-gate * Lock order: 49*0Sstevel@tonic-gate * 50*0Sstevel@tonic-gate * client lock 51*0Sstevel@tonic-gate * iter locks, in ID order 52*0Sstevel@tonic-gate * entity locks, in ID order 53*0Sstevel@tonic-gate * 54*0Sstevel@tonic-gate * (any iter/entity locks) 55*0Sstevel@tonic-gate * backend locks (NORMAL, then NONPERSIST) 56*0Sstevel@tonic-gate * rc_node lock 57*0Sstevel@tonic-gate * children's rc_node lock 58*0Sstevel@tonic-gate * cache bucket lock 59*0Sstevel@tonic-gate * rc_node lock[*] 60*0Sstevel@tonic-gate * 61*0Sstevel@tonic-gate * * only one node may be grabbed while holding a bucket lock 62*0Sstevel@tonic-gate * 63*0Sstevel@tonic-gate * leaf locks: (no other locks may be aquired while holding one) 64*0Sstevel@tonic-gate * rc_pg_notify_lock 65*0Sstevel@tonic-gate */ 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate /* 68*0Sstevel@tonic-gate * Returns the minimum size for a structure of type 't' such 69*0Sstevel@tonic-gate * that it is safe to access field 'f'. 70*0Sstevel@tonic-gate */ 71*0Sstevel@tonic-gate #define offsetofend(t, f) (offsetof(t, f) + sizeof (((t *)0)->f)) 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate /* 74*0Sstevel@tonic-gate * We want MUTEX_HELD, but we also want pthreads. So we're stuck with this. 75*0Sstevel@tonic-gate */ 76*0Sstevel@tonic-gate struct _lwp_mutex_t; 77*0Sstevel@tonic-gate extern int _mutex_held(struct _lwp_mutex_t *); 78*0Sstevel@tonic-gate #define MUTEX_HELD(m) _mutex_held((struct _lwp_mutex_t *)(m)) 79*0Sstevel@tonic-gate 80*0Sstevel@tonic-gate /* 81*0Sstevel@tonic-gate * Maximum levels of composition. 82*0Sstevel@tonic-gate */ 83*0Sstevel@tonic-gate #define COMPOSITION_DEPTH 2 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate /* 86*0Sstevel@tonic-gate * The default locations of the repository dbs 87*0Sstevel@tonic-gate */ 88*0Sstevel@tonic-gate #define REPOSITORY_DB "/etc/svc/repository.db" 89*0Sstevel@tonic-gate #define NONPERSIST_DB "/etc/svc/volatile/svc_nonpersist.db" 90*0Sstevel@tonic-gate 91*0Sstevel@tonic-gate #define CONFIGD_CORE "core.%f.%t.%p" 92*0Sstevel@tonic-gate 93*0Sstevel@tonic-gate #ifndef NDEBUG 94*0Sstevel@tonic-gate #define bad_error(f, e) \ 95*0Sstevel@tonic-gate uu_warn("%s:%d: %s() returned bad error %d. Aborting.\n", \ 96*0Sstevel@tonic-gate __FILE__, __LINE__, f, e); \ 97*0Sstevel@tonic-gate abort() 98*0Sstevel@tonic-gate #else 99*0Sstevel@tonic-gate #define bad_error(f, e) abort() 100*0Sstevel@tonic-gate #endif 101*0Sstevel@tonic-gate 102*0Sstevel@tonic-gate typedef enum backend_type { 103*0Sstevel@tonic-gate BACKEND_TYPE_NORMAL = 0, 104*0Sstevel@tonic-gate BACKEND_TYPE_NONPERSIST, 105*0Sstevel@tonic-gate BACKEND_TYPE_TOTAL /* backend use only */ 106*0Sstevel@tonic-gate } backend_type_t; 107*0Sstevel@tonic-gate 108*0Sstevel@tonic-gate /* 109*0Sstevel@tonic-gate * pre-declare rc_* types 110*0Sstevel@tonic-gate */ 111*0Sstevel@tonic-gate typedef struct rc_node rc_node_t; 112*0Sstevel@tonic-gate typedef struct rc_snapshot rc_snapshot_t; 113*0Sstevel@tonic-gate typedef struct rc_snaplevel rc_snaplevel_t; 114*0Sstevel@tonic-gate 115*0Sstevel@tonic-gate /* 116*0Sstevel@tonic-gate * notification layer -- protected by rc_pg_notify_lock 117*0Sstevel@tonic-gate */ 118*0Sstevel@tonic-gate typedef struct rc_notify_info rc_notify_info_t; 119*0Sstevel@tonic-gate typedef struct rc_notify_delete rc_notify_delete_t; 120*0Sstevel@tonic-gate 121*0Sstevel@tonic-gate #define RC_NOTIFY_MAX_NAMES 4 /* enough for now */ 122*0Sstevel@tonic-gate 123*0Sstevel@tonic-gate typedef struct rc_notify { 124*0Sstevel@tonic-gate uu_list_node_t rcn_list_node; 125*0Sstevel@tonic-gate rc_node_t *rcn_node; 126*0Sstevel@tonic-gate rc_notify_info_t *rcn_info; 127*0Sstevel@tonic-gate rc_notify_delete_t *rcn_delete; 128*0Sstevel@tonic-gate } rc_notify_t; 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gate struct rc_notify_delete { 131*0Sstevel@tonic-gate rc_notify_t rnd_notify; 132*0Sstevel@tonic-gate char rnd_fmri[REP_PROTOCOL_FMRI_LEN]; 133*0Sstevel@tonic-gate }; 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate struct rc_notify_info { 136*0Sstevel@tonic-gate uu_list_node_t rni_list_node; 137*0Sstevel@tonic-gate rc_notify_t rni_notify; 138*0Sstevel@tonic-gate const char *rni_namelist[RC_NOTIFY_MAX_NAMES]; 139*0Sstevel@tonic-gate const char *rni_typelist[RC_NOTIFY_MAX_NAMES]; 140*0Sstevel@tonic-gate 141*0Sstevel@tonic-gate int rni_flags; 142*0Sstevel@tonic-gate int rni_waiters; 143*0Sstevel@tonic-gate pthread_cond_t rni_cv; 144*0Sstevel@tonic-gate }; 145*0Sstevel@tonic-gate #define RC_NOTIFY_ACTIVE 0x00000001 146*0Sstevel@tonic-gate #define RC_NOTIFY_DRAIN 0x00000002 147*0Sstevel@tonic-gate #define RC_NOTIFY_EMPTYING 0x00000004 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate typedef struct rc_node_pg_notify { 150*0Sstevel@tonic-gate uu_list_node_t rnpn_node; 151*0Sstevel@tonic-gate int rnpn_fd; 152*0Sstevel@tonic-gate rc_node_t *rnpn_pg; 153*0Sstevel@tonic-gate } rc_node_pg_notify_t; 154*0Sstevel@tonic-gate 155*0Sstevel@tonic-gate /* 156*0Sstevel@tonic-gate * cache layer 157*0Sstevel@tonic-gate */ 158*0Sstevel@tonic-gate 159*0Sstevel@tonic-gate /* 160*0Sstevel@tonic-gate * The 'key' for the main object hash. main_id is the main object 161*0Sstevel@tonic-gate * identifier. The rl_ids array contains: 162*0Sstevel@tonic-gate * 163*0Sstevel@tonic-gate * TYPE RL_IDS 164*0Sstevel@tonic-gate * scope unused 165*0Sstevel@tonic-gate * service unused 166*0Sstevel@tonic-gate * instance {service_id} 167*0Sstevel@tonic-gate * snapshot {service_id, instance_id} 168*0Sstevel@tonic-gate * snaplevel {service_id, instance_id, name_id, snapshot_id} 169*0Sstevel@tonic-gate * propertygroup {service_id, (instance_id or 0), (name_id or 0), 170*0Sstevel@tonic-gate * (snapshot_id or 0), (l_id or 0)} 171*0Sstevel@tonic-gate * property {service_id, (instance_id or 0), (name_id or 0), 172*0Sstevel@tonic-gate * (snapshot_id or 0), (l_id or 0), pg_id, gen_id} 173*0Sstevel@tonic-gate */ 174*0Sstevel@tonic-gate #define ID_SERVICE 0 175*0Sstevel@tonic-gate #define ID_INSTANCE 1 176*0Sstevel@tonic-gate #define ID_NAME 2 177*0Sstevel@tonic-gate #define ID_SNAPSHOT 3 178*0Sstevel@tonic-gate #define ID_LEVEL 4 179*0Sstevel@tonic-gate #define ID_PG 5 180*0Sstevel@tonic-gate #define ID_GEN 6 181*0Sstevel@tonic-gate #define MAX_IDS 7 182*0Sstevel@tonic-gate typedef struct rc_node_lookup { 183*0Sstevel@tonic-gate uint16_t rl_type; /* REP_PROTOCOL_ENTITY_* */ 184*0Sstevel@tonic-gate uint16_t rl_backend; /* BACKEND_TYPE_* */ 185*0Sstevel@tonic-gate uint32_t rl_main_id; /* primary identifier */ 186*0Sstevel@tonic-gate uint32_t rl_ids[MAX_IDS]; /* context */ 187*0Sstevel@tonic-gate } rc_node_lookup_t; 188*0Sstevel@tonic-gate 189*0Sstevel@tonic-gate struct rc_node { 190*0Sstevel@tonic-gate /* 191*0Sstevel@tonic-gate * read-only data 192*0Sstevel@tonic-gate */ 193*0Sstevel@tonic-gate rc_node_lookup_t rn_id; /* must be first */ 194*0Sstevel@tonic-gate uint32_t rn_hash; 195*0Sstevel@tonic-gate const char *rn_name; 196*0Sstevel@tonic-gate 197*0Sstevel@tonic-gate /* 198*0Sstevel@tonic-gate * type-specific state 199*0Sstevel@tonic-gate * (if space becomes an issue, these can become a union) 200*0Sstevel@tonic-gate */ 201*0Sstevel@tonic-gate 202*0Sstevel@tonic-gate /* 203*0Sstevel@tonic-gate * Used by instances, snapshots, and "composed property groups" only. 204*0Sstevel@tonic-gate * These are the entities whose properties should appear composed when 205*0Sstevel@tonic-gate * this entity is traversed by a composed iterator. 0 is the top-most 206*0Sstevel@tonic-gate * entity, down to COMPOSITION_DEPTH - 1. 207*0Sstevel@tonic-gate */ 208*0Sstevel@tonic-gate rc_node_t *rn_cchain[COMPOSITION_DEPTH]; 209*0Sstevel@tonic-gate 210*0Sstevel@tonic-gate /* 211*0Sstevel@tonic-gate * used by property groups only 212*0Sstevel@tonic-gate */ 213*0Sstevel@tonic-gate const char *rn_type; 214*0Sstevel@tonic-gate uint32_t rn_pgflags; 215*0Sstevel@tonic-gate uint32_t rn_gen_id; 216*0Sstevel@tonic-gate uu_list_t *rn_pg_notify_list; /* prot by rc_pg_notify_lock */ 217*0Sstevel@tonic-gate rc_notify_t rn_notify; /* prot by rc_pg_notify_lock */ 218*0Sstevel@tonic-gate 219*0Sstevel@tonic-gate /* 220*0Sstevel@tonic-gate * used by properties only 221*0Sstevel@tonic-gate */ 222*0Sstevel@tonic-gate rep_protocol_value_type_t rn_valtype; 223*0Sstevel@tonic-gate const char *rn_values; /* protected by rn_lock */ 224*0Sstevel@tonic-gate size_t rn_values_count; /* protected by rn_lock */ 225*0Sstevel@tonic-gate size_t rn_values_size; /* protected by rn_lock */ 226*0Sstevel@tonic-gate 227*0Sstevel@tonic-gate /* 228*0Sstevel@tonic-gate * used by snapshots only 229*0Sstevel@tonic-gate */ 230*0Sstevel@tonic-gate uint32_t rn_snapshot_id; 231*0Sstevel@tonic-gate rc_snapshot_t *rn_snapshot; /* protected by rn_lock */ 232*0Sstevel@tonic-gate 233*0Sstevel@tonic-gate /* 234*0Sstevel@tonic-gate * used by snaplevels only 235*0Sstevel@tonic-gate */ 236*0Sstevel@tonic-gate rc_snaplevel_t *rn_snaplevel; 237*0Sstevel@tonic-gate 238*0Sstevel@tonic-gate /* 239*0Sstevel@tonic-gate * mutable state 240*0Sstevel@tonic-gate */ 241*0Sstevel@tonic-gate pthread_mutex_t rn_lock; 242*0Sstevel@tonic-gate pthread_cond_t rn_cv; 243*0Sstevel@tonic-gate uint32_t rn_flags; 244*0Sstevel@tonic-gate uint32_t rn_refs; /* reference count */ 245*0Sstevel@tonic-gate uint32_t rn_other_refs; /* atomic refcount */ 246*0Sstevel@tonic-gate uint32_t rn_other_refs_held; /* for 1->0 transitions */ 247*0Sstevel@tonic-gate 248*0Sstevel@tonic-gate uu_list_t *rn_children; 249*0Sstevel@tonic-gate uu_list_node_t rn_sibling_node; 250*0Sstevel@tonic-gate 251*0Sstevel@tonic-gate rc_node_t *rn_parent; /* set if on child list */ 252*0Sstevel@tonic-gate rc_node_t *rn_former; /* next former node */ 253*0Sstevel@tonic-gate rc_node_t *rn_parent_ref; /* reference count target */ 254*0Sstevel@tonic-gate 255*0Sstevel@tonic-gate /* 256*0Sstevel@tonic-gate * external state (protected by hash chain lock) 257*0Sstevel@tonic-gate */ 258*0Sstevel@tonic-gate rc_node_t *rn_hash_next; 259*0Sstevel@tonic-gate }; 260*0Sstevel@tonic-gate 261*0Sstevel@tonic-gate /* 262*0Sstevel@tonic-gate * flag ordering: 263*0Sstevel@tonic-gate * RC_DYING 264*0Sstevel@tonic-gate * RC_NODE_CHILDREN_CHANGING 265*0Sstevel@tonic-gate * RC_NODE_CREATING_CHILD 266*0Sstevel@tonic-gate * RC_NODE_USING_PARENT 267*0Sstevel@tonic-gate * RC_NODE_IN_TX 268*0Sstevel@tonic-gate * 269*0Sstevel@tonic-gate * RC_NODE_USING_PARENT is special, because it lets you proceed up the tree, 270*0Sstevel@tonic-gate * in the reverse of the usual locking order. Because of this, there are 271*0Sstevel@tonic-gate * limitations on what you can do while holding it. While holding 272*0Sstevel@tonic-gate * RC_NODE_USING_PARENT, you may: 273*0Sstevel@tonic-gate * bump or release your parent's reference count 274*0Sstevel@tonic-gate * access fields in your parent 275*0Sstevel@tonic-gate * hold RC_NODE_USING_PARENT in the parent, proceeding recursively. 276*0Sstevel@tonic-gate * 277*0Sstevel@tonic-gate * If you are only holding *one* node's RC_NODE_USING_PARENT, and: 278*0Sstevel@tonic-gate * you are *not* proceeding recursively, you can hold your 279*0Sstevel@tonic-gate * immediate parent's RC_NODE_CHILDREN_CHANGING flag. 280*0Sstevel@tonic-gate * you hold your parent's RC_NODE_CHILDREN_CHANGING flag, you can add 281*0Sstevel@tonic-gate * RC_NODE_IN_TX to your flags. 282*0Sstevel@tonic-gate * you want to grab a flag in your parent, you must lock your parent, 283*0Sstevel@tonic-gate * lock yourself, drop RC_NODE_USING_PARENT, unlock yourself, 284*0Sstevel@tonic-gate * then proceed to manipulate the parent. 285*0Sstevel@tonic-gate */ 286*0Sstevel@tonic-gate #define RC_NODE_CHILDREN_CHANGING 0x00000001 /* child list in flux */ 287*0Sstevel@tonic-gate #define RC_NODE_HAS_CHILDREN 0x00000002 /* child list is accurate */ 288*0Sstevel@tonic-gate 289*0Sstevel@tonic-gate #define RC_NODE_IN_PARENT 0x00000004 /* I'm in my parent's list */ 290*0Sstevel@tonic-gate #define RC_NODE_USING_PARENT 0x00000008 /* parent ptr in use */ 291*0Sstevel@tonic-gate #define RC_NODE_CREATING_CHILD 0x00000010 /* a create is in progress */ 292*0Sstevel@tonic-gate #define RC_NODE_IN_TX 0x00000020 /* a tx is in progess */ 293*0Sstevel@tonic-gate 294*0Sstevel@tonic-gate #define RC_NODE_OLD 0x00000400 /* out-of-date object */ 295*0Sstevel@tonic-gate #define RC_NODE_ON_FORMER 0x00000800 /* on an rn_former list */ 296*0Sstevel@tonic-gate 297*0Sstevel@tonic-gate #define RC_NODE_PARENT_REF 0x00001000 /* parent_ref in use */ 298*0Sstevel@tonic-gate #define RC_NODE_UNREFED 0x00002000 /* unref processing active */ 299*0Sstevel@tonic-gate #define RC_NODE_DYING 0x00004000 /* node is being deleted */ 300*0Sstevel@tonic-gate #define RC_NODE_DEAD 0x00008000 /* node has been deleted */ 301*0Sstevel@tonic-gate 302*0Sstevel@tonic-gate #define RC_NODE_DYING_FLAGS \ 303*0Sstevel@tonic-gate (RC_NODE_CHILDREN_CHANGING | RC_NODE_IN_TX | RC_NODE_DYING | \ 304*0Sstevel@tonic-gate RC_NODE_CREATING_CHILD) 305*0Sstevel@tonic-gate 306*0Sstevel@tonic-gate #define RC_NODE_WAITING_FLAGS \ 307*0Sstevel@tonic-gate (RC_NODE_DYING_FLAGS | RC_NODE_USING_PARENT) 308*0Sstevel@tonic-gate 309*0Sstevel@tonic-gate 310*0Sstevel@tonic-gate typedef struct rc_node_ptr { 311*0Sstevel@tonic-gate rc_node_t *rnp_node; 312*0Sstevel@tonic-gate char rnp_authorized; /* transaction pre-authed */ 313*0Sstevel@tonic-gate char rnp_deleted; /* object was deleted */ 314*0Sstevel@tonic-gate } rc_node_ptr_t; 315*0Sstevel@tonic-gate 316*0Sstevel@tonic-gate #define NODE_PTR_NOT_HELD(npp) \ 317*0Sstevel@tonic-gate ((npp)->rnp_node == NULL || !MUTEX_HELD(&(npp)->rnp_node->rn_lock)) 318*0Sstevel@tonic-gate 319*0Sstevel@tonic-gate typedef int rc_iter_filter_func(rc_node_t *, void *); 320*0Sstevel@tonic-gate 321*0Sstevel@tonic-gate typedef struct rc_node_iter { 322*0Sstevel@tonic-gate rc_node_t *rni_parent; 323*0Sstevel@tonic-gate int rni_clevel; /* index into rni_parent->rn_cchain[] */ 324*0Sstevel@tonic-gate rc_node_t *rni_iter_node; 325*0Sstevel@tonic-gate uu_list_walk_t *rni_iter; 326*0Sstevel@tonic-gate uint32_t rni_type; 327*0Sstevel@tonic-gate 328*0Sstevel@tonic-gate /* 329*0Sstevel@tonic-gate * for normal walks 330*0Sstevel@tonic-gate */ 331*0Sstevel@tonic-gate rc_iter_filter_func *rni_filter; 332*0Sstevel@tonic-gate void *rni_filter_arg; 333*0Sstevel@tonic-gate 334*0Sstevel@tonic-gate /* 335*0Sstevel@tonic-gate * for value walks 336*0Sstevel@tonic-gate */ 337*0Sstevel@tonic-gate uint32_t rni_offset; /* next value offset */ 338*0Sstevel@tonic-gate uint32_t rni_last_offset; /* previous value offset */ 339*0Sstevel@tonic-gate } rc_node_iter_t; 340*0Sstevel@tonic-gate 341*0Sstevel@tonic-gate typedef struct rc_node_tx { 342*0Sstevel@tonic-gate rc_node_ptr_t rnt_ptr; 343*0Sstevel@tonic-gate int rnt_authorized; /* No need to check anymore. */ 344*0Sstevel@tonic-gate } rc_node_tx_t; 345*0Sstevel@tonic-gate 346*0Sstevel@tonic-gate 347*0Sstevel@tonic-gate typedef struct cache_bucket { 348*0Sstevel@tonic-gate pthread_mutex_t cb_lock; 349*0Sstevel@tonic-gate rc_node_t *cb_head; 350*0Sstevel@tonic-gate 351*0Sstevel@tonic-gate char cb_pad[64 - sizeof (pthread_mutex_t) - 352*0Sstevel@tonic-gate 2 * sizeof (rc_node_t *)]; 353*0Sstevel@tonic-gate } cache_bucket_t; 354*0Sstevel@tonic-gate 355*0Sstevel@tonic-gate /* 356*0Sstevel@tonic-gate * Snapshots 357*0Sstevel@tonic-gate */ 358*0Sstevel@tonic-gate struct rc_snapshot { 359*0Sstevel@tonic-gate uint32_t rs_snap_id; 360*0Sstevel@tonic-gate 361*0Sstevel@tonic-gate pthread_mutex_t rs_lock; 362*0Sstevel@tonic-gate pthread_cond_t rs_cv; 363*0Sstevel@tonic-gate 364*0Sstevel@tonic-gate uint32_t rs_flags; 365*0Sstevel@tonic-gate uint32_t rs_refcnt; /* references from rc_nodes */ 366*0Sstevel@tonic-gate uint32_t rs_childref; /* references to children */ 367*0Sstevel@tonic-gate 368*0Sstevel@tonic-gate rc_snaplevel_t *rs_levels; /* list of levels */ 369*0Sstevel@tonic-gate rc_snapshot_t *rs_hash_next; 370*0Sstevel@tonic-gate }; 371*0Sstevel@tonic-gate #define RC_SNAPSHOT_FILLING 0x00000001 /* rs_levels changing */ 372*0Sstevel@tonic-gate #define RC_SNAPSHOT_READY 0x00000002 373*0Sstevel@tonic-gate #define RC_SNAPSHOT_DEAD 0x00000004 /* no resources */ 374*0Sstevel@tonic-gate 375*0Sstevel@tonic-gate typedef struct rc_snaplevel_pgs { 376*0Sstevel@tonic-gate uint32_t rsp_pg_id; 377*0Sstevel@tonic-gate uint32_t rsp_gen_id; 378*0Sstevel@tonic-gate } rc_snaplevel_pgs_t; 379*0Sstevel@tonic-gate 380*0Sstevel@tonic-gate struct rc_snaplevel { 381*0Sstevel@tonic-gate rc_snapshot_t *rsl_parent; 382*0Sstevel@tonic-gate uint32_t rsl_level_num; 383*0Sstevel@tonic-gate uint32_t rsl_level_id; 384*0Sstevel@tonic-gate 385*0Sstevel@tonic-gate uint32_t rsl_service_id; 386*0Sstevel@tonic-gate uint32_t rsl_instance_id; 387*0Sstevel@tonic-gate 388*0Sstevel@tonic-gate const char *rsl_scope; 389*0Sstevel@tonic-gate const char *rsl_service; 390*0Sstevel@tonic-gate const char *rsl_instance; 391*0Sstevel@tonic-gate 392*0Sstevel@tonic-gate rc_snaplevel_t *rsl_next; 393*0Sstevel@tonic-gate }; 394*0Sstevel@tonic-gate 395*0Sstevel@tonic-gate /* 396*0Sstevel@tonic-gate * Client layer -- the IDs fields must be first, in order for the search 397*0Sstevel@tonic-gate * routines to work correctly. 398*0Sstevel@tonic-gate */ 399*0Sstevel@tonic-gate enum repcache_txstate { 400*0Sstevel@tonic-gate REPCACHE_TX_INIT, 401*0Sstevel@tonic-gate REPCACHE_TX_SETUP, 402*0Sstevel@tonic-gate REPCACHE_TX_COMMITTED 403*0Sstevel@tonic-gate }; 404*0Sstevel@tonic-gate 405*0Sstevel@tonic-gate typedef struct repcache_entity { 406*0Sstevel@tonic-gate uint32_t re_id; 407*0Sstevel@tonic-gate uu_list_node_t re_link; 408*0Sstevel@tonic-gate uint32_t re_changeid; 409*0Sstevel@tonic-gate 410*0Sstevel@tonic-gate pthread_mutex_t re_lock; 411*0Sstevel@tonic-gate uint32_t re_type; 412*0Sstevel@tonic-gate rc_node_ptr_t re_node; 413*0Sstevel@tonic-gate enum repcache_txstate re_txstate; /* property groups only */ 414*0Sstevel@tonic-gate } repcache_entity_t; 415*0Sstevel@tonic-gate 416*0Sstevel@tonic-gate typedef struct repcache_iter { 417*0Sstevel@tonic-gate uint32_t ri_id; 418*0Sstevel@tonic-gate uu_list_node_t ri_link; 419*0Sstevel@tonic-gate 420*0Sstevel@tonic-gate uint32_t ri_type; /* result type */ 421*0Sstevel@tonic-gate 422*0Sstevel@tonic-gate pthread_mutex_t ri_lock; 423*0Sstevel@tonic-gate uint32_t ri_sequence; 424*0Sstevel@tonic-gate rc_node_iter_t *ri_iter; 425*0Sstevel@tonic-gate } repcache_iter_t; 426*0Sstevel@tonic-gate 427*0Sstevel@tonic-gate typedef struct repcache_client { 428*0Sstevel@tonic-gate /* 429*0Sstevel@tonic-gate * constants 430*0Sstevel@tonic-gate */ 431*0Sstevel@tonic-gate uint32_t rc_id; /* must be first */ 432*0Sstevel@tonic-gate int rc_all_auths; /* bypass auth checks */ 433*0Sstevel@tonic-gate uint32_t rc_debug; /* debug flags */ 434*0Sstevel@tonic-gate pid_t rc_pid; /* pid of opening process */ 435*0Sstevel@tonic-gate door_id_t rc_doorid; /* a globally unique identifier */ 436*0Sstevel@tonic-gate int rc_doorfd; /* our door's FD */ 437*0Sstevel@tonic-gate 438*0Sstevel@tonic-gate /* 439*0Sstevel@tonic-gate * client list linkage, protected by hash chain lock 440*0Sstevel@tonic-gate */ 441*0Sstevel@tonic-gate uu_list_node_t rc_link; 442*0Sstevel@tonic-gate 443*0Sstevel@tonic-gate /* 444*0Sstevel@tonic-gate * notification information, protected by rc_node layer 445*0Sstevel@tonic-gate */ 446*0Sstevel@tonic-gate rc_node_pg_notify_t rc_pg_notify; 447*0Sstevel@tonic-gate rc_notify_info_t rc_notify_info; 448*0Sstevel@tonic-gate 449*0Sstevel@tonic-gate /* 450*0Sstevel@tonic-gate * client_wait output, only usable by rc_notify_thr 451*0Sstevel@tonic-gate */ 452*0Sstevel@tonic-gate rc_node_ptr_t rc_notify_ptr; 453*0Sstevel@tonic-gate 454*0Sstevel@tonic-gate /* 455*0Sstevel@tonic-gate * register lists, protected by rc_lock 456*0Sstevel@tonic-gate */ 457*0Sstevel@tonic-gate uu_list_t *rc_entity_list; /* entities */ 458*0Sstevel@tonic-gate uu_list_t *rc_iter_list; /* iters */ 459*0Sstevel@tonic-gate 460*0Sstevel@tonic-gate /* 461*0Sstevel@tonic-gate * Variables, protected by rc_lock 462*0Sstevel@tonic-gate */ 463*0Sstevel@tonic-gate int rc_refcnt; /* in-progress door calls */ 464*0Sstevel@tonic-gate int rc_flags; /* state */ 465*0Sstevel@tonic-gate uint32_t rc_changeid; /* used to make backups idempotent */ 466*0Sstevel@tonic-gate pthread_t rc_insert_thr; /* single thread trying to insert */ 467*0Sstevel@tonic-gate pthread_t rc_notify_thr; /* single thread waiting for notify */ 468*0Sstevel@tonic-gate pthread_cond_t rc_cv; 469*0Sstevel@tonic-gate pthread_mutex_t rc_lock; 470*0Sstevel@tonic-gate } repcache_client_t; 471*0Sstevel@tonic-gate #define RC_CLIENT_DEAD 0x00000001 472*0Sstevel@tonic-gate 473*0Sstevel@tonic-gate typedef struct client_bucket { 474*0Sstevel@tonic-gate pthread_mutex_t cb_lock; 475*0Sstevel@tonic-gate uu_list_t *cb_list; 476*0Sstevel@tonic-gate char ch_pad[64 - sizeof (pthread_mutex_t) - sizeof (uu_list_t *)]; 477*0Sstevel@tonic-gate } client_bucket_t; 478*0Sstevel@tonic-gate 479*0Sstevel@tonic-gate enum rc_ptr_type { 480*0Sstevel@tonic-gate RC_PTR_TYPE_ENTITY = 1, 481*0Sstevel@tonic-gate RC_PTR_TYPE_ITER 482*0Sstevel@tonic-gate }; 483*0Sstevel@tonic-gate 484*0Sstevel@tonic-gate typedef struct request_log_ptr { 485*0Sstevel@tonic-gate enum rc_ptr_type rlp_type; 486*0Sstevel@tonic-gate uint32_t rlp_id; 487*0Sstevel@tonic-gate void *rlp_ptr; /* repcache_{entity,iter}_t */ 488*0Sstevel@tonic-gate void *rlp_data; /* rc_node, for ENTITY only */ 489*0Sstevel@tonic-gate } request_log_ptr_t; 490*0Sstevel@tonic-gate 491*0Sstevel@tonic-gate #define MAX_PTRS 3 492*0Sstevel@tonic-gate 493*0Sstevel@tonic-gate /* 494*0Sstevel@tonic-gate * rl_start through rl_client cannot move without changing start_log() 495*0Sstevel@tonic-gate */ 496*0Sstevel@tonic-gate typedef struct request_log_entry { 497*0Sstevel@tonic-gate hrtime_t rl_start; 498*0Sstevel@tonic-gate hrtime_t rl_end; 499*0Sstevel@tonic-gate pthread_t rl_tid; 500*0Sstevel@tonic-gate uint32_t rl_clientid; 501*0Sstevel@tonic-gate repcache_client_t *rl_client; 502*0Sstevel@tonic-gate enum rep_protocol_requestid rl_request; 503*0Sstevel@tonic-gate rep_protocol_responseid_t rl_response; 504*0Sstevel@tonic-gate int rl_num_ptrs; 505*0Sstevel@tonic-gate request_log_ptr_t rl_ptrs[MAX_PTRS]; 506*0Sstevel@tonic-gate } request_log_entry_t; 507*0Sstevel@tonic-gate 508*0Sstevel@tonic-gate /* 509*0Sstevel@tonic-gate * thread information 510*0Sstevel@tonic-gate */ 511*0Sstevel@tonic-gate typedef enum thread_state { 512*0Sstevel@tonic-gate TI_CREATED, 513*0Sstevel@tonic-gate TI_DOOR_RETURN, 514*0Sstevel@tonic-gate TI_SIGNAL_WAIT, 515*0Sstevel@tonic-gate TI_MAIN_DOOR_CALL, 516*0Sstevel@tonic-gate TI_CLIENT_CALL 517*0Sstevel@tonic-gate } thread_state_t; 518*0Sstevel@tonic-gate 519*0Sstevel@tonic-gate typedef struct thread_info { 520*0Sstevel@tonic-gate pthread_t ti_thread; 521*0Sstevel@tonic-gate uu_list_node_t ti_node; /* for list of all thread */ 522*0Sstevel@tonic-gate 523*0Sstevel@tonic-gate /* 524*0Sstevel@tonic-gate * per-thread globals 525*0Sstevel@tonic-gate */ 526*0Sstevel@tonic-gate ucred_t *ti_ucred; /* for credential lookups */ 527*0Sstevel@tonic-gate int ti_ucred_read; /* ucred holds current creds */ 528*0Sstevel@tonic-gate 529*0Sstevel@tonic-gate /* 530*0Sstevel@tonic-gate * per-thread state information, for debuggers 531*0Sstevel@tonic-gate */ 532*0Sstevel@tonic-gate hrtime_t ti_lastchange; 533*0Sstevel@tonic-gate 534*0Sstevel@tonic-gate thread_state_t ti_state; 535*0Sstevel@tonic-gate thread_state_t ti_prev_state; 536*0Sstevel@tonic-gate 537*0Sstevel@tonic-gate repcache_client_t *ti_active_client; 538*0Sstevel@tonic-gate request_log_entry_t ti_log; 539*0Sstevel@tonic-gate 540*0Sstevel@tonic-gate struct rep_protocol_request *ti_client_request; 541*0Sstevel@tonic-gate repository_door_request_t *ti_main_door_request; 542*0Sstevel@tonic-gate 543*0Sstevel@tonic-gate } thread_info_t; 544*0Sstevel@tonic-gate 545*0Sstevel@tonic-gate /* 546*0Sstevel@tonic-gate * Backend layer 547*0Sstevel@tonic-gate */ 548*0Sstevel@tonic-gate typedef struct backend_query backend_query_t; 549*0Sstevel@tonic-gate typedef struct backend_tx backend_tx_t; 550*0Sstevel@tonic-gate 551*0Sstevel@tonic-gate /* 552*0Sstevel@tonic-gate * configd.c 553*0Sstevel@tonic-gate */ 554*0Sstevel@tonic-gate int create_connection(ucred_t *cred, repository_door_request_t *rp, 555*0Sstevel@tonic-gate size_t rp_size, int *out_fd); 556*0Sstevel@tonic-gate 557*0Sstevel@tonic-gate thread_info_t *thread_self(void); 558*0Sstevel@tonic-gate void thread_newstate(thread_info_t *, thread_state_t); 559*0Sstevel@tonic-gate ucred_t *get_ucred(void); 560*0Sstevel@tonic-gate int ucred_is_privileged(ucred_t *); 561*0Sstevel@tonic-gate 562*0Sstevel@tonic-gate void configd_critical(const char *, ...); 563*0Sstevel@tonic-gate void configd_vcritical(const char *, va_list); 564*0Sstevel@tonic-gate 565*0Sstevel@tonic-gate extern int is_main_repository; 566*0Sstevel@tonic-gate extern int max_repository_backups; 567*0Sstevel@tonic-gate 568*0Sstevel@tonic-gate /* 569*0Sstevel@tonic-gate * maindoor.c 570*0Sstevel@tonic-gate */ 571*0Sstevel@tonic-gate int setup_main_door(const char *); 572*0Sstevel@tonic-gate 573*0Sstevel@tonic-gate /* 574*0Sstevel@tonic-gate * client.c 575*0Sstevel@tonic-gate */ 576*0Sstevel@tonic-gate int create_client(pid_t, uint32_t, int, int *); 577*0Sstevel@tonic-gate int client_init(void); 578*0Sstevel@tonic-gate int client_is_privileged(void); 579*0Sstevel@tonic-gate void log_enter(request_log_entry_t *); 580*0Sstevel@tonic-gate 581*0Sstevel@tonic-gate /* 582*0Sstevel@tonic-gate * rc_node.c, backend/cache interfaces (rc_node_t) 583*0Sstevel@tonic-gate */ 584*0Sstevel@tonic-gate int rc_node_init(); 585*0Sstevel@tonic-gate int rc_check_type_name(uint32_t, const char *); 586*0Sstevel@tonic-gate 587*0Sstevel@tonic-gate void rc_node_rele(rc_node_t *); 588*0Sstevel@tonic-gate rc_node_t *rc_node_setup(rc_node_t *, rc_node_lookup_t *, 589*0Sstevel@tonic-gate const char *, rc_node_t *); 590*0Sstevel@tonic-gate rc_node_t *rc_node_setup_pg(rc_node_t *, rc_node_lookup_t *, const char *, 591*0Sstevel@tonic-gate const char *, uint32_t, uint32_t, rc_node_t *); 592*0Sstevel@tonic-gate rc_node_t *rc_node_setup_snapshot(rc_node_t *, rc_node_lookup_t *, const char *, 593*0Sstevel@tonic-gate uint32_t, rc_node_t *); 594*0Sstevel@tonic-gate rc_node_t *rc_node_setup_snaplevel(rc_node_t *, rc_node_lookup_t *, 595*0Sstevel@tonic-gate rc_snaplevel_t *, rc_node_t *); 596*0Sstevel@tonic-gate int rc_node_create_property(rc_node_t *, rc_node_lookup_t *, 597*0Sstevel@tonic-gate const char *, rep_protocol_value_type_t, const char *, size_t, size_t); 598*0Sstevel@tonic-gate 599*0Sstevel@tonic-gate rc_node_t *rc_node_alloc(void); 600*0Sstevel@tonic-gate void rc_node_destroy(rc_node_t *); 601*0Sstevel@tonic-gate 602*0Sstevel@tonic-gate /* 603*0Sstevel@tonic-gate * rc_node.c, client interface (rc_node_ptr_t, rc_node_iter_t) 604*0Sstevel@tonic-gate */ 605*0Sstevel@tonic-gate void rc_node_ptr_init(rc_node_ptr_t *); 606*0Sstevel@tonic-gate int rc_local_scope(uint32_t, rc_node_ptr_t *); 607*0Sstevel@tonic-gate 608*0Sstevel@tonic-gate void rc_node_clear(rc_node_ptr_t *, int); 609*0Sstevel@tonic-gate void rc_node_ptr_assign(rc_node_ptr_t *, const rc_node_ptr_t *); 610*0Sstevel@tonic-gate int rc_node_name(rc_node_ptr_t *, char *, size_t, uint32_t, size_t *); 611*0Sstevel@tonic-gate int rc_node_fmri(rc_node_ptr_t *, char *, size_t, size_t *); 612*0Sstevel@tonic-gate int rc_node_parent_type(rc_node_ptr_t *, uint32_t *); 613*0Sstevel@tonic-gate int rc_node_get_child(rc_node_ptr_t *, const char *, uint32_t, rc_node_ptr_t *); 614*0Sstevel@tonic-gate int rc_node_get_parent(rc_node_ptr_t *, uint32_t, rc_node_ptr_t *); 615*0Sstevel@tonic-gate int rc_node_get_property_type(rc_node_ptr_t *, rep_protocol_value_type_t *); 616*0Sstevel@tonic-gate int rc_node_get_property_value(rc_node_ptr_t *, 617*0Sstevel@tonic-gate struct rep_protocol_value_response *, size_t *); 618*0Sstevel@tonic-gate int rc_node_create_child(rc_node_ptr_t *, uint32_t, const char *, 619*0Sstevel@tonic-gate rc_node_ptr_t *); 620*0Sstevel@tonic-gate int rc_node_create_child_pg(rc_node_ptr_t *, uint32_t, const char *, 621*0Sstevel@tonic-gate const char *, uint32_t, rc_node_ptr_t *); 622*0Sstevel@tonic-gate int rc_node_update(rc_node_ptr_t *); 623*0Sstevel@tonic-gate int rc_node_delete(rc_node_ptr_t *); 624*0Sstevel@tonic-gate int rc_node_next_snaplevel(rc_node_ptr_t *, rc_node_ptr_t *); 625*0Sstevel@tonic-gate 626*0Sstevel@tonic-gate int rc_node_setup_iter(rc_node_ptr_t *, rc_node_iter_t **, uint32_t, 627*0Sstevel@tonic-gate size_t, const char *); 628*0Sstevel@tonic-gate 629*0Sstevel@tonic-gate int rc_iter_next(rc_node_iter_t *, rc_node_ptr_t *, uint32_t); 630*0Sstevel@tonic-gate int rc_iter_next_value(rc_node_iter_t *, struct rep_protocol_value_response *, 631*0Sstevel@tonic-gate size_t *, int); 632*0Sstevel@tonic-gate void rc_iter_destroy(rc_node_iter_t **); 633*0Sstevel@tonic-gate 634*0Sstevel@tonic-gate int rc_node_setup_tx(rc_node_ptr_t *, rc_node_ptr_t *); 635*0Sstevel@tonic-gate int rc_tx_commit(rc_node_ptr_t *, const void *, size_t); 636*0Sstevel@tonic-gate 637*0Sstevel@tonic-gate void rc_pg_notify_init(rc_node_pg_notify_t *); 638*0Sstevel@tonic-gate int rc_pg_notify_setup(rc_node_pg_notify_t *, rc_node_ptr_t *, int); 639*0Sstevel@tonic-gate void rc_pg_notify_fini(rc_node_pg_notify_t *); 640*0Sstevel@tonic-gate 641*0Sstevel@tonic-gate void rc_notify_info_init(rc_notify_info_t *); 642*0Sstevel@tonic-gate int rc_notify_info_add_name(rc_notify_info_t *, const char *); 643*0Sstevel@tonic-gate int rc_notify_info_add_type(rc_notify_info_t *, const char *); 644*0Sstevel@tonic-gate int rc_notify_info_wait(rc_notify_info_t *, rc_node_ptr_t *, char *, size_t); 645*0Sstevel@tonic-gate void rc_notify_info_fini(rc_notify_info_t *); 646*0Sstevel@tonic-gate 647*0Sstevel@tonic-gate int rc_snapshot_take_new(rc_node_ptr_t *, const char *, 648*0Sstevel@tonic-gate const char *, const char *, rc_node_ptr_t *); 649*0Sstevel@tonic-gate int rc_snapshot_take_attach(rc_node_ptr_t *, rc_node_ptr_t *); 650*0Sstevel@tonic-gate int rc_snapshot_attach(rc_node_ptr_t *, rc_node_ptr_t *); 651*0Sstevel@tonic-gate 652*0Sstevel@tonic-gate /* 653*0Sstevel@tonic-gate * file_object.c 654*0Sstevel@tonic-gate */ 655*0Sstevel@tonic-gate int object_fill_children(rc_node_t *); 656*0Sstevel@tonic-gate int object_create(rc_node_t *, uint32_t, const char *, rc_node_t **); 657*0Sstevel@tonic-gate int object_create_pg(rc_node_t *, uint32_t, const char *, const char *, 658*0Sstevel@tonic-gate uint32_t, rc_node_t **); 659*0Sstevel@tonic-gate 660*0Sstevel@tonic-gate int object_delete(rc_node_t *); 661*0Sstevel@tonic-gate void object_free_values(const char *, uint32_t, size_t, size_t); 662*0Sstevel@tonic-gate 663*0Sstevel@tonic-gate int object_fill_snapshot(rc_snapshot_t *sp); 664*0Sstevel@tonic-gate 665*0Sstevel@tonic-gate int object_snapshot_take_new(rc_node_t *, const char *, const char *, 666*0Sstevel@tonic-gate const char *, rc_node_t **); 667*0Sstevel@tonic-gate int object_snapshot_attach(rc_node_lookup_t *, uint32_t *, int); 668*0Sstevel@tonic-gate 669*0Sstevel@tonic-gate /* 670*0Sstevel@tonic-gate * object.c 671*0Sstevel@tonic-gate */ 672*0Sstevel@tonic-gate int object_tx_commit(rc_node_lookup_t *, const void *, size_t, uint32_t *); 673*0Sstevel@tonic-gate 674*0Sstevel@tonic-gate /* 675*0Sstevel@tonic-gate * snapshot.c 676*0Sstevel@tonic-gate */ 677*0Sstevel@tonic-gate int rc_snapshot_get(uint32_t, rc_snapshot_t **); 678*0Sstevel@tonic-gate void rc_snapshot_rele(rc_snapshot_t *); 679*0Sstevel@tonic-gate void rc_snaplevel_hold(rc_snaplevel_t *); 680*0Sstevel@tonic-gate void rc_snaplevel_rele(rc_snaplevel_t *); 681*0Sstevel@tonic-gate 682*0Sstevel@tonic-gate /* 683*0Sstevel@tonic-gate * backend.c 684*0Sstevel@tonic-gate */ 685*0Sstevel@tonic-gate int backend_init(const char *, const char *, int); 686*0Sstevel@tonic-gate void backend_fini(void); 687*0Sstevel@tonic-gate 688*0Sstevel@tonic-gate rep_protocol_responseid_t backend_create_backup(const char *); 689*0Sstevel@tonic-gate 690*0Sstevel@tonic-gate /* 691*0Sstevel@tonic-gate * call on any database inconsistency -- cleans up state as best it can, 692*0Sstevel@tonic-gate * and exits with a "Database Bad" error code. 693*0Sstevel@tonic-gate */ 694*0Sstevel@tonic-gate void backend_panic(const char *, ...); 695*0Sstevel@tonic-gate #pragma rarely_called(backend_panic) 696*0Sstevel@tonic-gate 697*0Sstevel@tonic-gate backend_query_t *backend_query_alloc(void); 698*0Sstevel@tonic-gate void backend_query_append(backend_query_t *, const char *); 699*0Sstevel@tonic-gate void backend_query_add(backend_query_t *, const char *, ...); 700*0Sstevel@tonic-gate void backend_query_free(backend_query_t *); 701*0Sstevel@tonic-gate 702*0Sstevel@tonic-gate typedef int backend_run_callback_f(void *data, int columns, char **vals, 703*0Sstevel@tonic-gate char **names); 704*0Sstevel@tonic-gate #define BACKEND_CALLBACK_CONTINUE 0 705*0Sstevel@tonic-gate #define BACKEND_CALLBACK_ABORT 1 706*0Sstevel@tonic-gate 707*0Sstevel@tonic-gate backend_run_callback_f backend_fail_if_seen; /* aborts TX if called */ 708*0Sstevel@tonic-gate 709*0Sstevel@tonic-gate int backend_run(backend_type_t, backend_query_t *, 710*0Sstevel@tonic-gate backend_run_callback_f *, void *); 711*0Sstevel@tonic-gate 712*0Sstevel@tonic-gate int backend_tx_begin(backend_type_t, backend_tx_t **); 713*0Sstevel@tonic-gate int backend_tx_begin_ro(backend_type_t, backend_tx_t **); 714*0Sstevel@tonic-gate void backend_tx_end_ro(backend_tx_t *); 715*0Sstevel@tonic-gate 716*0Sstevel@tonic-gate enum id_space { 717*0Sstevel@tonic-gate BACKEND_ID_SERVICE_INSTANCE, 718*0Sstevel@tonic-gate BACKEND_ID_PROPERTYGRP, 719*0Sstevel@tonic-gate BACKEND_ID_GENERATION, 720*0Sstevel@tonic-gate BACKEND_ID_PROPERTY, 721*0Sstevel@tonic-gate BACKEND_ID_VALUE, 722*0Sstevel@tonic-gate BACKEND_ID_SNAPNAME, 723*0Sstevel@tonic-gate BACKEND_ID_SNAPSHOT, 724*0Sstevel@tonic-gate BACKEND_ID_SNAPLEVEL, 725*0Sstevel@tonic-gate BACKEND_ID_INVALID /* always illegal */ 726*0Sstevel@tonic-gate }; 727*0Sstevel@tonic-gate 728*0Sstevel@tonic-gate uint32_t backend_new_id(backend_tx_t *, enum id_space); 729*0Sstevel@tonic-gate int backend_tx_run_update(backend_tx_t *, const char *, ...); 730*0Sstevel@tonic-gate int backend_tx_run_update_changed(backend_tx_t *, const char *, ...); 731*0Sstevel@tonic-gate int backend_tx_run_single_int(backend_tx_t *tx, backend_query_t *q, 732*0Sstevel@tonic-gate uint32_t *buf); 733*0Sstevel@tonic-gate int backend_tx_run(backend_tx_t *, backend_query_t *, 734*0Sstevel@tonic-gate backend_run_callback_f *, void *); 735*0Sstevel@tonic-gate 736*0Sstevel@tonic-gate int backend_tx_commit(backend_tx_t *); 737*0Sstevel@tonic-gate void backend_tx_rollback(backend_tx_t *); 738*0Sstevel@tonic-gate 739*0Sstevel@tonic-gate #ifdef __cplusplus 740*0Sstevel@tonic-gate } 741*0Sstevel@tonic-gate #endif 742*0Sstevel@tonic-gate 743*0Sstevel@tonic-gate #endif /* _CONFIGD_H */ 744