Commit | Line | Data |
---|---|---|
1e638f98 | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
1e638f98 FD |
3 | * |
4 | * Copyright 2019 Francis Deslauriers <francis.deslauriers@efficios.com> | |
5 | * | |
0235b0db | 6 | * Babeltrace - File descriptor cache |
1e638f98 FD |
7 | */ |
8 | ||
0235b0db MJ |
9 | #ifndef BABELTRACE_FD_CACHE_INTERNAL_H |
10 | #define BABELTRACE_FD_CACHE_INTERNAL_H | |
11 | ||
91d81473 | 12 | #include "common/macros.h" |
1e638f98 FD |
13 | |
14 | struct bt_fd_cache_handle { | |
15 | int fd; | |
16 | }; | |
17 | ||
18 | struct bt_fd_cache { | |
86d8b7b8 | 19 | int log_level; |
1e638f98 FD |
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 | |
86d8b7b8 | 30 | int bt_fd_cache_init(struct bt_fd_cache *fdc, int log_level); |
1e638f98 FD |
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 */ |