[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250619031536.19352-1-ankitchauhan2065@gmail.com>
Date: Thu, 19 Jun 2025 08:45:36 +0530
From: Ankit Chauhan <ankitchauhan2065@...il.com>
To: code@...icks.com,
brauner@...nel.org,
sandeen@...hat.com,
colin.i.king@...il.com
Cc: ecryptfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
Ankit Chauhan <ankitchauhan2065@...il.com>
Subject: [PATCH] fs/ecryptfs: replace snprintf with sysfs_emit in show function
Use sysfs_emit() instead of snprintf() in version_show() function to
follow the preferred kernel API.
Signed-off-by: Ankit Chauhan <ankitchauhan2065@...il.com>
---
fs/ecryptfs/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 8dd1d7189c3b..0db21e592fe7 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -20,6 +20,7 @@
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
#include <linux/fs_stack.h>
+#include <linux/sysfs.h>
#include <linux/slab.h>
#include <linux/magic.h>
#include "ecryptfs_kernel.h"
@@ -764,7 +765,7 @@ static struct kobject *ecryptfs_kobj;
static ssize_t version_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buff)
{
- return snprintf(buff, PAGE_SIZE, "%d\n", ECRYPTFS_VERSIONING_MASK);
+ return sysfs_emit(buff, "%d\n", ECRYPTFS_VERSIONING_MASK);
}
static struct kobj_attribute version_attr = __ATTR_RO(version);
--
2.34.1
Powered by blists - more mailing lists