Lines Matching refs:mhp

107 topo_modhash_lock(topo_modhash_t *mhp)
109 (void) pthread_mutex_lock(&mhp->mh_lock);
113 topo_modhash_unlock(topo_modhash_t *mhp)
115 (void) pthread_mutex_unlock(&mhp->mh_lock);
165 topo_modhash_t *mhp = thp->th_modhash;
167 topo_modhash_lock(mhp);
168 mod = topo_modhash_lookup(mhp, name);
171 topo_modhash_unlock(mhp);
255 topo_modhash_t *mhp;
257 if ((mhp = topo_hdl_zalloc(thp, sizeof (topo_modhash_t))) == NULL)
260 mhp->mh_hashlen = TOPO_HASH_BUCKETS;
261 if ((mhp->mh_hash = topo_hdl_zalloc(thp,
262 sizeof (void *) * mhp->mh_hashlen)) == NULL) {
263 topo_hdl_free(thp, mhp, sizeof (topo_modhash_t));
266 mhp->mh_nelems = 0;
267 (void) pthread_mutex_init(&mhp->mh_lock, NULL);
269 thp->th_modhash = mhp;
271 return (mhp);
277 topo_modhash_t *mhp = thp->th_modhash;
279 if (mhp == NULL)
282 assert(mhp->mh_nelems == 0);
284 topo_hdl_free(thp, mhp->mh_hash, sizeof (void *) * mhp->mh_hashlen);
285 topo_hdl_free(thp, mhp, sizeof (topo_modhash_t));
290 topo_modhash_lookup(topo_modhash_t *mhp, const char *name)
295 h = topo_strhash(name) % mhp->mh_hashlen;
297 for (mod = mhp->mh_hash[h]; mod != NULL; mod = mod->tm_next) {
309 topo_modhash_t *mhp = thp->th_modhash;
313 topo_modhash_lock(mhp);
316 topo_modhash_unlock(mhp);
322 h = topo_strhash(name) % mhp->mh_hashlen;
323 mod->tm_next = mhp->mh_hash[h];
324 mhp->mh_hash[h] = mod;
325 mhp->mh_nelems++;
326 topo_modhash_unlock(mhp);
337 topo_modhash_t *mhp;
342 mhp = thp->th_modhash;
343 topo_modhash_lock(mhp);
345 assert(mhp != NULL);
347 h = topo_strhash(mod->tm_name) % mhp->mh_hashlen;
348 pp = &mhp->mh_hash[h];
360 assert(mhp->mh_nelems != 0);
362 mhp->mh_nelems--;
365 topo_modhash_unlock(mhp);
378 topo_modhash_t *mhp = thp->th_modhash;
381 if (mhp == NULL)
384 topo_modhash_lock(mhp);
386 pp = &mhp->mh_hash[i];
401 --mhp->mh_nelems;
404 topo_modhash_unlock(mhp);