lkml.org 
[lkml]   [2019]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] notifier-error-inject: use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops
Date
It is more clearly to use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs file
operation rather than DEFINE_SIMPLE_ATTRIBUTE.

Meanwhile, debugfs_create_file() in debugfs_create_errno() can be replaced
by debugfs_create_file_unsafe().

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
lib/notifier-error-inject.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/notifier-error-inject.c b/lib/notifier-error-inject.c
index 21016b3..e5302f7 100644
--- a/lib/notifier-error-inject.c
+++ b/lib/notifier-error-inject.c
@@ -15,13 +15,13 @@ static int debugfs_errno_get(void *data, u64 *val)
return 0;
}

-DEFINE_SIMPLE_ATTRIBUTE(fops_errno, debugfs_errno_get, debugfs_errno_set,
+DEFINE_DEBUGFS_ATTRIBUTE(fops_errno, debugfs_errno_get, debugfs_errno_set,
"%lld\n");

static struct dentry *debugfs_create_errno(const char *name, umode_t mode,
struct dentry *parent, int *value)
{
- return debugfs_create_file(name, mode, parent, value, &fops_errno);
+ return debugfs_create_file_unsafe(name, mode, parent, value, &fops_errno);
}

static int notifier_err_inject_callback(struct notifier_block *nb,
--
1.7.12.4
\
 
 \ /
  Last update: 2019-10-31 13:47    [W:0.032 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site