Commit | Line | Data |
---|---|---|
ba37ff75 AK |
1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifndef _TRACEFS_INTERNAL_H | |
3 | #define _TRACEFS_INTERNAL_H | |
4 | ||
c1504e51 | 5 | enum { |
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 | 13 | struct 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 | */ | |
26 | struct 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 | |
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 | |
28e12c09 SRG |
41 | * @entry_attrs: Saved mode and ownership of the @d_children |
42 | * @attr: Saved mode and ownership of eventfs_inode itself | |
5790b1fb | 43 | * @data: The private data to pass to the callbacks |
f2f49637 | 44 | * @is_freed: Flag set if the eventfs is on its way to be freed |
77a06c33 | 45 | * Note if is_freed is set, then dentry is corrupted. |
5790b1fb SRG |
46 | * @nr_entries: The number of items in @entries |
47 | */ | |
48 | struct eventfs_inode { | |
49 | struct list_head list; | |
50 | const struct eventfs_entry *entries; | |
51 | const char *name; | |
52 | struct list_head children; | |
77a06c33 | 53 | struct dentry *dentry; /* Check is_freed to access */ |
5790b1fb SRG |
54 | struct dentry *d_parent; |
55 | struct dentry **d_children; | |
28e12c09 SRG |
56 | struct eventfs_attr *entry_attrs; |
57 | struct eventfs_attr attr; | |
5790b1fb | 58 | void *data; |
834bf76a SRG |
59 | unsigned int is_freed:1; |
60 | unsigned int is_events:1; | |
61 | unsigned int nr_entries:30; | |
62 | unsigned int ino; | |
5790b1fb SRG |
63 | /* |
64 | * Union - used for deletion | |
020010fb | 65 | * @llist: for calling dput() if needed after RCU |
29e06c10 | 66 | * @rcu: eventfs_inode to delete in RCU |
5790b1fb SRG |
67 | */ |
68 | union { | |
020010fb | 69 | struct llist_node llist; |
5790b1fb | 70 | struct rcu_head rcu; |
5790b1fb | 71 | }; |
5790b1fb SRG |
72 | }; |
73 | ||
ba37ff75 AK |
74 | static inline struct tracefs_inode *get_tracefs(const struct inode *inode) |
75 | { | |
76 | return container_of(inode, struct tracefs_inode, vfs_inode); | |
77 | } | |
2c6b6b10 AK |
78 | |
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); | |
5790b1fb | 83 | void eventfs_set_ei_status_free(struct tracefs_inode *ti, struct dentry *dentry); |
63940449 | 84 | |
ba37ff75 | 85 | #endif /* _TRACEFS_INTERNAL_H */ |