~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/tracefs.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  *  tracefs.h - a pseudo file system for activating tracing
  4  *
  5  * Based on debugfs by: 2004 Greg Kroah-Hartman <greg@kroah.com>
  6  *
  7  *  Copyright (C) 2014 Red Hat Inc, author: Steven Rostedt <srostedt@redhat.com>
  8  *
  9  * tracefs is the file system that is used by the tracing infrastructure.
 10  */
 11 
 12 #ifndef _TRACEFS_H_
 13 #define _TRACEFS_H_
 14 
 15 #include <linux/fs.h>
 16 #include <linux/seq_file.h>
 17 
 18 #include <linux/types.h>
 19 
 20 struct file_operations;
 21 
 22 #ifdef CONFIG_TRACING
 23 
 24 struct eventfs_file;
 25 
 26 /**
 27  * eventfs_callback - A callback function to create dynamic files in eventfs
 28  * @name: The name of the file that is to be created
 29  * @mode: return the file mode for the file (RW access, etc)
 30  * @data: data to pass to the created file ops
 31  * @fops: the file operations of the created file
 32  *
 33  * The evetnfs files are dynamically created. The struct eventfs_entry array
 34  * is passed to eventfs_create_dir() or eventfs_create_events_dir() that will
 35  * be used to create the files within those directories. When a lookup
 36  * or access to a file within the directory is made, the struct eventfs_entry
 37  * array is used to find a callback() with the matching name that is being
 38  * referenced (for lookups, the entire array is iterated and each callback
 39  * will be called).
 40  *
 41  * The callback will be called with @name for the name of the file to create.
 42  * The callback can return less than 1 to indicate  that no file should be
 43  * created.
 44  *
 45  * If a file is to be created, then @mode should be populated with the file
 46  * mode (permissions) for which the file is created for. This would be
 47  * used to set the created inode i_mode field.
 48  *
 49  * The @data should be set to the data passed to the other file operations
 50  * (read, write, etc). Note, @data will also point to the data passed in
 51  * to eventfs_create_dir() or eventfs_create_events_dir(), but the callback
 52  * can replace the data if it chooses to. Otherwise, the original data
 53  * will be used for the file operation functions.
 54  *
 55  * The @fops should be set to the file operations that will be used to create
 56  * the inode.
 57  *
 58  * NB. This callback is called while holding internal locks of the eventfs
 59  *     system. The callback must not call any code that might also call into
 60  *     the tracefs or eventfs system or it will risk creating a deadlock.
 61  */
 62 typedef int (*eventfs_callback)(const char *name, umode_t *mode, void **data,
 63                                 const struct file_operations **fops);
 64 
 65 typedef void (*eventfs_release)(const char *name, void *data);
 66 
 67 /**
 68  * struct eventfs_entry - dynamically created eventfs file call back handler
 69  * @name:       Then name of the dynamic file in an eventfs directory
 70  * @callback:   The callback to get the fops of the file when it is created
 71  *
 72  * See evenfs_callback() typedef for how to set up @callback.
 73  */
 74 struct eventfs_entry {
 75         const char                      *name;
 76         eventfs_callback                callback;
 77         eventfs_release                 release;
 78 };
 79 
 80 struct eventfs_inode;
 81 
 82 struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry *parent,
 83                                                 const struct eventfs_entry *entries,
 84                                                 int size, void *data);
 85 
 86 struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode *parent,
 87                                          const struct eventfs_entry *entries,
 88                                          int size, void *data);
 89 
 90 void eventfs_remove_events_dir(struct eventfs_inode *ei);
 91 void eventfs_remove_dir(struct eventfs_inode *ei);
 92 
 93 struct dentry *tracefs_create_file(const char *name, umode_t mode,
 94                                    struct dentry *parent, void *data,
 95                                    const struct file_operations *fops);
 96 
 97 struct dentry *tracefs_create_dir(const char *name, struct dentry *parent);
 98 
 99 void tracefs_remove(struct dentry *dentry);
100 
101 struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent,
102                                            int (*mkdir)(const char *name),
103                                            int (*rmdir)(const char *name));
104 
105 bool tracefs_initialized(void);
106 
107 #endif /* CONFIG_TRACING */
108 
109 #endif
110 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php