common: Add a default nullptr argument to make_unique_wrapper
[lttng-tools.git] / src / common / fd-tracker / inode.hpp
CommitLineData
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
c9e313bc 11#include <common/compat/directory-handle.hpp>
28f23191 12
e0e72660
JG
13#include <stdbool.h>
14
15struct lttng_inode;
16struct lttng_inode_registry;
f7c3ffd7 17struct lttng_unlinked_file_directory;
dd95933f 18struct lttng_directory_handle;
f7c3ffd7
JG
19
20/*
21 * The unlinked file pool is protected by the fd-tracker's lock.
22 *
23 * NOTE: the unlinked file pool can use a single file desriptor when unlinked
24 * files are present in the pool. This file descriptor is not accounted-for
25 * by the fd-tracker. Users of the fd-tracker should account for this extra
26 * file descriptor.
27 */
28f23191 28struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create(const char *path);
f7c3ffd7 29
28f23191 30void lttng_unlinked_file_pool_destroy(struct lttng_unlinked_file_pool *pool);
e0e72660
JG
31
32/* The inode registry is protected by the fd-tracker's lock. */
33struct lttng_inode_registry *lttng_inode_registry_create(void);
34
28f23191
JG
35struct lttng_inode *lttng_inode_registry_get_inode(struct lttng_inode_registry *registry,
36 struct lttng_directory_handle *handle,
37 const char *path,
38 int fd,
39 struct lttng_unlinked_file_pool *pool);
e0e72660
JG
40
41void lttng_inode_registry_destroy(struct lttng_inode_registry *registry);
42
dd95933f 43void lttng_inode_borrow_location(struct lttng_inode *inode,
28f23191
JG
44 const struct lttng_directory_handle **out_directory_handle,
45 const char **out_path);
f7c3ffd7 46
dd95933f 47/* Returns a new reference to the inode's location directory handle. */
28f23191 48struct lttng_directory_handle *lttng_inode_get_location_directory_handle(struct lttng_inode *inode);
dd95933f 49
5c1f54d1 50int lttng_inode_rename(struct lttng_inode *inode,
28f23191
JG
51 struct lttng_directory_handle *old_directory_handle,
52 const char *old_path,
53 struct lttng_directory_handle *new_directory_handle,
54 const char *new_path,
55 bool overwrite);
f7c3ffd7
JG
56
57int lttng_inode_unlink(struct lttng_inode *inode);
58
e0e72660
JG
59void lttng_inode_put(struct lttng_inode *inode);
60
61#endif /* FD_TRACKER_INODE_H */
This page took 0.054514 seconds and 4 git commands to generate.