Lines Matching defs:res

289  *   res is a pointer to the scf_resources_t to be released.
292 release_scf_resources(scf_resources_t *res)
294 scf_entry_destroy(res->sr_ent);
295 scf_transaction_destroy(res->sr_tx);
296 scf_value_destroy(res->sr_val);
297 scf_property_destroy(res->sr_prop);
298 scf_pg_destroy(res->sr_pg);
299 scf_snapshot_destroy(res->sr_snap);
300 scf_instance_destroy(res->sr_inst);
301 (void) scf_handle_unbind(res->sr_handle);
302 scf_handle_destroy(res->sr_handle);
309 * res is a pointer to an scf_resources_t. This is an internal
315 * resources that may have been assigned to res are released, so
323 create_scf_resources(const char *fmri, scf_resources_t *res)
325 res->sr_tx = NULL;
326 res->sr_ent = NULL;
327 res->sr_inst = NULL;
328 res->sr_snap = NULL;
329 res->sr_pg = NULL;
330 res->sr_prop = NULL;
331 res->sr_val = NULL;
333 if ((res->sr_handle = scf_handle_create(SCF_VERSION)) == NULL) {
337 if (scf_handle_bind(res->sr_handle) != 0) {
338 scf_handle_destroy(res->sr_handle);
341 if ((res->sr_inst = scf_instance_create(res->sr_handle)) == NULL) {
344 if (scf_handle_decode_fmri(res->sr_handle, fmri, NULL, NULL,
345 res->sr_inst, NULL, NULL, SCF_DECODE_FMRI_REQUIRE_INSTANCE) != 0) {
348 if ((res->sr_snap = scf_snapshot_create(res->sr_handle)) == NULL) {
351 if (scf_instance_get_snapshot(res->sr_inst, "running",
352 res->sr_snap) != 0) {
355 if ((res->sr_pg = scf_pg_create(res->sr_handle)) == NULL) {
358 if ((res->sr_prop = scf_property_create(res->sr_handle)) == NULL) {
361 if ((res->sr_val = scf_value_create(res->sr_handle)) == NULL) {
364 if ((res->sr_tx = scf_transaction_create(res->sr_handle)) == NULL) {
367 if ((res->sr_ent = scf_entry_create(res->sr_handle)) == NULL) {
375 release_scf_resources(res);
386 * res is a pointer to an scf_resources_t. This is an internal
392 * resources that may have been assigned to res are released, so
400 boolean_t running, scf_resources_t *res)
402 if (create_scf_resources(fmri, res) != 0)
405 if (scf_instance_get_pg_composed(res->sr_inst,
406 running ? res->sr_snap : NULL, pg, res->sr_pg) != 0) {
409 if (scf_pg_get_property(res->sr_pg, prop, res->sr_prop) != 0) {
412 if (scf_property_get_value(res->sr_prop, res->sr_val) != 0) {
418 release_scf_resources(res);
441 scf_resources_t res;
444 if (get_property_value(lfmri, lpg, lprop, B_TRUE, &res) != 0) {
448 * and it released any resources assigned to res before
453 if (scf_value_get_boolean(res.sr_val, &prop_val) != 0) {
459 release_scf_resources(&res);
484 scf_resources_t res;
486 if (get_property_value(lfmri, lpg, lprop, B_TRUE, &res) != 0) {
492 if (get_property_value(lfmri, lpg, lprop, B_FALSE, &res) != 0) {
495 * and it released any resources assigned to res before
501 if (scf_value_get_astring(res.sr_val, buf, bufsz) == 0)
506 release_scf_resources(&res);
529 scf_resources_t res;
531 if (get_property_value(lfmri, lpg, lprop, B_TRUE, &res) != 0) {
535 * and it released any resources assigned to res before
540 if (scf_value_get_count(res.sr_val, answer) != 0) {
545 release_scf_resources(&res);
550 set_property_value(scf_resources_t *res, const char *propname,
557 new = (scf_pg_get_property(res->sr_pg, propname, res->sr_prop) != 0);
559 if (scf_transaction_start(res->sr_tx, res->sr_pg) == -1) {
563 if (scf_transaction_property_new(res->sr_tx, res->sr_ent,
568 if (scf_transaction_property_change(res->sr_tx, res->sr_ent,
574 if (scf_entry_add_value(res->sr_ent, res->sr_val) != 0) {
578 result = scf_transaction_commit(res->sr_tx);
580 scf_transaction_reset(res->sr_tx);
581 if (scf_pg_update(res->sr_pg) == -1) {
600 scf_resources_t res;
602 if (create_scf_resources(fmri, &res) != 0)
605 if (scf_instance_add_pg(res.sr_inst, pg, SCF_GROUP_APPLICATION,
606 SCF_PG_FLAG_NONPERSISTENT, res.sr_pg) != 0) {
609 if (scf_instance_get_pg_composed(res.sr_inst, NULL, pg,
610 res.sr_pg) != 0)
614 scf_value_set_count(res.sr_val, (uint64_t)count);
616 if (set_property_value(&res, prop, SCF_TYPE_COUNT) != 0)
619 release_scf_resources(&res);
625 release_scf_resources(&res);
633 scf_resources_t res;
635 if (create_scf_resources(fmri, &res) != 0)
638 if (scf_instance_add_pg(res.sr_inst, pg, SCF_GROUP_APPLICATION,
639 SCF_PG_FLAG_NONPERSISTENT, res.sr_pg) != 0) {
642 if (scf_instance_get_pg_composed(res.sr_inst, NULL, pg,
643 res.sr_pg) != 0)
647 if (scf_value_set_astring(res.sr_val, str) != 0)
650 if (set_property_value(&res, prop, SCF_TYPE_ASTRING) != 0)
653 release_scf_resources(&res);
659 release_scf_resources(&res);
670 scf_resources_t res;
673 if (create_scf_resources(fmri, &res) != 0)
676 if (scf_instance_add_pg(res.sr_inst, pg, SCF_GROUP_APPLICATION,
677 SCF_PG_FLAG_NONPERSISTENT, res.sr_pg) != 0) {
680 if (scf_instance_get_pg_composed(res.sr_inst, NULL, pg,
681 res.sr_pg) != 0)
685 if (scf_pg_get_property(res.sr_pg, prop, res.sr_prop) != 0)
688 if (scf_transaction_start(res.sr_tx, res.sr_pg) == -1)
691 if (scf_transaction_property_delete(res.sr_tx, res.sr_ent, prop) == -1)
694 result = scf_transaction_commit(res.sr_tx);
696 scf_transaction_reset(res.sr_tx);
697 if (scf_pg_update(res.sr_pg) == -1)
704 release_scf_resources(&res);
707 release_scf_resources(&res);