Lines Matching full:entry

41  *  type is entry is called a 'key' entry and it is added to the hash during
44 * key will be linked to this entry. This is used during tsd_destroy() to
46 * The 'key' entry may be looked up with tsd_hash_search() by passing the
49 * The second type of entry is called a 'pid' entry and it is added to the
50 * hash the first time a process set a key. The 'pid' entry is also used
53 * are run for the process. The 'pid' entry may be looked up with
101 tsd_hash_entry_t *entry; in tsd_hash_search() local
109 entry = list_entry(node, tsd_hash_entry_t, he_list); in tsd_hash_search()
110 if ((entry->he_key == key) && (entry->he_pid == pid)) { in tsd_hash_search()
112 return (entry); in tsd_hash_search()
130 tsd_hash_entry_t *entry; in tsd_hash_dtor() local
133 entry = hlist_entry(work->first, tsd_hash_entry_t, he_list); in tsd_hash_dtor()
134 hlist_del(&entry->he_list); in tsd_hash_dtor()
136 if (entry->he_dtor && entry->he_pid != DTOR_PID) in tsd_hash_dtor()
137 entry->he_dtor(entry->he_value); in tsd_hash_dtor()
139 kmem_free(entry, sizeof (tsd_hash_entry_t)); in tsd_hash_dtor()
144 * tsd_hash_add - adds an entry to hash table
158 tsd_hash_entry_t *entry, *dtor_entry, *pid_entry; in tsd_hash_add() local
165 /* New entry allocate structure, set value, and add to hash */ in tsd_hash_add()
166 entry = kmem_alloc(sizeof (tsd_hash_entry_t), KM_PUSHPAGE); in tsd_hash_add()
167 if (entry == NULL) in tsd_hash_add()
170 entry->he_key = key; in tsd_hash_add()
171 entry->he_pid = pid; in tsd_hash_add()
172 entry->he_value = value; in tsd_hash_add()
173 INIT_HLIST_NODE(&entry->he_list); in tsd_hash_add()
174 INIT_LIST_HEAD(&entry->he_key_list); in tsd_hash_add()
175 INIT_LIST_HEAD(&entry->he_pid_list); in tsd_hash_add()
179 /* Destructor entry must exist for all valid keys */ in tsd_hash_add()
180 dtor_entry = tsd_hash_search(table, entry->he_key, DTOR_PID); in tsd_hash_add()
182 entry->he_dtor = dtor_entry->he_dtor; in tsd_hash_add()
184 /* Process entry must exist for all valid processes */ in tsd_hash_add()
185 pid_entry = tsd_hash_search(table, PID_KEY, entry->he_pid); in tsd_hash_add()
193 hlist_add_head(&entry->he_list, &bin->hb_head); in tsd_hash_add()
194 list_add(&entry->he_key_list, &dtor_entry->he_key_list); in tsd_hash_add()
195 list_add(&entry->he_pid_list, &pid_entry->he_pid_list); in tsd_hash_add()
204 * tsd_hash_add_key - adds a destructor entry to the hash table
209 * For every unique key there is a single entry in the hash which is used
217 tsd_hash_entry_t *tmp_entry, *entry; in tsd_hash_add_key() local
224 /* Allocate entry to be used as a destructor for this key */ in tsd_hash_add_key()
225 entry = kmem_alloc(sizeof (tsd_hash_entry_t), KM_PUSHPAGE); in tsd_hash_add_key()
226 if (entry == NULL) in tsd_hash_add_key()
245 /* Add destructor entry in to hash table */ in tsd_hash_add_key()
246 entry->he_key = *keyp = table->ht_key; in tsd_hash_add_key()
247 entry->he_pid = DTOR_PID; in tsd_hash_add_key()
248 entry->he_dtor = dtor; in tsd_hash_add_key()
249 entry->he_value = NULL; in tsd_hash_add_key()
250 INIT_HLIST_NODE(&entry->he_list); in tsd_hash_add_key()
251 INIT_LIST_HEAD(&entry->he_key_list); in tsd_hash_add_key()
252 INIT_LIST_HEAD(&entry->he_pid_list); in tsd_hash_add_key()
258 hlist_add_head(&entry->he_list, &bin->hb_head); in tsd_hash_add_key()
267 * tsd_hash_add_pid - adds a process entry to the hash table
271 * For every process there is a single entry in the hash which is used
278 tsd_hash_entry_t *entry; in tsd_hash_add_pid() local
282 /* Allocate entry to be used as the process reference */ in tsd_hash_add_pid()
283 entry = kmem_alloc(sizeof (tsd_hash_entry_t), KM_PUSHPAGE); in tsd_hash_add_pid()
284 if (entry == NULL) in tsd_hash_add_pid()
288 entry->he_key = PID_KEY; in tsd_hash_add_pid()
289 entry->he_pid = pid; in tsd_hash_add_pid()
290 entry->he_dtor = NULL; in tsd_hash_add_pid()
291 entry->he_value = NULL; in tsd_hash_add_pid()
292 INIT_HLIST_NODE(&entry->he_list); in tsd_hash_add_pid()
293 INIT_LIST_HEAD(&entry->he_key_list); in tsd_hash_add_pid()
294 INIT_LIST_HEAD(&entry->he_pid_list); in tsd_hash_add_pid()
300 hlist_add_head(&entry->he_list, &bin->hb_head); in tsd_hash_add_pid()
309 * tsd_hash_del - delete an entry from hash table, key, and pid lists
315 tsd_hash_del(tsd_hash_table_t *table, tsd_hash_entry_t *entry) in tsd_hash_del() argument
317 hlist_del(&entry->he_list); in tsd_hash_del()
318 list_del_init(&entry->he_key_list); in tsd_hash_del()
319 list_del_init(&entry->he_pid_list); in tsd_hash_del()
370 tsd_hash_entry_t *entry; in tsd_hash_table_fini() local
379 entry = hlist_entry(bin->hb_head.first, in tsd_hash_table_fini()
381 tsd_hash_del(table, entry); in tsd_hash_table_fini()
382 hlist_add_head(&entry->he_list, &work); in tsd_hash_table_fini()
394 * tsd_remove_entry - remove a tsd entry for this thread
395 * @entry: entry to remove
397 * Remove the thread specific data @entry for this thread.
398 * If this is the last entry for this thread, also remove the PID entry.
401 tsd_remove_entry(tsd_hash_entry_t *entry) in tsd_remove_entry() argument
411 ASSERT3P(entry, !=, NULL); in tsd_remove_entry()
415 hash = hash_long((ulong_t)entry->he_key * in tsd_remove_entry()
416 (ulong_t)entry->he_pid, table->ht_bits); in tsd_remove_entry()
420 pid_entry = list_entry(entry->he_pid_list.next, tsd_hash_entry_t, in tsd_remove_entry()
423 /* remove entry */ in tsd_remove_entry()
425 tsd_hash_del(table, entry); in tsd_remove_entry()
426 hlist_add_head(&entry->he_list, &work); in tsd_remove_entry()
462 tsd_hash_entry_t *entry; in tsd_set() local
475 /* Entry already exists in hash table update value */ in tsd_set()
476 entry = tsd_hash_search(table, key, pid); in tsd_set()
477 if (entry) { in tsd_set()
478 entry->he_value = value; in tsd_set()
479 /* remove the entry */ in tsd_set()
481 tsd_remove_entry(entry); in tsd_set()
485 /* don't create entry if value is NULL */ in tsd_set()
489 /* Add a process entry to the hash if not yet exists */ in tsd_set()
490 entry = tsd_hash_search(table, PID_KEY, pid); in tsd_set()
491 if (entry == NULL) { in tsd_set()
513 tsd_hash_entry_t *entry; in tsd_get() local
520 entry = tsd_hash_search(tsd_hash_table, key, curthread->pid); in tsd_get()
521 if (entry == NULL) in tsd_get()
524 return (entry->he_value); in tsd_get()
540 tsd_hash_entry_t *entry; in tsd_get_by_thread() local
547 entry = tsd_hash_search(tsd_hash_table, key, thread->pid); in tsd_get_by_thread()
548 if (entry == NULL) in tsd_get_by_thread()
551 return (entry->he_value); in tsd_get_by_thread()
592 tsd_hash_entry_t *dtor_entry, *entry; in tsd_destroy() local
608 * DTOR_PID entry. They are removed from the hash table and in tsd_destroy()
612 entry = list_entry(dtor_entry->he_key_list.next, in tsd_destroy()
614 ASSERT3U(dtor_entry->he_key, ==, entry->he_key); in tsd_destroy()
615 ASSERT3P(dtor_entry->he_dtor, ==, entry->he_dtor); in tsd_destroy()
617 hash = hash_long((ulong_t)entry->he_key * in tsd_destroy()
618 (ulong_t)entry->he_pid, table->ht_bits); in tsd_destroy()
622 tsd_hash_del(table, entry); in tsd_destroy()
623 hlist_add_head(&entry->he_list, &work); in tsd_destroy()
655 tsd_hash_entry_t *pid_entry, *entry; in tsd_exit() local
671 * PID_KEY entry. They are removed from the hash table and in tsd_exit()
676 entry = list_entry(pid_entry->he_pid_list.next, in tsd_exit()
678 ASSERT3U(pid_entry->he_pid, ==, entry->he_pid); in tsd_exit()
680 hash = hash_long((ulong_t)entry->he_key * in tsd_exit()
681 (ulong_t)entry->he_pid, table->ht_bits); in tsd_exit()
685 tsd_hash_del(table, entry); in tsd_exit()
686 hlist_add_head(&entry->he_list, &work); in tsd_exit()