From: Anish Mulay <anishm7030@gmail.com>
To: aahringo@redhat.com, teigland@redhat.com
Cc: gfs2@lists.linux.dev, linux-kernel@vger.kernel.org,
Anish Mulay <anishm7030@gmail.com>
Subject: [PATCH] fs: dlm: use sysfs_emit() instead of snprintf()
Date: Sun, 8 Feb 2026 17:12:15 -0500 [thread overview]
Message-ID: <20260208221215.205864-1-anishm7030@gmail.com> (raw)
Follow the advice in Documentation/filesystems/sysfs.rst:
show() should only use sysfs_emit() or sysfs_emit_at() when formatting
the value to be returned to user space.
This patch replaces snprintf() with sysfs_emit() in the lockspace
show functions.
Signed-off-by: Anish Mulay <anishm7030@gmail.com>
---
fs/dlm/lockspace.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index ddaa76558706..23975bb394eb 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -69,7 +69,7 @@ static ssize_t dlm_event_store(struct dlm_ls *ls, const char *buf, size_t len)
static ssize_t dlm_id_show(struct dlm_ls *ls, char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%u\n", ls->ls_global_id);
+ return sysfs_emit(buf, "%u\n", ls->ls_global_id);
}
static ssize_t dlm_id_store(struct dlm_ls *ls, const char *buf, size_t len)
@@ -83,7 +83,7 @@ static ssize_t dlm_id_store(struct dlm_ls *ls, const char *buf, size_t len)
static ssize_t dlm_nodir_show(struct dlm_ls *ls, char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%u\n", dlm_no_directory(ls));
+ return sysfs_emit(buf, "%u\n", dlm_no_directory(ls));
}
static ssize_t dlm_nodir_store(struct dlm_ls *ls, const char *buf, size_t len)
@@ -101,12 +101,12 @@ static ssize_t dlm_nodir_store(struct dlm_ls *ls, const char *buf, size_t len)
static ssize_t dlm_recover_status_show(struct dlm_ls *ls, char *buf)
{
uint32_t status = dlm_recover_status(ls);
- return snprintf(buf, PAGE_SIZE, "%x\n", status);
+ return sysfs_emit(buf, "%x\n", status);
}
static ssize_t dlm_recover_nodeid_show(struct dlm_ls *ls, char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%d\n", ls->ls_recover_nodeid);
+ return sysfs_emit(buf, "%d\n", ls->ls_recover_nodeid);
}
struct dlm_attr {
--
2.43.0
reply other threads:[~2026-02-08 22:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260208221215.205864-1-anishm7030@gmail.com \
--to=anishm7030@gmail.com \
--cc=aahringo@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=teigland@redhat.com \
/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
all inboxes | Powered by JetHome®