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 {
14 struct inode vfs_inode;
15 /* The below gets initialized with memset_after(ti, 0, vfs_inode) */
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
33 * struct eventfs_inode - hold the properties of the eventfs directories.
34 * @list: link list into the parent directory
35 * @entries: the array of entries representing the files in the directory
36 * @name: the name of the directory to create
37 * @children: link list into the child eventfs_inode
38 * @dentry: the dentry of the directory
39 * @d_parent: pointer to the parent's dentry
40 * @d_children: The array of dentries to represent the files when created
41 * @entry_attrs: Saved mode and ownership of the @d_children
42 * @attr: Saved mode and ownership of eventfs_inode itself
43 * @data: The private data to pass to the callbacks
44 * @is_freed: Flag set if the eventfs is on its way to be freed
45 * Note if is_freed is set, then dentry is corrupted.
46 * @nr_entries: The number of items in @entries
48 struct eventfs_inode {
49 struct list_head list;
50 const struct eventfs_entry *entries;
52 struct list_head children;
53 struct dentry *dentry; /* Check is_freed to access */
54 struct dentry *d_parent;
55 struct dentry **d_children;
56 struct eventfs_attr *entry_attrs;
57 struct eventfs_attr attr;
59 unsigned int is_freed:1;
60 unsigned int is_events:1;
61 unsigned int nr_entries:30;
64 * Union - used for deletion
65 * @llist: for calling dput() if needed after RCU
66 * @rcu: eventfs_inode to delete in RCU
69 struct llist_node llist;
74 static inline struct tracefs_inode *get_tracefs(const struct inode *inode)
76 return container_of(inode, struct tracefs_inode, vfs_inode);
79 struct dentry *tracefs_start_creating(const char *name, struct dentry *parent);
80 struct dentry *tracefs_end_creating(struct dentry *dentry);
81 struct dentry *tracefs_failed_creating(struct dentry *dentry);
82 struct inode *tracefs_get_inode(struct super_block *sb);
83 struct dentry *eventfs_start_creating(const char *name, struct dentry *parent);
84 struct dentry *eventfs_failed_creating(struct dentry *dentry);
85 struct dentry *eventfs_end_creating(struct dentry *dentry);
86 void eventfs_set_ei_status_free(struct tracefs_inode *ti, struct dentry *dentry);
88 #endif /* _TRACEFS_INTERNAL_H */