1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TRACEFS_INTERNAL_H
3 #define _TRACEFS_INTERNAL_H
6 TRACEFS_EVENT_INODE = BIT(1),
7 TRACEFS_EVENT_TOP_INODE = BIT(2),
8 TRACEFS_GID_PERM_SET = BIT(3),
9 TRACEFS_UID_PERM_SET = BIT(4),
10 TRACEFS_INSTANCE_INODE = BIT(5),
13 struct tracefs_inode {
16 struct inode vfs_inode;
20 * struct eventfs_attr - cache the mode and ownership of a eventfs entry
21 * @mode: saved mode plus flags of what is saved
22 * @uid: saved uid if changed
23 * @gid: saved gid if changed
32 * struct eventfs_inode - hold the properties of the eventfs directories.
33 * @list: link list into the parent directory
34 * @entries: the array of entries representing the files in the directory
35 * @name: the name of the directory to create
36 * @children: link list into the child eventfs_inode
37 * @dentry: the dentry of the directory
38 * @d_parent: pointer to the parent's dentry
39 * @d_children: The array of dentries to represent the files when created
40 * @entry_attrs: Saved mode and ownership of the @d_children
41 * @attr: Saved mode and ownership of eventfs_inode itself
42 * @data: The private data to pass to the callbacks
43 * @is_freed: Flag set if the eventfs is on its way to be freed
44 * Note if is_freed is set, then dentry is corrupted.
45 * @nr_entries: The number of items in @entries
47 struct eventfs_inode {
48 struct list_head list;
49 const struct eventfs_entry *entries;
51 struct list_head children;
52 struct dentry *dentry; /* Check is_freed to access */
53 struct dentry *d_parent;
54 struct dentry **d_children;
55 struct eventfs_attr *entry_attrs;
56 struct eventfs_attr attr;
59 * Union - used for deletion
60 * @llist: for calling dput() if needed after RCU
61 * @rcu: eventfs_inode to delete in RCU
64 struct llist_node llist;
67 unsigned int is_freed:1;
68 unsigned int is_events:1;
69 unsigned int nr_entries:30;
72 static inline struct tracefs_inode *get_tracefs(const struct inode *inode)
74 return container_of(inode, struct tracefs_inode, vfs_inode);
77 struct dentry *tracefs_start_creating(const char *name, struct dentry *parent);
78 struct dentry *tracefs_end_creating(struct dentry *dentry);
79 struct dentry *tracefs_failed_creating(struct dentry *dentry);
80 struct inode *tracefs_get_inode(struct super_block *sb);
81 struct dentry *eventfs_start_creating(const char *name, struct dentry *parent);
82 struct dentry *eventfs_failed_creating(struct dentry *dentry);
83 struct dentry *eventfs_end_creating(struct dentry *dentry);
84 void eventfs_update_gid(struct dentry *dentry, kgid_t gid);
85 void eventfs_set_ei_status_free(struct tracefs_inode *ti, struct dentry *dentry);
87 #endif /* _TRACEFS_INTERNAL_H */