Lines Matching defs:shp

255 	fmd_scheme_hash_t *shp;
259 shp = fmd_alloc(sizeof (fmd_scheme_hash_t), FMD_SLEEP);
261 shp->sch_dirpath = fmd_strdup(path, FMD_SLEEP);
262 (void) pthread_rwlock_init(&shp->sch_rwlock, NULL);
263 shp->sch_hashlen = fmd.d_str_buckets;
264 shp->sch_hash = fmd_zalloc(sizeof (fmd_scheme_t *) *
265 shp->sch_hashlen, FMD_SLEEP);
270 shp->sch_hash[fmd_strhash(sp->sch_name) % shp->sch_hashlen] = sp;
272 return (shp);
276 fmd_scheme_hash_destroy(fmd_scheme_hash_t *shp)
281 for (i = 0; i < shp->sch_hashlen; i++) {
282 for (sp = shp->sch_hash[i]; sp != NULL; sp = np) {
285 fmd_scheme_hash_release(shp, sp);
289 fmd_free(shp->sch_hash, sizeof (fmd_scheme_t *) * shp->sch_hashlen);
290 fmd_strfree(shp->sch_dirpath);
291 fmd_free(shp, sizeof (fmd_scheme_hash_t));
295 fmd_scheme_hash_trygc(fmd_scheme_hash_t *shp)
300 if (shp == NULL || pthread_rwlock_trywrlock(&shp->sch_rwlock) != 0)
303 for (i = 0; i < shp->sch_hashlen; i++) {
304 for (sp = shp->sch_hash[i]; sp != NULL; sp = np) {
307 fmd_scheme_hash_release(shp, sp);
311 bzero(shp->sch_hash, sizeof (fmd_scheme_t *) * shp->sch_hashlen);
312 (void) pthread_rwlock_unlock(&shp->sch_rwlock);
330 fmd_scheme_hash_xlookup(fmd_scheme_hash_t *shp, const char *name, uint_t h)
334 ASSERT(RW_LOCK_HELD(&shp->sch_rwlock));
336 for (sp = shp->sch_hash[h]; sp != NULL; sp = sp->sch_next) {
351 fmd_scheme_hash_lookup(fmd_scheme_hash_t *shp, const char *name)
361 (void) pthread_rwlock_rdlock(&shp->sch_rwlock);
362 h = fmd_strhash(name) % shp->sch_hashlen;
364 if ((sp = fmd_scheme_hash_xlookup(shp, name, h)) == NULL) {
365 (void) pthread_rwlock_unlock(&shp->sch_rwlock);
367 (void) pthread_rwlock_wrlock(&shp->sch_rwlock);
369 if ((sp = fmd_scheme_hash_xlookup(shp, name, h)) == NULL) {
370 nsp->sch_next = shp->sch_hash[h];
371 shp->sch_hash[h] = sp = nsp;
373 fmd_scheme_hash_release(shp, nsp);
383 (void) pthread_rwlock_unlock(&shp->sch_rwlock);
394 "%s/%s.so", shp->sch_dirpath, sp->sch_name);
433 * We take 'shp' for symmetry and in case we need to use it in future work.
437 fmd_scheme_hash_release(fmd_scheme_hash_t *shp, fmd_scheme_t *sp)