Lines Matching defs:node

55  * topology node.
67 * node may use topo_prop_getall(). This routine returns a nested nvlist
76 pgroup_get(tnode_t *node, const char *pgname)
82 for (pg = topo_list_next(&node->tn_pgroups); pg != NULL;
120 prop_method_get(tnode_t *node, topo_propval_t *pv, topo_propmethod_t *pm,
139 * Grab a reference to the property and then unlock the node. This will
142 * values on the same node w\o causing a deadlock.
145 topo_node_unlock(node);
146 if (topo_method_call(node, pm->tpm_name, pm->tpm_version,
148 topo_node_lock(node);
152 topo_node_lock(node);
174 prop_get(tnode_t *node, const char *pgname, const char *pname, nvlist_t *pargs,
179 if ((pv = propval_get(pgroup_get(node, pgname), pname)) == NULL) {
188 if (prop_method_get(node, pv, pv->tp_method, pargs, err) < 0)
196 get_properror(tnode_t *node, int *errp, int err)
198 topo_node_unlock(node);
204 prop_getval(tnode_t *node, const char *pgname, const char *pname, void *val,
208 topo_hdl_t *thp = node->tn_hdl;
211 topo_node_lock(node);
212 if ((pv = prop_get(node, pgname, pname, NULL, err))
214 return (get_properror(node, err, *err));
217 return (get_properror(node, err, ETOPO_PROP_TYPE));
382 return (get_properror(node, err, ETOPO_PROP_NOENT));
384 return (get_properror(node, err, ETOPO_PROP_NVL));
386 return (get_properror(node, err, ret));
388 topo_node_unlock(node);
393 topo_prop_get_int32(tnode_t *node, const char *pgname, const char *pname,
396 return (prop_getval(node, pgname, pname, (void *)val, TOPO_TYPE_INT32,
401 topo_prop_get_uint32(tnode_t *node, const char *pgname, const char *pname,
404 return (prop_getval(node, pgname, pname, (void *)val, TOPO_TYPE_UINT32,
409 topo_prop_get_int64(tnode_t *node, const char *pgname, const char *pname,
412 return (prop_getval(node, pgname, pname, (void *)val, TOPO_TYPE_INT64,
417 topo_prop_get_uint64(tnode_t *node, const char *pgname, const char *pname,
420 return (prop_getval(node, pgname, pname, (void *)val, TOPO_TYPE_UINT64,
425 topo_prop_get_double(tnode_t *node, const char *pgname, const char *pname,
428 return (prop_getval(node, pgname, pname, (void *)val, TOPO_TYPE_DOUBLE,
433 topo_prop_get_string(tnode_t *node, const char *pgname, const char *pname,
436 return (prop_getval(node, pgname, pname, (void *)val, TOPO_TYPE_STRING,
441 topo_prop_get_fmri(tnode_t *node, const char *pgname, const char *pname,
444 return (prop_getval(node, pgname, pname, (void *)val, TOPO_TYPE_FMRI,
449 topo_prop_get_int32_array(tnode_t *node, const char *pgname, const char *pname,
452 return (prop_getval(node, pgname, pname, (void *)val,
457 topo_prop_get_uint32_array(tnode_t *node, const char *pgname, const char *pname,
460 return (prop_getval(node, pgname, pname, (void *)val,
465 topo_prop_get_int64_array(tnode_t *node, const char *pgname, const char *pname,
468 return (prop_getval(node, pgname, pname, (void *)val,
473 topo_prop_get_uint64_array(tnode_t *node, const char *pgname, const char *pname,
476 return (prop_getval(node, pgname, pname, (void *)val,
481 topo_prop_get_string_array(tnode_t *node, const char *pgname, const char *pname,
484 return (prop_getval(node, pgname, pname, (void *)val,
489 topo_prop_get_fmri_array(tnode_t *node, const char *pgname, const char *pname,
492 return (prop_getval(node, pgname, pname, (void *)val,
497 set_seterror(tnode_t *node, topo_proplist_t *pvl, int *errp, int err)
499 topo_hdl_t *thp = node->tn_hdl;
508 topo_node_unlock(node);
515 prop_create(tnode_t *node, const char *pgname, const char *pname,
518 topo_hdl_t *thp = node->tn_hdl;
526 if ((pg = pgroup_get(node, pgname)) == NULL) {
527 topo_node_unlock(node);
534 return (set_seterror(node, NULL, err, ETOPO_PROP_TYPE));
536 return (set_seterror(node, NULL, err, ETOPO_PROP_DEFD));
543 return (set_seterror(node, NULL, err, ETOPO_NOMEM));
547 return (set_seterror(node, pvl, err, ETOPO_NOMEM));
554 return (set_seterror(node, pvl, err, ETOPO_NOMEM));
565 topo_prop_set(tnode_t *node, const char *pgname, const char *pname,
569 topo_hdl_t *thp = node->tn_hdl;
648 if (topo_prop_setprop(node, pgname, nvl, flag, nvl, err) != 0) {
657 topo_prop_set_int32(tnode_t *node, const char *pgname, const char *pname,
660 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_INT32, flag,
665 topo_prop_set_uint32(tnode_t *node, const char *pgname, const char *pname,
668 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_UINT32, flag,
673 topo_prop_set_int64(tnode_t *node, const char *pgname, const char *pname,
676 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_INT64, flag,
681 topo_prop_set_uint64(tnode_t *node, const char *pgname, const char *pname,
684 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_UINT64, flag,
689 topo_prop_set_double(tnode_t *node, const char *pgname, const char *pname,
692 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_DOUBLE, flag,
697 topo_prop_set_string(tnode_t *node, const char *pgname, const char *pname,
700 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_STRING, flag,
705 topo_prop_set_fmri(tnode_t *node, const char *pgname, const char *pname,
708 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_FMRI, flag,
713 topo_prop_set_int32_array(tnode_t *node, const char *pgname, const char *pname,
716 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_INT32_ARRAY, flag,
721 topo_prop_set_uint32_array(tnode_t *node, const char *pgname, const char *pname,
724 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_UINT32_ARRAY, flag,
729 topo_prop_set_int64_array(tnode_t *node, const char *pgname, const char *pname,
732 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_INT64_ARRAY, flag,
737 topo_prop_set_uint64_array(tnode_t *node, const char *pgname, const char *pname,
740 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_UINT64_ARRAY, flag,
745 topo_prop_set_string_array(tnode_t *node, const char *pgname, const char *pname,
748 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_STRING_ARRAY, flag,
753 topo_prop_set_fmri_array(tnode_t *node, const char *pgname, const char *pname,
756 return (topo_prop_set(node, pgname, pname, TOPO_TYPE_FMRI_ARRAY, flag,
764 topo_prop_setprop(tnode_t *node, const char *pgname, nvlist_t *prop,
768 topo_hdl_t *thp = node->tn_hdl;
784 topo_node_lock(node);
785 if ((pv = prop_create(node, pgname, name, type, flag, err)) == NULL)
796 topo_node_unlock(node);
805 topo_node_unlock(node);
813 * Grab a reference to the property and then unlock the node.
816 * to access other property values on the same node w\o causing
825 topo_node_unlock(node);
826 ret = topo_method_call(node, pm->tpm_name, pm->tpm_version,
828 topo_node_lock(node);
838 topo_node_unlock(node);
843 topo_node_unlock(node);
848 register_methoderror(tnode_t *node, topo_propmethod_t *pm, int *errp, int l,
851 topo_hdl_t *thp = node->tn_hdl;
863 topo_node_unlock(node);
869 prop_method_register(tnode_t *node, const char *pgname, const char *pname,
873 topo_hdl_t *thp = node->tn_hdl;
878 return (register_methoderror(node, pm, err, 1,
882 return (register_methoderror(node, pm, err, 1,
888 return (register_methoderror(node, pm, err, 1,
906 if ((pv = propval_get(pgroup_get(node, pgname), pname)) == NULL)
907 if ((pv = prop_create(node, pgname, pname, ptype,
909 /* node unlocked */
910 return (register_methoderror(node, pm, err, 0, *err));
914 return (register_methoderror(node, pm, err, 1,
923 topo_node_unlock(node);
929 topo_prop_method_register(tnode_t *node, const char *pgname, const char *pname,
934 topo_node_lock(node);
936 if ((mp = topo_method_lookup(node, mname)) == NULL)
937 return (register_methoderror(node, NULL, err, 1,
938 ETOPO_METHOD_NOTSUP)); /* node unlocked */
940 topo_node_lock(node);
942 return (prop_method_register(node, pgname, pname, ptype, mname,
943 mp->tim_version, args, err)); /* err set and node unlocked */
947 topo_prop_method_version_register(tnode_t *node, const char *pgname,
953 topo_node_lock(node);
955 if ((mp = topo_method_lookup(node, mname)) == NULL)
956 return (register_methoderror(node, NULL, err, 1,
957 ETOPO_METHOD_NOTSUP)); /* node unlocked */
959 topo_node_lock(node);
962 return (register_methoderror(node, NULL, err, 1,
965 return (register_methoderror(node, NULL, err, 1,
968 return (prop_method_register(node, pgname, pname, ptype, mname,
969 version, args, err)); /* err set and node unlocked */
973 topo_prop_method_unregister(tnode_t *node, const char *pgname,
979 topo_hdl_t *thp = node->tn_hdl;
981 topo_node_lock(node);
983 for (pg = topo_list_next(&node->tn_pgroups); pg != NULL;
991 topo_node_unlock(node);
1007 topo_node_unlock(node);
1011 topo_prop_setmutable(tnode_t *node, const char *pgname, const char *pname,
1016 topo_node_lock(node);
1017 if ((pv = propval_get(pgroup_get(node, pgname), pname)) == NULL) {
1018 topo_node_unlock(node);
1028 topo_node_unlock(node);
1034 topo_node_unlock(node);
1039 topo_prop_setnonvolatile(tnode_t *node, const char *pgname, const char *pname,
1044 topo_node_lock(node);
1045 if ((pv = propval_get(pgroup_get(node, pgname), pname)) == NULL) {
1046 topo_node_unlock(node);
1053 topo_node_unlock(node);
1059 inherit_seterror(tnode_t *node, int *errp, int err)
1061 topo_node_unlock(node);
1062 topo_node_unlock(node->tn_parent);
1070 topo_prop_inherit(tnode_t *node, const char *pgname, const char *name, int *err)
1072 topo_hdl_t *thp = node->tn_hdl;
1073 tnode_t *pnode = node->tn_parent;
1079 topo_node_lock(node);
1083 * on the node.
1085 if (propval_get(pgroup_get(node, pgname), name) != NULL)
1086 return (inherit_seterror(node, err, ETOPO_PROP_DEFD));
1090 * parent node
1093 return (inherit_seterror(node, err, ETOPO_PROP_NOENT));
1099 return (inherit_seterror(node, err, ETOPO_PROP_NOINHERIT));
1103 * propval and add it to the node's property group
1105 if ((pg = pgroup_get(node, pgname)) == NULL)
1106 return (inherit_seterror(node, err, ETOPO_PROP_NOENT));
1110 return (inherit_seterror(node, err, ETOPO_NOMEM));
1116 topo_node_unlock(node);
1123 topo_pgroup_info(tnode_t *node, const char *pgname, int *err)
1125 topo_hdl_t *thp = node->tn_hdl;
1130 topo_node_lock(node);
1131 for (pg = topo_list_next(&node->tn_pgroups); pg != NULL;
1144 topo_node_unlock(node);
1150 topo_node_unlock(node);
1156 topo_node_unlock(node);
1161 pgroup_seterr(tnode_t *node, topo_pgroup_t *pg, topo_ipgroup_info_t *pip,
1164 topo_hdl_t *thp = node->tn_hdl;
1175 topo_node_unlock(node);
1181 topo_pgroup_create(tnode_t *node, const topo_pgroup_info_t *pinfo, int *err)
1185 topo_hdl_t *thp = node->tn_hdl;
1189 topo_node_lock(node);
1193 for (pg = topo_list_next(&node->tn_pgroups); pg != NULL;
1197 topo_node_unlock(node);
1204 topo_node_unlock(node);
1210 return (pgroup_seterr(node, pg, pip, err));
1214 return (pgroup_seterr(node, pg, pip, err));
1222 topo_list_append(&node->tn_pgroups, pg);
1223 topo_node_unlock(node);
1229 topo_pgroup_destroy(tnode_t *node, const char *pname)
1231 topo_hdl_t *thp = node->tn_hdl;
1236 topo_node_lock(node);
1237 for (pg = topo_list_next(&node->tn_pgroups); pg != NULL;
1245 topo_node_unlock(node);
1255 topo_list_delete(&node->tn_pgroups, pg);
1256 topo_node_unlock(node);
1269 topo_pgroup_destroy_all(tnode_t *node)
1271 topo_hdl_t *thp = node->tn_hdl;
1276 topo_node_lock(node);
1277 while ((pg = topo_list_next(&node->tn_pgroups)) != NULL) {
1284 topo_list_delete(&node->tn_pgroups, pg);
1295 topo_node_unlock(node);
1355 topo_prop_getprop(tnode_t *node, const char *pgname, const char *pname,
1358 topo_hdl_t *thp = node->tn_hdl;
1361 topo_node_lock(node);
1362 if ((pv = prop_get(node, pgname, pname, args, err)) == NULL) {
1363 (void) get_properror(node, err, *err);
1368 (void) get_properror(node, err, ETOPO_NOMEM);
1371 topo_node_unlock(node);
1377 prop_val_add(tnode_t *node, nvlist_t **nvl, topo_propval_t *pv, int *err)
1380 if (prop_method_get(node, pv, pv->tp_method, NULL, err) < 0)
1397 get_pgrp_seterror(tnode_t *node, nvlist_t *nvl, int *errp, int err)
1399 topo_node_unlock(node);
1409 topo_prop_getpgrp(tnode_t *node, const char *pgname, nvlist_t **pgrp,
1413 topo_hdl_t *thp = node->tn_hdl;
1424 topo_node_lock(node);
1425 for (pg = topo_list_next(&node->tn_pgroups); pg != NULL;
1439 return (get_pgrp_seterror(node, nvl, err,
1446 if (prop_val_add(node, &pvnvl, pv, err) < 0) {
1447 return (get_pgrp_seterror(node, nvl, err,
1453 return (get_pgrp_seterror(node, nvl, err, ret));
1458 topo_node_unlock(node);
1463 topo_node_unlock(node);
1469 get_all_seterror(tnode_t *node, nvlist_t *nvl, int *errp, int err)
1471 topo_node_unlock(node);
1481 topo_prop_getprops(tnode_t *node, int *err)
1484 topo_hdl_t *thp = node->tn_hdl;
1490 topo_node_lock(node);
1492 return (get_all_seterror(node, NULL, err, ETOPO_NOMEM));
1495 for (pg = topo_list_next(&node->tn_pgroups); pg != NULL;
1498 return (get_all_seterror(node, nvl, err, ETOPO_NOMEM));
1508 return (get_all_seterror(node, nvl, err,
1515 if (prop_val_add(node, &pvnvl, pv, err) < 0) {
1517 return (get_all_seterror(node, nvl, err, *err));
1523 return (get_all_seterror(node, nvl, err, ret));
1531 return (get_all_seterror(node, nvl, err, ret));
1537 topo_node_unlock(node);