Merge tag 'mm-hotfixes-stable-2024-03-07-16-17' of git://git.kernel.org/pub/scm/linux...
[linux-2.6-block.git] / fs / tracefs / internal.h
CommitLineData
ba37ff75
AK
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _TRACEFS_INTERNAL_H
3#define _TRACEFS_INTERNAL_H
4
c1504e51 5enum {
9879e5e1
SRG
6 TRACEFS_EVENT_INODE = BIT(1),
7 TRACEFS_EVENT_TOP_INODE = BIT(2),
8186fff7
SRG
8 TRACEFS_GID_PERM_SET = BIT(3),
9 TRACEFS_UID_PERM_SET = BIT(4),
10 TRACEFS_INSTANCE_INODE = BIT(5),
c1504e51
AK
11};
12
ba37ff75 13struct tracefs_inode {
d81786f5
SRG
14 struct inode vfs_inode;
15 /* The below gets initialized with memset_after(ti, 0, vfs_inode) */
ba37ff75
AK
16 unsigned long flags;
17 void *private;
ba37ff75
AK
18};
19
28e12c09
SRG
20/*
21 * struct eventfs_attr - cache the mode and ownership of a eventfs entry
22 * @mode: saved mode plus flags of what is saved
23 * @uid: saved uid if changed
24 * @gid: saved gid if changed
25 */
26struct eventfs_attr {
27 int mode;
28 kuid_t uid;
29 kgid_t gid;
30};
31
5790b1fb
SRG
32/*
33 * struct eventfs_inode - hold the properties of the eventfs directories.
34 * @list: link list into the parent directory
264424df
SRG
35 * @rcu: Union with @list for freeing
36 * @children: link list into the child eventfs_inode
5790b1fb
SRG
37 * @entries: the array of entries representing the files in the directory
38 * @name: the name of the directory to create
43aa6f97 39 * @events_dir: the dentry of the events directory
28e12c09 40 * @entry_attrs: Saved mode and ownership of the @d_children
5790b1fb 41 * @data: The private data to pass to the callbacks
264424df 42 * @attr: Saved mode and ownership of eventfs_inode itself
f2f49637 43 * @is_freed: Flag set if the eventfs is on its way to be freed
77a06c33 44 * Note if is_freed is set, then dentry is corrupted.
264424df 45 * @is_events: Flag set for only the top level "events" directory
5790b1fb 46 * @nr_entries: The number of items in @entries
264424df 47 * @ino: The saved inode number
5790b1fb
SRG
48 */
49struct eventfs_inode {
264424df
SRG
50 union {
51 struct list_head list;
52 struct rcu_head rcu;
53 };
54 struct list_head children;
5790b1fb
SRG
55 const struct eventfs_entry *entries;
56 const char *name;
43aa6f97 57 struct dentry *events_dir;
28e12c09 58 struct eventfs_attr *entry_attrs;
5790b1fb 59 void *data;
264424df
SRG
60 struct eventfs_attr attr;
61 struct kref kref;
834bf76a
SRG
62 unsigned int is_freed:1;
63 unsigned int is_events:1;
64 unsigned int nr_entries:30;
65 unsigned int ino;
5790b1fb
SRG
66};
67
ba37ff75
AK
68static inline struct tracefs_inode *get_tracefs(const struct inode *inode)
69{
70 return container_of(inode, struct tracefs_inode, vfs_inode);
71}
2c6b6b10
AK
72
73struct dentry *tracefs_start_creating(const char *name, struct dentry *parent);
74struct dentry *tracefs_end_creating(struct dentry *dentry);
75struct dentry *tracefs_failed_creating(struct dentry *dentry);
76struct inode *tracefs_get_inode(struct super_block *sb);
8dce06e9
LT
77
78void eventfs_d_release(struct dentry *dentry);
63940449 79
ba37ff75 80#endif /* _TRACEFS_INTERNAL_H */