xref: /linux/include/linux/tracefs.h (revision 5790b1fb3d672d9a1fe3881a7181dfdbe741568f)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
24282d606SSteven Rostedt (Red Hat) /*
34282d606SSteven Rostedt (Red Hat)  *  tracefs.h - a pseudo file system for activating tracing
44282d606SSteven Rostedt (Red Hat)  *
54282d606SSteven Rostedt (Red Hat)  * Based on debugfs by: 2004 Greg Kroah-Hartman <greg@kroah.com>
64282d606SSteven Rostedt (Red Hat)  *
74282d606SSteven Rostedt (Red Hat)  *  Copyright (C) 2014 Red Hat Inc, author: Steven Rostedt <srostedt@redhat.com>
84282d606SSteven Rostedt (Red Hat)  *
94282d606SSteven Rostedt (Red Hat)  * tracefs is the file system that is used by the tracing infrastructure.
104282d606SSteven Rostedt (Red Hat)  */
114282d606SSteven Rostedt (Red Hat) 
124282d606SSteven Rostedt (Red Hat) #ifndef _TRACEFS_H_
134282d606SSteven Rostedt (Red Hat) #define _TRACEFS_H_
144282d606SSteven Rostedt (Red Hat) 
154282d606SSteven Rostedt (Red Hat) #include <linux/fs.h>
164282d606SSteven Rostedt (Red Hat) #include <linux/seq_file.h>
174282d606SSteven Rostedt (Red Hat) 
184282d606SSteven Rostedt (Red Hat) #include <linux/types.h>
194282d606SSteven Rostedt (Red Hat) 
204282d606SSteven Rostedt (Red Hat) struct file_operations;
214282d606SSteven Rostedt (Red Hat) 
224282d606SSteven Rostedt (Red Hat) #ifdef CONFIG_TRACING
234282d606SSteven Rostedt (Red Hat) 
24c1504e51SAjay Kaher struct eventfs_file;
25c1504e51SAjay Kaher 
26*5790b1fbSSteven Rostedt (Google) typedef int (*eventfs_callback)(const char *name, umode_t *mode, void **data,
27*5790b1fbSSteven Rostedt (Google) 				const struct file_operations **fops);
28c1504e51SAjay Kaher 
29*5790b1fbSSteven Rostedt (Google) struct eventfs_entry {
30*5790b1fbSSteven Rostedt (Google) 	const char			*name;
31*5790b1fbSSteven Rostedt (Google) 	eventfs_callback		callback;
32*5790b1fbSSteven Rostedt (Google) };
33c1504e51SAjay Kaher 
34*5790b1fbSSteven Rostedt (Google) struct eventfs_inode;
35c1504e51SAjay Kaher 
36*5790b1fbSSteven Rostedt (Google) struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry *parent,
37*5790b1fbSSteven Rostedt (Google) 						const struct eventfs_entry *entries,
38*5790b1fbSSteven Rostedt (Google) 						int size, void *data);
3988f349b4SAjay Kaher 
40*5790b1fbSSteven Rostedt (Google) struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode *parent,
41*5790b1fbSSteven Rostedt (Google) 					 const struct eventfs_entry *entries,
42*5790b1fbSSteven Rostedt (Google) 					 int size, void *data);
4388f349b4SAjay Kaher 
44*5790b1fbSSteven Rostedt (Google) void eventfs_remove_dir(struct eventfs_inode *ei);
455bdcd5f5SAjay Kaher 
464282d606SSteven Rostedt (Red Hat) struct dentry *tracefs_create_file(const char *name, umode_t mode,
474282d606SSteven Rostedt (Red Hat) 				   struct dentry *parent, void *data,
484282d606SSteven Rostedt (Red Hat) 				   const struct file_operations *fops);
494282d606SSteven Rostedt (Red Hat) 
504282d606SSteven Rostedt (Red Hat) struct dentry *tracefs_create_dir(const char *name, struct dentry *parent);
514282d606SSteven Rostedt (Red Hat) 
524282d606SSteven Rostedt (Red Hat) void tracefs_remove(struct dentry *dentry);
534282d606SSteven Rostedt (Red Hat) 
54eae47358SSteven Rostedt (Red Hat) struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent,
55eae47358SSteven Rostedt (Red Hat) 					   int (*mkdir)(const char *name),
56eae47358SSteven Rostedt (Red Hat) 					   int (*rmdir)(const char *name));
57eae47358SSteven Rostedt (Red Hat) 
584282d606SSteven Rostedt (Red Hat) bool tracefs_initialized(void);
594282d606SSteven Rostedt (Red Hat) 
604282d606SSteven Rostedt (Red Hat) #endif /* CONFIG_TRACING */
614282d606SSteven Rostedt (Red Hat) 
624282d606SSteven Rostedt (Red Hat) #endif
63