2222#pragma warning(disable : 4702)
2323#endif
2424
25- struct ipc_handle_cache_entry_t ;
25+ struct ipc_opened_cache_entry_t ;
2626
27- typedef struct ipc_handle_cache_entry_t * hash_map_t ;
28- typedef struct ipc_handle_cache_entry_t * lru_list_t ;
27+ typedef struct ipc_opened_cache_entry_t * hash_map_t ;
28+ typedef struct ipc_opened_cache_entry_t * lru_list_t ;
2929
30- typedef struct ipc_handle_cache_entry_t {
30+ typedef struct ipc_opened_cache_entry_t {
3131 UT_hash_handle hh ;
32- struct ipc_handle_cache_entry_t * next , * prev ;
33- ipc_mapped_handle_cache_key_t key ;
32+ struct ipc_opened_cache_entry_t * next , * prev ;
33+ ipc_opened_cache_key_t key ;
3434 uint64_t ref_count ;
3535 uint64_t handle_id ;
3636 hash_map_t
3737 * hash_table ; // pointer to the hash table to which the entry belongs
38- ipc_mapped_handle_cache_value_t value ;
39- } ipc_handle_cache_entry_t ;
38+ ipc_opened_cache_value_t value ;
39+ } ipc_opened_cache_entry_t ;
4040
41- typedef struct ipc_mapped_handle_cache_global_t {
41+ typedef struct ipc_opened_cache_global_t {
4242 utils_mutex_t cache_lock ;
4343 umf_ba_pool_t * cache_allocator ;
4444 size_t max_size ;
4545 size_t cur_size ;
4646 lru_list_t lru_list ;
47- } ipc_mapped_handle_cache_global_t ;
47+ } ipc_opened_cache_global_t ;
4848
49- typedef struct ipc_mapped_handle_cache_t {
50- ipc_mapped_handle_cache_global_t * global ;
49+ typedef struct ipc_opened_cache_t {
50+ ipc_opened_cache_global_t * global ;
5151 hash_map_t hash_table ;
52- ipc_mapped_handle_cache_eviction_cb_t eviction_cb ;
53- } ipc_mapped_handle_cache_t ;
52+ ipc_opened_cache_eviction_cb_t eviction_cb ;
53+ } ipc_opened_cache_t ;
5454
55- ipc_mapped_handle_cache_global_t * IPC_MAPPED_CACHE_GLOBAL = NULL ;
55+ ipc_opened_cache_global_t * IPC_OPENED_CACHE_GLOBAL = NULL ;
5656
5757umf_result_t umfIpcCacheGlobalInit (void ) {
5858 umf_result_t ret = UMF_RESULT_SUCCESS ;
59- ipc_mapped_handle_cache_global_t * cache_global =
59+ ipc_opened_cache_global_t * cache_global =
6060 umf_ba_global_alloc (sizeof (* cache_global ));
6161 if (!cache_global ) {
6262 LOG_ERR ("Failed to allocate memory for the IPC cache global data" );
@@ -71,7 +71,7 @@ umf_result_t umfIpcCacheGlobalInit(void) {
7171 }
7272
7373 cache_global -> cache_allocator =
74- umf_ba_create (sizeof (ipc_handle_cache_entry_t ));
74+ umf_ba_create (sizeof (ipc_opened_cache_entry_t ));
7575 if (!cache_global -> cache_allocator ) {
7676 LOG_ERR ("Failed to create IPC cache allocator" );
7777 ret = UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY ;
@@ -83,7 +83,7 @@ umf_result_t umfIpcCacheGlobalInit(void) {
8383 cache_global -> cur_size = 0 ;
8484 cache_global -> lru_list = NULL ;
8585
86- IPC_MAPPED_CACHE_GLOBAL = cache_global ;
86+ IPC_OPENED_CACHE_GLOBAL = cache_global ;
8787 goto err_exit ;
8888
8989err_mutex_destroy :
@@ -97,15 +97,15 @@ umf_result_t umfIpcCacheGlobalInit(void) {
9797#ifndef NDEBUG
9898static size_t getGlobalLruListSize (lru_list_t lru_list ) {
9999 size_t size = 0 ;
100- ipc_handle_cache_entry_t * tmp ;
100+ ipc_opened_cache_entry_t * tmp ;
101101 DL_COUNT (lru_list , tmp , size );
102102 return size ;
103103}
104104#endif /* NDEBUG */
105105
106106void umfIpcCacheGlobalTearDown (void ) {
107- ipc_mapped_handle_cache_global_t * cache_global = IPC_MAPPED_CACHE_GLOBAL ;
108- IPC_MAPPED_CACHE_GLOBAL = NULL ;
107+ ipc_opened_cache_global_t * cache_global = IPC_OPENED_CACHE_GLOBAL ;
108+ IPC_OPENED_CACHE_GLOBAL = NULL ;
109109
110110 if (!cache_global ) {
111111 return ;
@@ -119,31 +119,31 @@ void umfIpcCacheGlobalTearDown(void) {
119119 umf_ba_global_free (cache_global );
120120}
121121
122- ipc_mapped_handle_cache_handle_t umfIpcHandleMappedCacheCreate (
123- ipc_mapped_handle_cache_eviction_cb_t eviction_cb ) {
122+ ipc_opened_cache_handle_t
123+ umfIpcOpenedCacheCreate ( ipc_opened_cache_eviction_cb_t eviction_cb ) {
124124 if (eviction_cb == NULL ) {
125125 LOG_ERR ("Eviction callback is NULL" );
126126 return NULL ;
127127 }
128128
129- ipc_mapped_handle_cache_t * cache = umf_ba_global_alloc (sizeof (* cache ));
129+ ipc_opened_cache_t * cache = umf_ba_global_alloc (sizeof (* cache ));
130130
131131 if (!cache ) {
132132 LOG_ERR ("Failed to allocate memory for the IPC cache" );
133133 return NULL ;
134134 }
135135
136- assert (IPC_MAPPED_CACHE_GLOBAL != NULL );
136+ assert (IPC_OPENED_CACHE_GLOBAL != NULL );
137137
138- cache -> global = IPC_MAPPED_CACHE_GLOBAL ;
138+ cache -> global = IPC_OPENED_CACHE_GLOBAL ;
139139 cache -> hash_table = NULL ;
140140 cache -> eviction_cb = eviction_cb ;
141141
142142 return cache ;
143143}
144144
145- void umfIpcHandleMappedCacheDestroy ( ipc_mapped_handle_cache_handle_t cache ) {
146- ipc_handle_cache_entry_t * entry , * tmp ;
145+ void umfIpcOpenedCacheDestroy ( ipc_opened_cache_handle_t cache ) {
146+ ipc_opened_cache_entry_t * entry , * tmp ;
147147 HASH_ITER (hh , cache -> hash_table , entry , tmp ) {
148148 DL_DELETE (cache -> global -> lru_list , entry );
149149 HASH_DEL (cache -> hash_table , entry );
@@ -157,15 +157,14 @@ void umfIpcHandleMappedCacheDestroy(ipc_mapped_handle_cache_handle_t cache) {
157157 umf_ba_global_free (cache );
158158}
159159
160- umf_result_t
161- umfIpcHandleMappedCacheGet (ipc_mapped_handle_cache_handle_t cache ,
162- const ipc_mapped_handle_cache_key_t * key ,
163- uint64_t handle_id ,
164- ipc_mapped_handle_cache_value_t * * retEntry ) {
165- ipc_handle_cache_entry_t * entry = NULL ;
160+ umf_result_t umfIpcOpenedCacheGet (ipc_opened_cache_handle_t cache ,
161+ const ipc_opened_cache_key_t * key ,
162+ uint64_t handle_id ,
163+ ipc_opened_cache_value_t * * retEntry ) {
164+ ipc_opened_cache_entry_t * entry = NULL ;
166165 umf_result_t ret = UMF_RESULT_SUCCESS ;
167166 bool evicted = false;
168- ipc_mapped_handle_cache_value_t evicted_value ;
167+ ipc_opened_cache_value_t evicted_value ;
169168
170169 if (!cache || !key || !retEntry ) {
171170 LOG_ERR ("Some arguments are NULL, cache=%p, key=%p, retEntry=%p" ,
0 commit comments