Lines Matching full:entry
42 * type is entry is called a 'key' entry and it is added to the hash during
45 * key will be linked to this entry. This is used during tsd_destroy() to
47 * The 'key' entry may be looked up with tsd_hash_search() by passing the
50 * The second type of entry is called a 'pid' entry and it is added to the
51 * hash the first time a process set a key. The 'pid' entry is also used
54 * are run for the process. The 'pid' entry may be looked up with
102 tsd_hash_entry_t *entry; in tsd_hash_search() local
110 entry = list_entry(node, tsd_hash_entry_t, he_list); in tsd_hash_search()
111 if ((entry->he_key == key) && (entry->he_pid == pid)) { in tsd_hash_search()
113 return (entry); in tsd_hash_search()
131 tsd_hash_entry_t *entry; in tsd_hash_dtor() local
134 entry = hlist_entry(work->first, tsd_hash_entry_t, he_list); in tsd_hash_dtor()
135 hlist_del(&entry->he_list); in tsd_hash_dtor()
137 if (entry->he_dtor && entry->he_pid != DTOR_PID) in tsd_hash_dtor()
138 entry->he_dtor(entry->he_value); in tsd_hash_dtor()
140 kmem_free(entry, sizeof (tsd_hash_entry_t)); in tsd_hash_dtor()
145 * tsd_hash_add - adds an entry to hash table
159 tsd_hash_entry_t *entry, *dtor_entry, *pid_entry; in tsd_hash_add() local
166 /* New entry allocate structure, set value, and add to hash */ in tsd_hash_add()
167 entry = kmem_alloc(sizeof (tsd_hash_entry_t), KM_PUSHPAGE); in tsd_hash_add()
168 if (entry == NULL) in tsd_hash_add()
171 entry->he_key = key; in tsd_hash_add()
172 entry->he_pid = pid; in tsd_hash_add()
173 entry->he_value = value; in tsd_hash_add()
174 INIT_HLIST_NODE(&entry->he_list); in tsd_hash_add()
175 INIT_LIST_HEAD(&entry->he_key_list); in tsd_hash_add()
176 INIT_LIST_HEAD(&entry->he_pid_list); in tsd_hash_add()
180 /* Destructor entry must exist for all valid keys */ in tsd_hash_add()
181 dtor_entry = tsd_hash_search(table, entry->he_key, DTOR_PID); in tsd_hash_add()
183 entry->he_dtor = dtor_entry->he_dtor; in tsd_hash_add()
185 /* Process entry must exist for all valid processes */ in tsd_hash_add()
186 pid_entry = tsd_hash_search(table, PID_KEY, entry->he_pid); in tsd_hash_add()
194 hlist_add_head(&entry->he_list, &bin->hb_head); in tsd_hash_add()
195 list_add(&entry->he_key_list, &dtor_entry->he_key_list); in tsd_hash_add()
196 list_add(&entry->he_pid_list, &pid_entry->he_pid_list); in tsd_hash_add()
205 * tsd_hash_add_key - adds a destructor entry to the hash table
210 * For every unique key there is a single entry in the hash which is used
218 tsd_hash_entry_t *tmp_entry, *entry; in tsd_hash_add_key() local
225 /* Allocate entry to be used as a destructor for this key */ in tsd_hash_add_key()
226 entry = kmem_alloc(sizeof (tsd_hash_entry_t), KM_PUSHPAGE); in tsd_hash_add_key()
227 if (entry == NULL) in tsd_hash_add_key()
246 /* Add destructor entry in to hash table */ in tsd_hash_add_key()
247 entry->he_key = *keyp = table->ht_key; in tsd_hash_add_key()
248 entry->he_pid = DTOR_PID; in tsd_hash_add_key()
249 entry->he_dtor = dtor; in tsd_hash_add_key()
250 entry->he_value = NULL; in tsd_hash_add_key()
251 INIT_HLIST_NODE(&entry->he_list); in tsd_hash_add_key()
252 INIT_LIST_HEAD(&entry->he_key_list); in tsd_hash_add_key()
253 INIT_LIST_HEAD(&entry->he_pid_list); in tsd_hash_add_key()
259 hlist_add_head(&entry->he_list, &bin->hb_head); in tsd_hash_add_key()
268 * tsd_hash_add_pid - adds a process entry to the hash table
272 * For every process there is a single entry in the hash which is used
279 tsd_hash_entry_t *entry; in tsd_hash_add_pid() local
283 /* Allocate entry to be used as the process reference */ in tsd_hash_add_pid()
284 entry = kmem_alloc(sizeof (tsd_hash_entry_t), KM_PUSHPAGE); in tsd_hash_add_pid()
285 if (entry == NULL) in tsd_hash_add_pid()
289 entry->he_key = PID_KEY; in tsd_hash_add_pid()
290 entry->he_pid = pid; in tsd_hash_add_pid()
291 entry->he_dtor = NULL; in tsd_hash_add_pid()
292 entry->he_value = NULL; in tsd_hash_add_pid()
293 INIT_HLIST_NODE(&entry->he_list); in tsd_hash_add_pid()
294 INIT_LIST_HEAD(&entry->he_key_list); in tsd_hash_add_pid()
295 INIT_LIST_HEAD(&entry->he_pid_list); in tsd_hash_add_pid()
301 hlist_add_head(&entry->he_list, &bin->hb_head); in tsd_hash_add_pid()
310 * tsd_hash_del - delete an entry from hash table, key, and pid lists
316 tsd_hash_del(tsd_hash_table_t *table, tsd_hash_entry_t *entry) in tsd_hash_del() argument
318 hlist_del(&entry->he_list); in tsd_hash_del()
319 list_del_init(&entry->he_key_list); in tsd_hash_del()
320 list_del_init(&entry->he_pid_list); in tsd_hash_del()
371 tsd_hash_entry_t *entry; in tsd_hash_table_fini() local
380 entry = hlist_entry(bin->hb_head.first, in tsd_hash_table_fini()
382 tsd_hash_del(table, entry); in tsd_hash_table_fini()
383 hlist_add_head(&entry->he_list, &work); in tsd_hash_table_fini()
395 * tsd_remove_entry - remove a tsd entry for this thread
396 * @entry: entry to remove
398 * Remove the thread specific data @entry for this thread.
399 * If this is the last entry for this thread, also remove the PID entry.
402 tsd_remove_entry(tsd_hash_entry_t *entry) in tsd_remove_entry() argument
412 ASSERT3P(entry, !=, NULL); in tsd_remove_entry()
416 hash = hash_long((ulong_t)entry->he_key * in tsd_remove_entry()
417 (ulong_t)entry->he_pid, table->ht_bits); in tsd_remove_entry()
421 pid_entry = list_entry(entry->he_pid_list.next, tsd_hash_entry_t, in tsd_remove_entry()
424 /* remove entry */ in tsd_remove_entry()
426 tsd_hash_del(table, entry); in tsd_remove_entry()
427 hlist_add_head(&entry->he_list, &work); in tsd_remove_entry()
463 tsd_hash_entry_t *entry; in tsd_set() local
476 /* Entry already exists in hash table update value */ in tsd_set()
477 entry = tsd_hash_search(table, key, pid); in tsd_set()
478 if (entry) { in tsd_set()
479 entry->he_value = value; in tsd_set()
480 /* remove the entry */ in tsd_set()
482 tsd_remove_entry(entry); in tsd_set()
486 /* don't create entry if value is NULL */ in tsd_set()
490 /* Add a process entry to the hash if not yet exists */ in tsd_set()
491 entry = tsd_hash_search(table, PID_KEY, pid); in tsd_set()
492 if (entry == NULL) { in tsd_set()
514 tsd_hash_entry_t *entry; in tsd_get() local
521 entry = tsd_hash_search(tsd_hash_table, key, curthread->pid); in tsd_get()
522 if (entry == NULL) in tsd_get()
525 return (entry->he_value); in tsd_get()
541 tsd_hash_entry_t *entry; in tsd_get_by_thread() local
548 entry = tsd_hash_search(tsd_hash_table, key, thread->pid); in tsd_get_by_thread()
549 if (entry == NULL) in tsd_get_by_thread()
552 return (entry->he_value); in tsd_get_by_thread()
593 tsd_hash_entry_t *dtor_entry, *entry; in tsd_destroy() local
609 * DTOR_PID entry. They are removed from the hash table and in tsd_destroy()
613 entry = list_entry(dtor_entry->he_key_list.next, in tsd_destroy()
615 ASSERT3U(dtor_entry->he_key, ==, entry->he_key); in tsd_destroy()
616 ASSERT3P(dtor_entry->he_dtor, ==, entry->he_dtor); in tsd_destroy()
618 hash = hash_long((ulong_t)entry->he_key * in tsd_destroy()
619 (ulong_t)entry->he_pid, table->ht_bits); in tsd_destroy()
623 tsd_hash_del(table, entry); in tsd_destroy()
624 hlist_add_head(&entry->he_list, &work); in tsd_destroy()
656 tsd_hash_entry_t *pid_entry, *entry; in tsd_exit() local
672 * PID_KEY entry. They are removed from the hash table and in tsd_exit()
677 entry = list_entry(pid_entry->he_pid_list.next, in tsd_exit()
679 ASSERT3U(pid_entry->he_pid, ==, entry->he_pid); in tsd_exit()
681 hash = hash_long((ulong_t)entry->he_key * in tsd_exit()
682 (ulong_t)entry->he_pid, table->ht_bits); in tsd_exit()
686 tsd_hash_del(table, entry); in tsd_exit()
687 hlist_add_head(&entry->he_list, &work); in tsd_exit()