eventfs: Do not differentiate the toplevel events directory
[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 6 TRACEFS_EVENT_INODE = BIT(1),
d53891d3
SRG
7 TRACEFS_GID_PERM_SET = BIT(2),
8 TRACEFS_UID_PERM_SET = BIT(3),
9 TRACEFS_INSTANCE_INODE = BIT(4),
c1504e51
AK
10};
11
ba37ff75 12struct tracefs_inode {
baa23a8d
SRG
13 union {
14 struct inode vfs_inode;
15 struct rcu_head rcu;
16 };
d81786f5 17 /* The below gets initialized with memset_after(ti, 0, vfs_inode) */
baa23a8d 18 struct list_head list;
ba37ff75
AK
19 unsigned long flags;
20 void *private;
ba37ff75
AK
21};
22
28e12c09
SRG
23/*
24 * struct eventfs_attr - cache the mode and ownership of a eventfs entry
25 * @mode: saved mode plus flags of what is saved
26 * @uid: saved uid if changed
27 * @gid: saved gid if changed
28 */
29struct eventfs_attr {
30 int mode;
31 kuid_t uid;
32 kgid_t gid;
33};
34
5790b1fb
SRG
35/*
36 * struct eventfs_inode - hold the properties of the eventfs directories.
37 * @list: link list into the parent directory
264424df
SRG
38 * @rcu: Union with @list for freeing
39 * @children: link list into the child eventfs_inode
5790b1fb
SRG
40 * @entries: the array of entries representing the files in the directory
41 * @name: the name of the directory to create
28e12c09 42 * @entry_attrs: Saved mode and ownership of the @d_children
5790b1fb 43 * @data: The private data to pass to the callbacks
264424df 44 * @attr: Saved mode and ownership of eventfs_inode itself
f2f49637 45 * @is_freed: Flag set if the eventfs is on its way to be freed
77a06c33 46 * Note if is_freed is set, then dentry is corrupted.
264424df 47 * @is_events: Flag set for only the top level "events" directory
5790b1fb 48 * @nr_entries: The number of items in @entries
264424df 49 * @ino: The saved inode number
5790b1fb
SRG
50 */
51struct eventfs_inode {
264424df
SRG
52 union {
53 struct list_head list;
54 struct rcu_head rcu;
55 };
56 struct list_head children;
5790b1fb
SRG
57 const struct eventfs_entry *entries;
58 const char *name;
28e12c09 59 struct eventfs_attr *entry_attrs;
5790b1fb 60 void *data;
264424df
SRG
61 struct eventfs_attr attr;
62 struct kref kref;
834bf76a
SRG
63 unsigned int is_freed:1;
64 unsigned int is_events:1;
65 unsigned int nr_entries:30;
66 unsigned int ino;
5790b1fb
SRG
67};
68
ba37ff75
AK
69static inline struct tracefs_inode *get_tracefs(const struct inode *inode)
70{
71 return container_of(inode, struct tracefs_inode, vfs_inode);
72}
2c6b6b10
AK
73
74struct dentry *tracefs_start_creating(const char *name, struct dentry *parent);
75struct dentry *tracefs_end_creating(struct dentry *dentry);
76struct dentry *tracefs_failed_creating(struct dentry *dentry);
77struct inode *tracefs_get_inode(struct super_block *sb);
8dce06e9 78
baa23a8d 79void eventfs_remount(struct tracefs_inode *ti, bool update_uid, bool update_gid);
8dce06e9 80void eventfs_d_release(struct dentry *dentry);
63940449 81
ba37ff75 82#endif /* _TRACEFS_INTERNAL_H */