fd-tracker: restore suspended handles from their inode's path
[lttng-tools.git] / src / common / fd-tracker / inode.h
CommitLineData
e0e72660 1/*
f7c3ffd7 2 * Copyright (C) 2020 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
e0e72660
JG
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18#ifndef FD_TRACKER_INODE_H
19#define FD_TRACKER_INODE_H
20
f7c3ffd7 21#include <common/compat/directory-handle.h>
e0e72660
JG
22#include <stdbool.h>
23
24struct lttng_inode;
25struct lttng_inode_registry;
f7c3ffd7
JG
26struct lttng_unlinked_file_directory;
27
28/*
29 * The unlinked file pool is protected by the fd-tracker's lock.
30 *
31 * NOTE: the unlinked file pool can use a single file desriptor when unlinked
32 * files are present in the pool. This file descriptor is not accounted-for
33 * by the fd-tracker. Users of the fd-tracker should account for this extra
34 * file descriptor.
35 */
36struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create(
37 const char *path);
38
39void lttng_unlinked_file_pool_destroy(
40 struct lttng_unlinked_file_pool *pool);
e0e72660
JG
41
42/* The inode registry is protected by the fd-tracker's lock. */
43struct lttng_inode_registry *lttng_inode_registry_create(void);
44
45struct lttng_inode *lttng_inode_registry_get_inode(
5c1f54d1 46 struct lttng_inode_registry *registry,
f7c3ffd7
JG
47 struct lttng_directory_handle *handle,
48 const char *path,
5c1f54d1 49 int fd,
f7c3ffd7 50 struct lttng_unlinked_file_pool *pool);
e0e72660
JG
51
52void lttng_inode_registry_destroy(struct lttng_inode_registry *registry);
53
f7c3ffd7
JG
54void lttng_inode_get_location(struct lttng_inode *inode,
55 const struct lttng_directory_handle **out_directory_handle,
56 const char **out_path);
57
5c1f54d1 58int lttng_inode_rename(struct lttng_inode *inode,
f7c3ffd7
JG
59 struct lttng_directory_handle *old_directory_handle,
60 const char *old_path,
61 struct lttng_directory_handle *new_directory_handle,
5c1f54d1 62 const char *new_path,
e0e72660 63 bool overwrite);
f7c3ffd7
JG
64
65int lttng_inode_unlink(struct lttng_inode *inode);
66
e0e72660
JG
67void lttng_inode_put(struct lttng_inode *inode);
68
69#endif /* FD_TRACKER_INODE_H */
This page took 0.025518 seconds and 4 git commands to generate.