Lines Matching refs:tbl
92 #define FILEASSOC_HASH(tbl, handle) \
94 & ((tbl)->tbl_mask))
192 struct fileassoc_table *tbl = v;
196 for (i = 0; i < tbl->tbl_nslots; i++) {
199 while ((faf = LIST_FIRST(&tbl->tbl_hash[i])) != NULL) {
205 hashdone(tbl->tbl_hash, HASH_LIST, tbl->tbl_mask);
206 specificdata_fini(fileassoc_domain, &tbl->tbl_data);
207 kmem_free(tbl, sizeof(*tbl));
301 struct fileassoc_table *tbl;
308 tbl = fileassoc_table_lookup(vp->v_mount);
309 if (tbl == NULL) {
321 indx = FILEASSOC_HASH(tbl, th);
322 hash_entry = &(tbl->tbl_hash[indx]);
355 fileassoc_table_resize(struct fileassoc_table *tbl)
365 newtbl->tbl_nslots = (tbl->tbl_nslots * 2);
366 if (newtbl->tbl_nslots < tbl->tbl_nslots)
367 newtbl->tbl_nslots = tbl->tbl_nslots;
375 for (i = 0; i < tbl->tbl_nslots; i++) {
378 while ((faf = LIST_FIRST(&tbl->tbl_hash[i])) != NULL) {
393 if (tbl->tbl_nused != newtbl->tbl_nused)
395 "needed %zu entries, got %zu", tbl->tbl_nused,
398 hashdone(tbl->tbl_hash, HASH_LIST, tbl->tbl_mask);
399 specificdata_fini(fileassoc_domain, &tbl->tbl_data);
400 kmem_free(tbl, sizeof(*tbl));
411 struct fileassoc_table *tbl;
414 tbl = fileassoc_table_lookup(mp);
415 if (tbl != NULL)
416 return (tbl);
419 tbl = kmem_zalloc(sizeof(*tbl), KM_SLEEP);
420 tbl->tbl_nslots = FILEASSOC_INITIAL_TABLESIZE;
421 tbl->tbl_hash = hashinit(tbl->tbl_nslots, HASH_LIST, true,
422 &tbl->tbl_mask);
423 tbl->tbl_nused = 0;
424 specificdata_init(fileassoc_domain, &tbl->tbl_data);
426 mount_setspecific(mp, fileassoc_mountspecific_key, tbl);
428 return (tbl);
437 struct fileassoc_table *tbl;
439 tbl = fileassoc_table_lookup(mp);
440 if (tbl == NULL)
444 table_dtor(tbl);
456 struct fileassoc_table *tbl;
459 tbl = fileassoc_table_lookup(mp);
460 if (tbl == NULL)
463 for (i = 0; i < tbl->tbl_nslots; i++) {
466 LIST_FOREACH(faf, &tbl->tbl_hash[i], faf_list) {
484 struct fileassoc_table *tbl;
487 tbl = fileassoc_table_lookup(mp);
488 if (tbl == NULL)
491 for (i = 0; i < tbl->tbl_nslots; i++) {
494 LIST_FOREACH(faf, &tbl->tbl_hash[i], faf_list) {
511 struct fileassoc_table *tbl;
533 tbl = fileassoc_table_lookup(vp->v_mount);
534 if (tbl == NULL) {
535 tbl = fileassoc_table_add(vp->v_mount);
538 indx = FILEASSOC_HASH(tbl, th);
539 hash_entry = &(tbl->tbl_hash[indx]);
552 if (++(tbl->tbl_nused) == tbl->tbl_nslots) {
555 newtbl = fileassoc_table_resize(tbl);
569 struct fileassoc_table *tbl;
585 tbl = fileassoc_table_lookup(vp->v_mount);
586 KASSERT(tbl != NULL);
587 --(tbl->tbl_nused); /* XXX gc? */