Lines Matching defs:iv

98 void iv_dealloc(ipc_voucher_t iv, boolean_t unhash);
101 iv_reference(ipc_voucher_t iv)
105 refs = hw_atomic_add(&iv->iv_refs, 1);
110 iv_release(ipc_voucher_t iv)
114 assert(0 < iv->iv_refs);
115 refs = hw_atomic_sub(&iv->iv_refs, 1);
117 iv_dealloc(iv, TRUE);
226 ipc_voucher_t iv;
230 iv = (ipc_voucher_t)zalloc(ipc_voucher_zone);
231 if (IV_NULL == iv)
234 iv->iv_refs = 1;
235 iv->iv_sum = 0;
236 iv->iv_hash = 0;
237 iv->iv_port = IP_NULL;
245 zfree(ipc_voucher_zone, iv);
248 iv->iv_table = table;
249 iv->iv_table_size = entries;
251 iv->iv_table = iv->iv_inline_table;
252 iv->iv_table_size = IV_ENTRIES_INLINE;
256 for (i=0; i < iv->iv_table_size; i++)
257 iv->iv_table[i] = IV_UNUSED_VALINDEX;
259 return (iv);
271 iv_set(ipc_voucher_t iv,
275 assert(key_index < iv->iv_table_size);
276 iv->iv_table[key_index] = value_index;
280 iv_dealloc(ipc_voucher_t iv, boolean_t unhash)
282 ipc_port_t port = iv->iv_port;
290 assert(0 == iv->iv_refs);
291 assert(IV_HASH_BUCKETS > iv->iv_hash);
292 queue_remove(&ivht_bucket[iv->iv_hash], iv, ipc_voucher_t, iv_hash_link);
297 VM_KERNEL_ADDRPERM((uintptr_t)iv), 0, ivht_count, 0, 0);
300 assert(0 == --iv->iv_refs);
316 for (i = 0; i < iv->iv_table_size; i++) {
317 ivace_release(i, iv->iv_table[i]);
319 iv_set(iv, i, ~0);
323 if (iv->iv_table != iv->iv_inline_table)
324 kfree(iv->iv_table,
325 iv->iv_table_size * sizeof(*iv->iv_table));
327 zfree(ipc_voucher_zone, iv);
339 iv_lookup(ipc_voucher_t iv, iv_index_t key_index)
341 if (key_index < iv->iv_table_size)
342 return iv->iv_table[key_index];
423 ipc_voucher_t iv;
432 iv = convert_port_to_voucher(port);
434 return iv;
477 ipc_voucher_t iv;
481 iv = (ipc_voucher_t)port->ip_kobject;
483 ipc_voucher_release(iv);
1583 ipc_voucher_t iv;
1596 queue_iterate(&ivht_bucket[hash], iv, ipc_voucher_t, iv_hash_link) {
1597 assert(iv->iv_hash == hash);
1600 if (0 < iv->iv_refs && iv->iv_sum == sum) {
1604 assert(iv->iv_table_size <= new_iv->iv_table_size);
1607 for (i = 0; i < iv->iv_table_size; i++)
1608 if (iv->iv_table[i] != new_iv->iv_table[i])
1610 if (i < iv->iv_table_size)
1630 refs = iv_reference(iv);
1633 iv->iv_refs = 0;
1641 return iv;