Lines Matching refs:tbl
89 #define FILEASSOC_HASH(tbl, handle) \
91 & ((tbl)->tbl_mask))
189 struct fileassoc_table *tbl = v;
193 for (i = 0; i < tbl->tbl_nslots; i++) {
196 while ((faf = LIST_FIRST(&tbl->tbl_hash[i])) != NULL) {
202 hashdone(tbl->tbl_hash, HASH_LIST, tbl->tbl_mask);
203 specificdata_fini(fileassoc_domain, &tbl->tbl_data);
204 kmem_free(tbl, sizeof(*tbl));
298 struct fileassoc_table *tbl;
305 tbl = fileassoc_table_lookup(vp->v_mount);
306 if (tbl == NULL) {
318 indx = FILEASSOC_HASH(tbl, th);
319 hash_entry = &(tbl->tbl_hash[indx]);
352 fileassoc_table_resize(struct fileassoc_table *tbl)
362 newtbl->tbl_nslots = (tbl->tbl_nslots * 2);
363 if (newtbl->tbl_nslots < tbl->tbl_nslots)
364 newtbl->tbl_nslots = tbl->tbl_nslots;
372 for (i = 0; i < tbl->tbl_nslots; i++) {
375 while ((faf = LIST_FIRST(&tbl->tbl_hash[i])) != NULL) {
390 if (tbl->tbl_nused != newtbl->tbl_nused)
392 "needed %zu entries, got %zu", tbl->tbl_nused,
395 hashdone(tbl->tbl_hash, HASH_LIST, tbl->tbl_mask);
396 specificdata_fini(fileassoc_domain, &tbl->tbl_data);
397 kmem_free(tbl, sizeof(*tbl));
408 struct fileassoc_table *tbl;
411 tbl = fileassoc_table_lookup(mp);
412 if (tbl != NULL)
413 return (tbl);
416 tbl = kmem_zalloc(sizeof(*tbl), KM_SLEEP);
417 tbl->tbl_nslots = FILEASSOC_INITIAL_TABLESIZE;
418 tbl->tbl_hash = hashinit(tbl->tbl_nslots, HASH_LIST, true,
419 &tbl->tbl_mask);
420 tbl->tbl_nused = 0;
421 specificdata_init(fileassoc_domain, &tbl->tbl_data);
423 mount_setspecific(mp, fileassoc_mountspecific_key, tbl);
425 return (tbl);
434 struct fileassoc_table *tbl;
436 tbl = fileassoc_table_lookup(mp);
437 if (tbl == NULL)
441 table_dtor(tbl);
453 struct fileassoc_table *tbl;
456 tbl = fileassoc_table_lookup(mp);
457 if (tbl == NULL)
460 for (i = 0; i < tbl->tbl_nslots; i++) {
463 LIST_FOREACH(faf, &tbl->tbl_hash[i], faf_list) {
481 struct fileassoc_table *tbl;
484 tbl = fileassoc_table_lookup(mp);
485 if (tbl == NULL)
488 for (i = 0; i < tbl->tbl_nslots; i++) {
491 LIST_FOREACH(faf, &tbl->tbl_hash[i], faf_list) {
508 struct fileassoc_table *tbl;
530 tbl = fileassoc_table_lookup(vp->v_mount);
531 if (tbl == NULL) {
532 tbl = fileassoc_table_add(vp->v_mount);
535 indx = FILEASSOC_HASH(tbl, th);
536 hash_entry = &(tbl->tbl_hash[indx]);
549 if (++(tbl->tbl_nused) == tbl->tbl_nslots) {
552 newtbl = fileassoc_table_resize(tbl);
566 struct fileassoc_table *tbl;
582 tbl = fileassoc_table_lookup(vp->v_mount);
583 KASSERT(tbl != NULL);
584 --(tbl->tbl_nused); /* XXX gc? */