From: Roman Pen <r.peniaev@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Roman Pen <r.peniaev@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 3/3] debugfs: update some bits of documentation
Date: Tue, 8 Dec 2015 10:51:06 +0100 [thread overview]
Message-ID: <1449568266-17404-4-git-send-email-r.peniaev@gmail.com> (raw)
In-Reply-To: <1449568266-17404-1-git-send-email-r.peniaev@gmail.com>
Include description of 'debugfs_create_dir_with_tmpfiles()' call.
Signed-off-by: Roman Pen <r.peniaev@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org
---
Documentation/filesystems/debugfs.txt | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/Documentation/filesystems/debugfs.txt b/Documentation/filesystems/debugfs.txt
index 4f45f71..150fabf 100644
--- a/Documentation/filesystems/debugfs.txt
+++ b/Documentation/filesystems/debugfs.txt
@@ -36,6 +36,31 @@ wrong. If ERR_PTR(-ENODEV) is returned, that is an indication that the
kernel has been built without debugfs support and none of the functions
described below will work.
+Another way to create a directory where temporary files will be created
+on demand is:
+
+ struct dentry *debugfs_create_dir_with_tmpfiles(const char *name,
+ umode_t mode, struct dentry *parent, void *data,
+ const struct file_operations *fops);
+
+This function creates a directory in debugfs with the given name with
+possibility to create temporary files on demand. Any attempt to open
+a non-existent file in that directory will create a temporary file,
+wich will be deleted when the last file descriptor is closed. This
+temporary file is very similar to opening a directory with O_TMPFILE,
+with the difference that a resulting dentry has a name, but still is
+unhashed, so is invisible to outer world and can never be reached via
+any pathname.
+
+How those temporary files on demand can be used? This is a way to provide
+one additional parameter in a file name and specify an object name. E.g.:
+
+ # cat /sys/kernel/debug/my_objects/$UUID
+
+Where $UUID is a UUID of an object which should be requested. This $UUID
+file will never appear in lookup and will be deleted when 'cat' closes last
+file descriptor.
+
The most general way to create a file within a debugfs directory is with:
struct dentry *debugfs_create_file(const char *name, umode_t mode,
--
2.6.2
next prev parent reply other threads:[~2015-12-08 9:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-08 9:51 [RFC PATCH 0/3] debugfs: implement 'debugfs_create_dir_with_tmpfiles()' Roman Pen
2015-12-08 9:51 ` [RFC PATCH 1/3] debugfs: make create directory logic more generic Roman Pen
2015-12-08 9:51 ` [RFC PATCH 2/3] debugfs: implement 'debugfs_create_dir_with_tmpfiles()' Roman Pen
2015-12-08 9:51 ` Roman Pen [this message]
2015-12-08 11:49 ` [RFC PATCH 0/3] " Greg Kroah-Hartman
2015-12-09 20:06 ` Roman Peniaev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449568266-17404-4-git-send-email-r.peniaev@gmail.com \
--to=r.peniaev@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome