Lines Matching refs:thp

71 set_error(topo_hdl_t *thp, int err, int *errp, char *method, nvlist_t *nvlp)
76 topo_dprintf(thp, TOPO_DBG_ERR, "%s: method=%s failed: %s\n",
85 set_nverror(topo_hdl_t *thp, int err, int *errp, char *method, nvlist_t *nvlp)
90 topo_dprintf(thp, TOPO_DBG_ERR, "%s: method=%s failed: %s\n",
98 topo_fmri_nvl2str(topo_hdl_t *thp, nvlist_t *fmri, char **fmristr, int *err)
105 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
108 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
109 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
114 return (set_error(thp, *err, err, TOPO_METH_NVL2STR, out));
117 return (set_error(thp, ETOPO_METHOD_INVAL, err,
120 if ((*fmristr = topo_hdl_strdup(thp, str)) == NULL)
121 return (set_error(thp, ETOPO_NOMEM, err,
130 topo_fmri_str2nvl(topo_hdl_t *thp, const char *fmristr, nvlist_t **fmri,
139 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
144 if ((rnode = topo_hdl_root(thp, buf)) == NULL)
145 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
148 if (topo_hdl_nvalloc(thp, &in, NV_UNIQUE_NAME) != 0)
149 return (set_error(thp, ETOPO_FMRI_NVL, err, TOPO_METH_STR2NVL,
153 return (set_error(thp, ETOPO_FMRI_NVL, err, TOPO_METH_STR2NVL,
158 topo_dprintf(thp, TOPO_DBG_ERR, "%s: TOPO_METH_STR2NVL "
160 return (set_error(thp, *err, err, TOPO_METH_STR2NVL, in));
166 topo_hdl_nvdup(thp, out, fmri) != 0)
167 return (set_error(thp, ETOPO_FMRI_NVL, err,
176 topo_fmri_present(topo_hdl_t *thp, nvlist_t *fmri, int *err)
184 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
187 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
188 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
193 (void) set_error(thp, *err, err, TOPO_METH_PRESENT, out);
204 topo_fmri_presence_state(topo_hdl_t *thp, nvlist_t *fmri, int *err)
212 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
215 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
216 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
221 return (set_error(thp, *err, err, TOPO_METH_PRESENCE_STATE,
232 topo_fmri_contains(topo_hdl_t *thp, nvlist_t *fmri, nvlist_t *subfmri, int *err)
240 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
243 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
244 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
247 if (topo_hdl_nvalloc(thp, &in, NV_UNIQUE_NAME) != 0)
248 return (set_error(thp, ETOPO_FMRI_NVL, err, TOPO_METH_CONTAINS,
253 return (set_error(thp, ETOPO_FMRI_NVL, err, TOPO_METH_CONTAINS,
258 return (set_error(thp, *err, err, TOPO_METH_CONTAINS, in));
268 topo_fmri_unusable(topo_hdl_t *thp, nvlist_t *fmri, int *err)
276 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
279 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
280 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
285 return (set_error(thp, *err, err, TOPO_METH_UNUSABLE, out));
294 topo_fmri_retire(topo_hdl_t *thp, nvlist_t *fmri, int *err)
302 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
305 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
306 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
311 return (set_error(thp, *err, err, TOPO_METH_RETIRE, out));
314 return (set_error(thp, ETOPO_METHOD_FAIL, err,
322 topo_fmri_unretire(topo_hdl_t *thp, nvlist_t *fmri, int *err)
330 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
333 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
334 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
339 return (set_error(thp, *err, err, TOPO_METH_UNRETIRE, out));
343 return (set_error(thp, ETOPO_METHOD_FAIL, err,
352 topo_fmri_service_state(topo_hdl_t *thp, nvlist_t *fmri, int *err)
360 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
363 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
364 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
369 return (set_error(thp, *err, err, TOPO_METH_SERVICE_STATE,
380 topo_fmri_expand(topo_hdl_t *thp, nvlist_t *fmri, int *err)
387 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
390 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
391 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
396 return (set_error(thp, *err, err, TOPO_METH_EXPAND, out));
402 fmri_prop(topo_hdl_t *thp, nvlist_t *rsrc, const char *pgname,
412 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
415 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
416 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
419 if (topo_hdl_nvalloc(thp, &in, NV_UNIQUE_NAME) != 0)
420 return (set_error(thp, ETOPO_FMRI_NVL, err,
429 return (set_error(thp, ETOPO_FMRI_NVL, err,
442 return (set_error(thp, ETOPO_PROP_NOENT, err,
448 topo_fmri_asru(topo_hdl_t *thp, nvlist_t *nvl, nvlist_t **asru, int *err)
452 if (fmri_prop(thp, nvl, TOPO_PGROUP_PROTOCOL, TOPO_PROP_ASRU,
454 return (set_error(thp, *err, err, "topo_fmri_asru", NULL));
457 return (set_error(thp, ETOPO_PROP_NVL, err, "topo_fmri_asru",
460 if (topo_hdl_nvdup(thp, ap, asru) < 0)
461 return (set_error(thp, ETOPO_PROP_NOMEM, err, "topo_fmri_asru",
470 topo_fmri_fru(topo_hdl_t *thp, nvlist_t *nvl, nvlist_t **fru, int *err)
474 if (fmri_prop(thp, nvl, TOPO_PGROUP_PROTOCOL, TOPO_PROP_FRU,
476 return (set_error(thp, *err, err, "topo_fmri_fru", NULL));
479 return (set_error(thp, ETOPO_PROP_NVL, err, "topo_fmri_fru",
482 if (topo_hdl_nvdup(thp, fp, fru) < 0)
483 return (set_error(thp, ETOPO_PROP_NOMEM, err, "topo_fmri_fru",
492 topo_fmri_label(topo_hdl_t *thp, nvlist_t *nvl, char **label, int *err)
497 if (fmri_prop(thp, nvl, TOPO_PGROUP_PROTOCOL, TOPO_PROP_LABEL,
499 return (set_error(thp, *err, err, "topo_fmri_label", NULL));
502 return (set_error(thp, ETOPO_PROP_NVL, err, "topo_fmri_label",
505 if ((*label = topo_hdl_strdup(thp, lp)) == NULL)
506 return (set_error(thp, ETOPO_PROP_NOMEM, err, "topo_fmri_label",
515 topo_fmri_serial(topo_hdl_t *thp, nvlist_t *nvl, char **serial, int *err)
527 if ((*serial = topo_hdl_strdup(thp, sp)) == NULL)
528 return (set_error(thp, ETOPO_PROP_NOMEM, err,
534 if (fmri_prop(thp, nvl, TOPO_PGROUP_PROTOCOL, FM_FMRI_HC_V1_FRU_SN,
536 fmri_prop(thp, nvl, TOPO_PGROUP_PROTOCOL, FM_FMRI_HC_V0_SERIAL,
538 return (set_error(thp, *err, err, "topo_fmri_serial", NULL));
541 return (set_error(thp, ETOPO_PROP_NVL, err, "topo_fmri_serial",
544 if ((*serial = topo_hdl_strdup(thp, sp)) == NULL)
545 return (set_error(thp, ETOPO_PROP_NOMEM, err,
553 int topo_fmri_getprop(topo_hdl_t *thp, nvlist_t *nvl, const char *pg,
559 return (fmri_prop(thp, nvl, pg, pname, args, prop, err));
562 int topo_fmri_setprop(topo_hdl_t *thp, nvlist_t *nvl, const char *pg,
571 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
574 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
575 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
578 if (topo_hdl_nvalloc(thp, &in, NV_UNIQUE_NAME) != 0)
579 return (set_error(thp, ETOPO_FMRI_NVL, err,
589 return (set_error(thp, ETOPO_FMRI_NVL, err,
609 topo_fmri_getpgrp(topo_hdl_t *thp, nvlist_t *rsrc, const char *pgname,
618 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
621 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
622 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
625 if (topo_hdl_nvalloc(thp, &in, NV_UNIQUE_NAME) != 0)
626 return (set_error(thp, ETOPO_FMRI_NVL, err,
632 return (set_error(thp, ETOPO_FMRI_NVL, err,
645 return (set_error(thp, ETOPO_PROP_NOENT, err,
651 topo_fmri_compare(topo_hdl_t *thp, nvlist_t *f1, nvlist_t *f2, int *err)
660 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
663 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
669 if ((rnode = topo_hdl_root(thp, scheme1)) == NULL)
670 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
673 if (topo_hdl_nvalloc(thp, &in, NV_UNIQUE_NAME) != 0)
674 return (set_error(thp, ETOPO_FMRI_NVL, err, TOPO_METH_COMPARE,
679 return (set_error(thp, ETOPO_FMRI_NVL, err, TOPO_METH_COMPARE,
684 return (set_error(thp, *err, err, TOPO_METH_COMPARE, in));
701 topo_fmri_create(topo_hdl_t *thp, const char *scheme, const char *name,
710 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
711 return (set_nverror(thp, ETOPO_METHOD_NOTSUP, err,
714 if ((*err = topo_hdl_nvalloc(thp, &ins, NV_UNIQUE_NAME)) != 0)
715 return (set_nverror(thp, ETOPO_FMRI_NVL, err,
720 return (set_nverror(thp, ETOPO_FMRI_NVL, err,
726 return (set_nverror(thp, ETOPO_FMRI_NVL, err,
731 return (set_nverror(thp, *err, err, TOPO_METH_FMRI, ins));
757 topo_fmri_strhash_internal(topo_hdl_t *thp, const char *fmri, boolean_t noauth)
768 if ((rnode = topo_hdl_root(thp, buf)) == NULL)
779 topo_fmri_strhash(topo_hdl_t *thp, const char *fmri)
781 return (topo_fmri_strhash_internal(thp, fmri, B_FALSE));
786 topo_fmri_strhash_noauth(topo_hdl_t *thp, const char *fmri)
788 return (topo_fmri_strhash_internal(thp, fmri, B_TRUE));
799 topo_fmri_strcmp_internal(topo_hdl_t *thp, const char *a, const char *b,
819 if ((rnode = topo_hdl_root(thp, bufa)) == NULL)
831 topo_fmri_strcmp(topo_hdl_t *thp, const char *a, const char *b)
833 if (!topo_fmri_strcmp_internal(thp, a, b, TOPO_METH_STRCMP_PATH))
835 return (topo_fmri_strcmp_internal(thp, a, b, TOPO_METH_STRCMP_IDENT));
840 topo_fmri_strcmp_noauth(topo_hdl_t *thp, const char *a, const char *b)
842 return (topo_fmri_strcmp_internal(thp, a, b, TOPO_METH_STRCMP_PATH));
846 topo_fmri_strcmp_ident(topo_hdl_t *thp, const char *a, const char *b)
848 return (topo_fmri_strcmp_internal(thp, a, b, TOPO_METH_STRCMP_IDENT));
852 topo_fmri_ident_node(topo_hdl_t *thp, nvlist_t *rsrc, nvlist_t **pidentp,
862 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
864 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
865 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
867 if (topo_hdl_nvalloc(thp, &in, NV_UNIQUE_NAME) != 0)
868 return (set_error(thp, ETOPO_FMRI_NVL, err,
885 if (topo_hdl_nvdup(thp, out, pidentp) < 0)
886 return (set_error(thp, ETOPO_PROP_NOMEM, err,
894 topo_fmri_facility(topo_hdl_t *thp, nvlist_t *rsrc, const char *fac_type,
903 return (set_error(thp, ETOPO_FMRI_MALFORM, err,
906 if ((rnode = topo_hdl_root(thp, scheme)) == NULL)
907 return (set_error(thp, ETOPO_METHOD_NOTSUP, err,
910 if (topo_hdl_nvalloc(thp, &in, NV_UNIQUE_NAME) != 0)
911 return (set_error(thp, ETOPO_FMRI_NVL, err,
925 return (set_error(thp, ETOPO_FMRI_NVL, err,