* Re: [PATCH v2] fs: orangefs: replace scnprintf() with sysfs_emit()
[not found] ` <CAPRMd3kM8Eaf64vdMd+43cuV-QTBca9Zxm+Ou4S-DFCY5ovDBQ@mail.gmail.com>
@ 2025-07-01 15:23 ` Mike Marshall
0 siblings, 0 replies; only message in thread
From: Mike Marshall @ 2025-07-01 15:23 UTC (permalink / raw)
To: Shankari Anand; +Cc: devel, linux-fsdevel, Mike Marshall
I have it xfstested and plan to upload it along with a couple of other
patches to my linux-next tree soon...
Thanks!
-Mike
On Tue, Jul 1, 2025 at 2:13 AM Shankari Anand <shankari.ak0208@gmail.com> wrote:
>
> Hello, can this patch be picked for review?
>
> On Tue, Jun 24, 2025 at 8:56 PM Shankari Anand
> <shankari.ak0208@gmail.com> wrote:
> >
> > Documentation/filesystems/sysfs.rst mentions that show() should only
> > use sysfs_emit() or sysfs_emit_at() when formating the value to be
> > returned to user space. So replace scnprintf() with sysfs_emit().
> >
> > Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
> > ---
> > v1 -> v2: Fix minor parameter error
> > ---
> > fs/orangefs/orangefs-sysfs.c | 28 ++++++++++------------------
> > 1 file changed, 10 insertions(+), 18 deletions(-)
> >
> > diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c
> > index 04e15dfa504a..b89e516f9bdc 100644
> > --- a/fs/orangefs/orangefs-sysfs.c
> > +++ b/fs/orangefs/orangefs-sysfs.c
> > @@ -217,36 +217,31 @@ static ssize_t sysfs_int_show(struct kobject *kobj,
> >
> > if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) {
> > if (!strcmp(attr->attr.name, "op_timeout_secs")) {
> > - rc = scnprintf(buf,
> > - PAGE_SIZE,
> > + rc = sysfs_emit(buf,
> > "%d\n",
> > op_timeout_secs);
> > goto out;
> > } else if (!strcmp(attr->attr.name,
> > "slot_timeout_secs")) {
> > - rc = scnprintf(buf,
> > - PAGE_SIZE,
> > + rc = sysfs_emit(buf,
> > "%d\n",
> > slot_timeout_secs);
> > goto out;
> > } else if (!strcmp(attr->attr.name,
> > "cache_timeout_msecs")) {
> > - rc = scnprintf(buf,
> > - PAGE_SIZE,
> > + rc = sysfs_emit(buf,
> > "%d\n",
> > orangefs_cache_timeout_msecs);
> > goto out;
> > } else if (!strcmp(attr->attr.name,
> > "dcache_timeout_msecs")) {
> > - rc = scnprintf(buf,
> > - PAGE_SIZE,
> > + rc = sysfs_emit(buf,
> > "%d\n",
> > orangefs_dcache_timeout_msecs);
> > goto out;
> > } else if (!strcmp(attr->attr.name,
> > "getattr_timeout_msecs")) {
> > - rc = scnprintf(buf,
> > - PAGE_SIZE,
> > + rc = sysfs_emit(buf,
> > "%d\n",
> > orangefs_getattr_timeout_msecs);
> > goto out;
> > @@ -256,14 +251,12 @@ static ssize_t sysfs_int_show(struct kobject *kobj,
> >
> > } else if (!strcmp(kobj->name, STATS_KOBJ_ID)) {
> > if (!strcmp(attr->attr.name, "reads")) {
> > - rc = scnprintf(buf,
> > - PAGE_SIZE,
> > + rc = sysfs_emit(buf,
> > "%lu\n",
> > orangefs_stats.reads);
> > goto out;
> > } else if (!strcmp(attr->attr.name, "writes")) {
> > - rc = scnprintf(buf,
> > - PAGE_SIZE,
> > + rc = sysfs_emit(buf,
> > "%lu\n",
> > orangefs_stats.writes);
> > goto out;
> > @@ -497,19 +490,18 @@ static ssize_t sysfs_service_op_show(struct kobject *kobj,
> > if (strcmp(kobj->name, PC_KOBJ_ID)) {
> > if (new_op->upcall.req.param.op ==
> > ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE) {
> > - rc = scnprintf(buf, PAGE_SIZE, "%d %d\n",
> > + rc = sysfs_emit(buf, "%d %d\n",
> > (int)new_op->downcall.resp.param.u.
> > value32[0],
> > (int)new_op->downcall.resp.param.u.
> > value32[1]);
> > } else {
> > - rc = scnprintf(buf, PAGE_SIZE, "%d\n",
> > + rc = sysfs_emit(buf, "%d\n",
> > (int)new_op->downcall.resp.param.u.value64);
> > }
> > } else {
> > - rc = scnprintf(
> > + rc = sysfs_emit(
> > buf,
> > - PAGE_SIZE,
> > "%s",
> > new_op->downcall.resp.perf_count.buffer);
> > }
> >
> > base-commit: 78f4e737a53e1163ded2687a922fce138aee73f5
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-01 15:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250624152545.36763-1-shankari.ak0208@gmail.com>
[not found] ` <CAPRMd3kM8Eaf64vdMd+43cuV-QTBca9Zxm+Ou4S-DFCY5ovDBQ@mail.gmail.com>
2025-07-01 15:23 ` [PATCH v2] fs: orangefs: replace scnprintf() with sysfs_emit() Mike Marshall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).