Commit | Line | Data |
---|---|---|
e0e72660 | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
e0e72660 | 3 | * |
ab5be9fa | 4 | * SPDX-License-Identifier: GPL-2.0-only |
e0e72660 | 5 | * |
e0e72660 JG |
6 | */ |
7 | ||
8 | #ifndef FD_TRACKER_INODE_H | |
9 | #define FD_TRACKER_INODE_H | |
10 | ||
f7c3ffd7 | 11 | #include <common/compat/directory-handle.h> |
e0e72660 JG |
12 | #include <stdbool.h> |
13 | ||
14 | struct lttng_inode; | |
15 | struct lttng_inode_registry; | |
f7c3ffd7 JG |
16 | struct lttng_unlinked_file_directory; |
17 | ||
18 | /* | |
19 | * The unlinked file pool is protected by the fd-tracker's lock. | |
20 | * | |
21 | * NOTE: the unlinked file pool can use a single file desriptor when unlinked | |
22 | * files are present in the pool. This file descriptor is not accounted-for | |
23 | * by the fd-tracker. Users of the fd-tracker should account for this extra | |
24 | * file descriptor. | |
25 | */ | |
26 | struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create( | |
27 | const char *path); | |
28 | ||
29 | void lttng_unlinked_file_pool_destroy( | |
30 | struct lttng_unlinked_file_pool *pool); | |
e0e72660 JG |
31 | |
32 | /* The inode registry is protected by the fd-tracker's lock. */ | |
33 | struct lttng_inode_registry *lttng_inode_registry_create(void); | |
34 | ||
35 | struct lttng_inode *lttng_inode_registry_get_inode( | |
5c1f54d1 | 36 | struct lttng_inode_registry *registry, |
f7c3ffd7 JG |
37 | struct lttng_directory_handle *handle, |
38 | const char *path, | |
5c1f54d1 | 39 | int fd, |
f7c3ffd7 | 40 | struct lttng_unlinked_file_pool *pool); |
e0e72660 JG |
41 | |
42 | void lttng_inode_registry_destroy(struct lttng_inode_registry *registry); | |
43 | ||
f7c3ffd7 JG |
44 | void lttng_inode_get_location(struct lttng_inode *inode, |
45 | const struct lttng_directory_handle **out_directory_handle, | |
46 | const char **out_path); | |
47 | ||
5c1f54d1 | 48 | int lttng_inode_rename(struct lttng_inode *inode, |
f7c3ffd7 JG |
49 | struct lttng_directory_handle *old_directory_handle, |
50 | const char *old_path, | |
51 | struct lttng_directory_handle *new_directory_handle, | |
5c1f54d1 | 52 | const char *new_path, |
e0e72660 | 53 | bool overwrite); |
f7c3ffd7 JG |
54 | |
55 | int lttng_inode_unlink(struct lttng_inode *inode); | |
56 | ||
e0e72660 JG |
57 | void lttng_inode_put(struct lttng_inode *inode); |
58 | ||
59 | #endif /* FD_TRACKER_INODE_H */ |