Lines Matching defs:h
17 #include <linux/bitops.h>
18 #include <linux/kernel.h>
19 #include <linux/slab.h>
20 #include <linux/errno.h>
21 #include "avtab.h"
22 #include "policydb.h"
67 static struct avtab_node *avtab_insert_node(struct avtab *h,
94 h->nel++;
120 static int avtab_insert(struct avtab *h, const struct avtab_key *key,
127 if (!h || !h->nslot || h->nel == U32_MAX)
130 hvalue = avtab_hash(key, h->mask);
131 for (prev = NULL, cur = h->htable[hvalue]; cur;
141 newnode = avtab_insert_node(h, prev ? &prev->next : &h->htable[hvalue],
153 struct avtab_node *avtab_insert_nonunique(struct avtab *h,
161 if (!h || !h->nslot || h->nel == U32_MAX)
163 hvalue = avtab_hash(key, h->mask);
164 for (prev = NULL, cur = h->htable[hvalue]; cur;
170 return avtab_insert_node(h, prev ? &prev->next : &h->htable[hvalue],
177 struct avtab_node *avtab_search_node(struct avtab *h,
184 if (!h || !h->nslot)
187 hvalue = avtab_hash(key, h->mask);
188 for (cur = h->htable[hvalue]; cur; cur = cur->next) {
219 void avtab_destroy(struct avtab *h)
224 if (!h)
227 for (i = 0; i < h->nslot; i++) {
228 cur = h->htable[i];
238 kvfree(h->htable);
239 h->htable = NULL;
240 h->nel = 0;
241 h->nslot = 0;
242 h->mask = 0;
245 void avtab_init(struct avtab *h)
247 h->htable = NULL;
248 h->nel = 0;
249 h->nslot = 0;
250 h->mask = 0;
253 static int avtab_alloc_common(struct avtab *h, u32 nslot)
258 h->htable = kvcalloc(nslot, sizeof(void *), GFP_KERNEL);
259 if (!h->htable)
262 h->nslot = nslot;
263 h->mask = nslot - 1;
267 int avtab_alloc(struct avtab *h, u32 nrules)
277 rc = avtab_alloc_common(h, nslot);
292 void avtab_hash_eval(struct avtab *h, const char *tag)
301 for (i = 0; i < h->nslot; i++) {
302 cur = h->htable[i];
320 tag, h->nel, slots_used, h->nslot, max_chain_len,