• Home
  • Raw
  • Download

Lines Matching refs:pool

122 static void kvp_acquire_lock(int pool)  in kvp_acquire_lock()  argument
127 if (fcntl(kvp_file_info[pool].fd, F_SETLKW, &fl) == -1) { in kvp_acquire_lock()
128 syslog(LOG_ERR, "Failed to acquire the lock pool: %d; error: %d %s", pool, in kvp_acquire_lock()
134 static void kvp_release_lock(int pool) in kvp_release_lock() argument
139 if (fcntl(kvp_file_info[pool].fd, F_SETLK, &fl) == -1) { in kvp_release_lock()
140 syslog(LOG_ERR, "Failed to release the lock pool: %d; error: %d %s", pool, in kvp_release_lock()
146 static void kvp_update_file(int pool) in kvp_update_file() argument
155 kvp_acquire_lock(pool); in kvp_update_file()
157 filep = fopen(kvp_file_info[pool].fname, "we"); in kvp_update_file()
159 syslog(LOG_ERR, "Failed to open file, pool: %d; error: %d %s", pool, in kvp_update_file()
161 kvp_release_lock(pool); in kvp_update_file()
165 bytes_written = fwrite(kvp_file_info[pool].records, in kvp_update_file()
167 kvp_file_info[pool].num_records, filep); in kvp_update_file()
170 kvp_release_lock(pool); in kvp_update_file()
171 syslog(LOG_ERR, "Failed to write file, pool: %d", pool); in kvp_update_file()
175 kvp_release_lock(pool); in kvp_update_file()
178 static void kvp_update_mem_state(int pool) in kvp_update_mem_state() argument
182 struct kvp_record *record = kvp_file_info[pool].records; in kvp_update_mem_state()
184 int num_blocks = kvp_file_info[pool].num_blocks; in kvp_update_mem_state()
187 kvp_acquire_lock(pool); in kvp_update_mem_state()
189 filep = fopen(kvp_file_info[pool].fname, "re"); in kvp_update_mem_state()
191 syslog(LOG_ERR, "Failed to open file, pool: %d; error: %d %s", pool, in kvp_update_mem_state()
193 kvp_release_lock(pool); in kvp_update_mem_state()
205 pool, errno, strerror(errno)); in kvp_update_mem_state()
206 kvp_release_lock(pool); in kvp_update_mem_state()
219 kvp_release_lock(pool); in kvp_update_mem_state()
227 kvp_file_info[pool].num_blocks = num_blocks; in kvp_update_mem_state()
228 kvp_file_info[pool].records = record; in kvp_update_mem_state()
229 kvp_file_info[pool].num_records = records_read; in kvp_update_mem_state()
232 kvp_release_lock(pool); in kvp_update_mem_state()
270 static int kvp_key_delete(int pool, const char *key, int key_size) in kvp_key_delete() argument
280 kvp_update_mem_state(pool); in kvp_key_delete()
282 num_records = kvp_file_info[pool].num_records; in kvp_key_delete()
283 record = kvp_file_info[pool].records; in kvp_key_delete()
293 kvp_file_info[pool].num_records--; in kvp_key_delete()
294 kvp_update_file(pool); in kvp_key_delete()
306 kvp_file_info[pool].num_records--; in kvp_key_delete()
307 kvp_update_file(pool); in kvp_key_delete()
313 static int kvp_key_add_or_modify(int pool, const char *key, int key_size, const char *value, in kvp_key_add_or_modify() argument
328 kvp_update_mem_state(pool); in kvp_key_add_or_modify()
330 num_records = kvp_file_info[pool].num_records; in kvp_key_add_or_modify()
331 record = kvp_file_info[pool].records; in kvp_key_add_or_modify()
332 num_blocks = kvp_file_info[pool].num_blocks; in kvp_key_add_or_modify()
342 kvp_update_file(pool); in kvp_key_add_or_modify()
356 kvp_file_info[pool].num_blocks++; in kvp_key_add_or_modify()
361 kvp_file_info[pool].records = record; in kvp_key_add_or_modify()
362 kvp_file_info[pool].num_records++; in kvp_key_add_or_modify()
363 kvp_update_file(pool); in kvp_key_add_or_modify()
367 static int kvp_get_value(int pool, const char *key, int key_size, char *value, in kvp_get_value() argument
381 kvp_update_mem_state(pool); in kvp_get_value()
383 num_records = kvp_file_info[pool].num_records; in kvp_get_value()
384 record = kvp_file_info[pool].records; in kvp_get_value()
399 static int kvp_pool_enumerate(int pool, int index, char *key, int key_size, in kvp_pool_enumerate() argument
407 kvp_update_mem_state(pool); in kvp_pool_enumerate()
408 record = kvp_file_info[pool].records; in kvp_pool_enumerate()
410 if (index >= kvp_file_info[pool].num_records) { in kvp_pool_enumerate()
1391 int pool; in main() local
1516 pool = hv_msg->kvp_hdr.pool; in main()
1582 if (kvp_key_add_or_modify(pool, in main()
1591 if (kvp_get_value(pool, in main()
1600 if (kvp_key_delete(pool, in main()
1618 if (pool != KVP_POOL_AUTO) { in main()
1619 if (kvp_pool_enumerate(pool, in main()