Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159308381
D57524.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D57524.diff
View Options
diff --git a/sys/compat/lindebugfs/lindebugfs.c b/sys/compat/lindebugfs/lindebugfs.c
--- a/sys/compat/lindebugfs/lindebugfs.c
+++ b/sys/compat/lindebugfs/lindebugfs.c
@@ -70,6 +70,7 @@
#include <linux/compat.h>
#include <linux/debugfs.h>
#include <linux/fs.h>
+#include <linux/device.h>
MALLOC_DEFINE(M_DFSINT, "debugfsint", "Linux debugfs internal");
@@ -807,6 +808,47 @@
return (debugfs_create_file(name, mode & 0444, parent, value, &__fops_blob_ro));
}
+/* ---------------------------------------------------------------------------- */
+/* This should be migrated to ??? */
+
+struct debugfs_devm_seqfile {
+ struct device *dev;
+ int (*readfunc)(struct seq_file *, void *);
+};
+
+static int
+debugfs_devm_seqfile_open(struct inode *inode, struct linux_file *f)
+{
+ struct debugfs_devm_seqfile *s;
+
+ s = inode->i_private;
+ return (single_open(f, s->readfunc, s->dev));
+}
+
+static const struct file_operations debugfs_devm_seqfile_ops = {
+ .owner = THIS_MODULE,
+ .open = debugfs_devm_seqfile_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+void
+debugfs_create_devm_seqfile(struct device *dev, const char *name,
+ struct dentry *d, int (*readfunc)(struct seq_file *m, void *arg))
+{
+ struct debugfs_devm_seqfile *s;
+
+ s = devm_kzalloc(dev, sizeof(*s), GFP_KERNEL);
+ if (s == NULL)
+ return;
+
+ s->dev = dev;
+ s->readfunc = readfunc;
+
+ debugfs_create_file(name, 0444, d, s, &debugfs_devm_seqfile_ops);
+}
+/* ---------------------------------------------------------------------------- */
static int
lindebugfs_init(PFS_INIT_ARGS)
diff --git a/sys/compat/linuxkpi/common/include/linux/debugfs.h b/sys/compat/linuxkpi/common/include/linux/debugfs.h
--- a/sys/compat/linuxkpi/common/include/linux/debugfs.h
+++ b/sys/compat/linuxkpi/common/include/linux/debugfs.h
@@ -121,4 +121,9 @@
struct dentry *debugfs_create_blob(const char *name, umode_t mode,
struct dentry *parent, struct debugfs_blob_wrapper *value);
+struct device;
+struct dentry;
+void debugfs_create_devm_seqfile(struct device *, const char *, struct dentry *,
+ int (*)(struct seq_file *, void *));
+
#endif /* _LINUXKPI_LINUX_DEBUGFS_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jun 13, 5:22 PM (4 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33928239
Default Alt Text
D57524.diff (2 KB)
Attached To
Mode
D57524: lindebugfs: implement debugfs_create_devm_seqfile()
Attached
Detach File
Event Timeline
Log In to Comment