Lines Matching defs:thp

165 topo_mod_lookup(topo_hdl_t *thp, const char *name, int bump)
168 topo_modhash_t *mhp = thp->th_modhash;
182 topo_hdl_t *thp = mod->tm_hdl;
191 topo_hdl_strfree(thp, mod->tm_name);
193 topo_hdl_strfree(thp, mod->tm_path);
195 topo_hdl_strfree(thp, mod->tm_rootdir);
197 topo_hdl_free(thp, mod, sizeof (topo_mod_t));
201 set_create_error(topo_hdl_t *thp, topo_mod_t *mod, const char *path, int err)
204 topo_dprintf(thp, TOPO_DBG_ERR, "unable to load module %s: "
207 topo_dprintf(thp, TOPO_DBG_ERR, "unable to load module: "
213 (void) topo_hdl_seterrno(thp, err);
219 topo_mod_create(topo_hdl_t *thp, const char *name, const char *path,
224 if (topo_modhash_lookup(thp->th_modhash, name) != NULL)
225 return (set_create_error(thp, NULL, path, ETOPO_MOD_LOADED));
227 if ((mod = topo_hdl_zalloc(thp, sizeof (topo_mod_t))) == NULL)
228 return (set_create_error(thp, mod, path, ETOPO_NOMEM));
230 mod->tm_hdl = thp;
234 mod->tm_name = topo_hdl_strdup(thp, name);
236 mod->tm_path = topo_hdl_strdup(thp, path);
237 mod->tm_rootdir = topo_hdl_strdup(thp, thp->th_rootdir);
239 return (set_create_error(thp, mod, path, ETOPO_NOMEM));
242 mod->tm_alloc = thp->th_alloc;
248 return (set_create_error(thp, mod, path, mod->tm_errno));
250 topo_dprintf(thp, TOPO_DBG_MODSVC, "loaded module %s\n", mod->tm_name);
256 topo_modhash_create(topo_hdl_t *thp)
260 if ((mhp = topo_hdl_zalloc(thp, sizeof (topo_modhash_t))) == NULL)
264 if ((mhp->mh_hash = topo_hdl_zalloc(thp,
266 topo_hdl_free(thp, mhp, sizeof (topo_modhash_t));
272 thp->th_modhash = mhp;
278 topo_modhash_destroy(topo_hdl_t *thp)
280 topo_modhash_t *mhp = thp->th_modhash;
287 topo_hdl_free(thp, mhp->mh_hash, sizeof (void *) * mhp->mh_hashlen);
288 topo_hdl_free(thp, mhp, sizeof (topo_modhash_t));
289 thp->th_modhash = NULL;
309 topo_modhash_load(topo_hdl_t *thp, const char *name, const char *path,
312 topo_modhash_t *mhp = thp->th_modhash;
318 if ((mod = topo_mod_create(thp, name, path, ops, version)) == NULL) {
339 topo_hdl_t *thp = mod->tm_hdl;
345 mhp = thp->th_modhash;
378 topo_modhash_unload_all(topo_hdl_t *thp)
381 topo_modhash_t *mhp = thp->th_modhash;