summaryrefslogtreecommitdiffstats
path: root/include/linux/tracefs.h
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2015-01-21 10:01:39 -0500
committerSteven Rostedt <rostedt@goodmis.org>2015-02-03 12:48:43 -0500
commiteae473581cf93dad94ca833aa961c033c6a43924 (patch)
treeea0a8bbf8a30940b497dad43a858be8d1b5efb26 /include/linux/tracefs.h
parentcc31004a4aa784d89054ec07b87eae05cecf7121 (diff)
downloadtalos-obmc-linux-eae473581cf93dad94ca833aa961c033c6a43924.tar.gz
talos-obmc-linux-eae473581cf93dad94ca833aa961c033c6a43924.zip
tracing: Have mkdir and rmdir be part of tracefs
The tracing "instances" directory can create sub tracing buffers with mkdir, and remove them with rmdir. As a mkdir will also create all the files and directories that control the sub buffer the inode mutexes need to be released before this is done, to avoid deadlocks. It is better to let the tracing system unlock the inode mutexes before calling the functions that create the files within the new directory (or deletes the files from the one being destroyed). Now that tracing has been converted over to tracefs, the tracefs file system can be modified to accommodate this feature. It still releases the locks, but the filesystem itself can take care of the ugly business and let the user just do what it needs. The tracing system now attaches a descriptor to the directory dentry that can have userspace create or remove sub directories. If this descriptor does not exist for a dentry, then that dentry can not be used to create other directories. This descriptor holds a mkdir and rmdir method that only takes a character string as an argument. The tracefs file system will first make a copy of the dentry name before releasing the locks. Then it will pass the copied name to the methods. It is up to the tracing system that supplied the methods to handle races with duplicate names and such as all the inode mutexes would be released when the functions are called. Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/tracefs.h')
-rw-r--r--include/linux/tracefs.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/tracefs.h b/include/linux/tracefs.h
index 23e04ce21749..5b727a17beee 100644
--- a/include/linux/tracefs.h
+++ b/include/linux/tracefs.h
@@ -34,6 +34,10 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent);
void tracefs_remove(struct dentry *dentry);
void tracefs_remove_recursive(struct dentry *dentry);
+struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent,
+ int (*mkdir)(const char *name),
+ int (*rmdir)(const char *name));
+
bool tracefs_initialized(void);
#endif /* CONFIG_TRACING */
OpenPOWER on IntegriCloud