2 * Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: GPL-2.0-only
8 #ifndef FD_TRACKER_INODE_H
9 #define FD_TRACKER_INODE_H
11 #include <common/compat/directory-handle.h>
15 struct lttng_inode_registry
;
16 struct lttng_unlinked_file_directory
;
17 struct lttng_directory_handle
;
20 * The unlinked file pool is protected by the fd-tracker's lock.
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
27 struct lttng_unlinked_file_pool
*lttng_unlinked_file_pool_create(
30 void lttng_unlinked_file_pool_destroy(
31 struct lttng_unlinked_file_pool
*pool
);
33 /* The inode registry is protected by the fd-tracker's lock. */
34 struct lttng_inode_registry
*lttng_inode_registry_create(void);
36 struct lttng_inode
*lttng_inode_registry_get_inode(
37 struct lttng_inode_registry
*registry
,
38 struct lttng_directory_handle
*handle
,
41 struct lttng_unlinked_file_pool
*pool
);
43 void lttng_inode_registry_destroy(struct lttng_inode_registry
*registry
);
45 void lttng_inode_borrow_location(struct lttng_inode
*inode
,
46 const struct lttng_directory_handle
**out_directory_handle
,
47 const char **out_path
);
49 /* Returns a new reference to the inode's location directory handle. */
50 struct lttng_directory_handle
*lttng_inode_get_location_directory_handle(
51 struct lttng_inode
*inode
);
53 int lttng_inode_rename(struct lttng_inode
*inode
,
54 struct lttng_directory_handle
*old_directory_handle
,
56 struct lttng_directory_handle
*new_directory_handle
,
60 int lttng_inode_unlink(struct lttng_inode
*inode
);
62 void lttng_inode_put(struct lttng_inode
*inode
);
64 #endif /* FD_TRACKER_INODE_H */