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@gmail.com>
Link: https://lore.kernel.org/20250619031536.19352-1-ankitchauhan2065@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Ankit Chauhan 2025-06-19 08:45:36 +05:30 committed by Christian Brauner
parent 2b7c9664c3
commit 06a705356d
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
1 changed files with 2 additions and 1 deletions

View File

@ -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);