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 | 16 | struct lttng_unlinked_file_directory; |
dd95933f | 17 | struct lttng_directory_handle; |
f7c3ffd7 JG |
18 | |
19 | /* | |
20 | * The unlinked file pool is protected by the fd-tracker's lock. | |
21 | * | |
22 | * NOTE: the unlinked file pool can use a single file desriptor when unlinked | |
23 | * files are present in the pool. This file descriptor is not accounted-for | |
24 | * by the fd-tracker. Users of the fd-tracker should account for this extra | |
25 | * file descriptor. | |
26 | */ | |
9792ace3 | 27 | LTTNG_HIDDEN |
f7c3ffd7 JG |
28 | struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create( |
29 | const char *path); | |
30 | ||
9792ace3 | 31 | LTTNG_HIDDEN |
f7c3ffd7 JG |
32 | void lttng_unlinked_file_pool_destroy( |
33 | struct lttng_unlinked_file_pool *pool); | |
e0e72660 JG |
34 | |
35 | /* The inode registry is protected by the fd-tracker's lock. */ | |
9792ace3 | 36 | LTTNG_HIDDEN |
e0e72660 JG |
37 | struct lttng_inode_registry *lttng_inode_registry_create(void); |
38 | ||
9792ace3 | 39 | LTTNG_HIDDEN |
e0e72660 | 40 | struct lttng_inode *lttng_inode_registry_get_inode( |
5c1f54d1 | 41 | struct lttng_inode_registry *registry, |
f7c3ffd7 JG |
42 | struct lttng_directory_handle *handle, |
43 | const char *path, | |
5c1f54d1 | 44 | int fd, |
f7c3ffd7 | 45 | struct lttng_unlinked_file_pool *pool); |
e0e72660 | 46 | |
9792ace3 | 47 | LTTNG_HIDDEN |
e0e72660 JG |
48 | void lttng_inode_registry_destroy(struct lttng_inode_registry *registry); |
49 | ||
9792ace3 | 50 | LTTNG_HIDDEN |
dd95933f | 51 | void lttng_inode_borrow_location(struct lttng_inode *inode, |
f7c3ffd7 JG |
52 | const struct lttng_directory_handle **out_directory_handle, |
53 | const char **out_path); | |
54 | ||
dd95933f | 55 | /* Returns a new reference to the inode's location directory handle. */ |
9792ace3 | 56 | LTTNG_HIDDEN |
dd95933f JG |
57 | struct lttng_directory_handle *lttng_inode_get_location_directory_handle( |
58 | struct lttng_inode *inode); | |
59 | ||
9792ace3 | 60 | LTTNG_HIDDEN |
5c1f54d1 | 61 | int lttng_inode_rename(struct lttng_inode *inode, |
f7c3ffd7 JG |
62 | struct lttng_directory_handle *old_directory_handle, |
63 | const char *old_path, | |
64 | struct lttng_directory_handle *new_directory_handle, | |
5c1f54d1 | 65 | const char *new_path, |
e0e72660 | 66 | bool overwrite); |
f7c3ffd7 | 67 | |
9792ace3 | 68 | LTTNG_HIDDEN |
f7c3ffd7 JG |
69 | int lttng_inode_unlink(struct lttng_inode *inode); |
70 | ||
9792ace3 | 71 | LTTNG_HIDDEN |
e0e72660 JG |
72 | void lttng_inode_put(struct lttng_inode *inode); |
73 | ||
74 | #endif /* FD_TRACKER_INODE_H */ |