3132311cc5a74168ebd12ef1b3ea8c1a71b838c4
[babeltrace.git] / src / fd-cache / fd-cache.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
5 *
6 * Babeltrace - File descriptor cache
7 */
8
9 #ifndef BABELTRACE_FD_CACHE_INTERNAL_H
10 #define BABELTRACE_FD_CACHE_INTERNAL_H
11
12 #include "common/macros.h"
13
14 struct bt_fd_cache_handle {
15 int fd;
16 };
17
18 struct bt_fd_cache {
19 int log_level;
20 GHashTable *cache;
21 };
22
23 static inline
24 int bt_fd_cache_handle_get_fd(struct bt_fd_cache_handle *handle)
25 {
26 return handle->fd;
27 }
28
29 BT_HIDDEN
30 int bt_fd_cache_init(struct bt_fd_cache *fdc, int log_level);
31
32 BT_HIDDEN
33 void bt_fd_cache_fini(struct bt_fd_cache *fdc);
34
35 BT_HIDDEN
36 struct bt_fd_cache_handle *bt_fd_cache_get_handle(struct bt_fd_cache *fdc,
37 const char *path);
38
39 BT_HIDDEN
40 void bt_fd_cache_put_handle(struct bt_fd_cache *fdc,
41 struct bt_fd_cache_handle *handle);
42
43 #endif /* BABELTRACE_FD_CACHE_INTERNAL_H */
This page took 0.029635 seconds and 4 git commands to generate.