Lines Matching defs:handle

157 	scf_handle_t		*handle;
183 * Must be called when done. Called with the handle allocated in
188 sa_upgrade_scf_fini(scfutilhandle_t *handle)
192 if (handle != NULL) {
193 if (handle->scope != NULL) {
195 scf_scope_destroy(handle->scope);
197 if (handle->instance != NULL)
198 scf_instance_destroy(handle->instance);
199 if (handle->service != NULL)
200 scf_service_destroy(handle->service);
201 if (handle->pg != NULL)
202 scf_pg_destroy(handle->pg);
203 if (handle->handle != NULL) {
204 handle->scf_state = SCH_STATE_UNINIT;
206 (void) scf_handle_unbind(handle->handle);
207 scf_handle_destroy(handle->handle);
209 free(handle);
217 * returns handle to SCF database.
222 scfutilhandle_t *handle;
228 handle = calloc(1, sizeof (scfutilhandle_t));
229 if (handle == NULL)
230 return (handle);
232 handle->scf_state = SCH_STATE_INITIALIZING;
233 handle->handle = scf_handle_create(SCF_VERSION);
234 if (handle->handle == NULL) {
235 free(handle);
236 handle = NULL;
240 return (handle);
242 if (scf_handle_bind(handle->handle) != 0)
245 handle->scope = scf_scope_create(handle->handle);
246 handle->service = scf_service_create(handle->handle);
247 handle->pg = scf_pg_create(handle->handle);
249 handle->instance = scf_instance_create(handle->handle);
250 if (handle->scope == NULL || handle->service == NULL ||
251 handle->pg == NULL || handle->instance == NULL)
253 if (scf_handle_get_scope(handle->handle,
254 SCF_SCOPE_LOCAL, handle->scope) != 0)
256 if (scf_scope_get_service(handle->scope,
257 SA_GROUP_SVC_NAME, handle->service) != 0)
260 handle->scf_state = SCH_STATE_INIT;
262 return (handle);
265 (void) sa_upgrade_scf_fini(handle);
507 sa_upgrade_extract_share_prop(nvlist_t *group, scfutilhandle_t *handle,
582 iter = scf_iter_create(handle->handle);
583 value = scf_value_create(handle->handle);
584 prop = scf_property_create(handle->handle);
645 sa_upgrade_extract_share(nvlist_t *group, scfutilhandle_t *handle,
671 iter = scf_iter_create(handle->handle);
672 value = scf_value_create(handle->handle);
673 prop = scf_property_create(handle->handle);
719 viter = scf_iter_create(handle->handle);
786 sa_upgrade_extract_group_prop(nvlist_t *group, scfutilhandle_t *handle,
805 iter = scf_iter_create(handle->handle);
806 value = scf_value_create(handle->handle);
807 prop = scf_property_create(handle->handle);
890 sa_upgrade_extract_group(nvlist_t *glist, scfutilhandle_t *handle,
906 iter = scf_iter_create(handle->handle);
936 while (scf_iter_next_pg(iter, handle->pg) > 0) {
937 err = scf_pg_get_name(handle->pg, buff,
943 ret = sa_upgrade_extract_share(group, handle,
944 handle->pg, buff);
960 handle, handle->pg, proto, sectype);
990 while (scf_iter_next_pg(iter, handle->pg) > 0) {
991 err = scf_pg_get_name(handle->pg, buff,
998 group, handle, handle->pg, buff);
1061 sa_upgrade_get_config(scfutilhandle_t *handle, nvlist_t *root, char *gname,
1068 instance = scf_instance_create(handle->handle);
1069 if (scf_service_get_instance(handle->service, gname,
1088 ret = sa_upgrade_extract_group(glist, handle, instance);
1109 sa_upgrade_delete_config(scfutilhandle_t *handle, char *gname,
1115 instance = scf_instance_create(handle->handle);
1116 if (scf_service_get_instance(handle->service, gname,
1621 scfutilhandle_t *handle;
1625 handle = sa_upgrade_scf_init();
1626 if ((gname == NULL) || (handle == NULL))
1630 ret = sa_upgrade_delete_config(handle, gname, force_upgrade);
1631 sa_upgrade_scf_fini(handle);
1637 sa_upgrade_scf_fini(handle);
1641 ret = sa_upgrade_get_config(handle, old_nvl, gname, force_upgrade);
1644 sa_upgrade_scf_fini(handle);
1652 sa_upgrade_scf_fini(handle);
1660 sa_upgrade_scf_fini(handle);
1669 sa_upgrade_scf_fini(handle);
1674 ret = sa_upgrade_delete_config(handle, gname, force_upgrade);
1675 sa_upgrade_scf_fini(handle);