Add a lock around the OBJ_NAME table
[openssl.git] / crypto / lhash / lhash_lcl.h
1 /*
2  * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 #include <openssl/crypto.h>
10
11 struct lhash_node_st {
12     void *data;
13     struct lhash_node_st *next;
14     unsigned long hash;
15 };
16
17 struct lhash_st {
18     OPENSSL_LH_NODE **b;
19     OPENSSL_LH_COMPFUNC comp;
20     OPENSSL_LH_HASHFUNC hash;
21     /*
22      * some stats are updated on lookup, which callers aren't expecting to have
23      * to take an exclusive lock around. This lock protects them on platforms
24      * without atomics, and their types are int rather than unsigned long below 
25      * so they can be adjusted with CRYPTO_atomic_add.
26      */
27     CRYPTO_RWLOCK *retrieve_stats_lock;
28     unsigned int num_nodes;
29     unsigned int num_alloc_nodes;
30     unsigned int p;
31     unsigned int pmax;
32     unsigned long up_load;      /* load times 256 */
33     unsigned long down_load;    /* load times 256 */
34     unsigned long num_items;
35     unsigned long num_expands;
36     unsigned long num_expand_reallocs;
37     unsigned long num_contracts;
38     unsigned long num_contract_reallocs;
39     int num_hash_calls;
40     int num_comp_calls;
41     unsigned long num_insert;
42     unsigned long num_replace;
43     unsigned long num_delete;
44     unsigned long num_no_delete;
45     int num_retrieve;
46     int num_retrieve_miss;
47     int num_hash_comps;
48     int error;
49 };