* [PATCH] vhost-scsi: convert sysfs snprintf and sprintf to sysfs_emit
@ 2023-01-29 9:11 Bo Liu
2023-01-29 10:32 ` Simon Horman
2023-01-30 19:33 ` Stefan Hajnoczi
0 siblings, 2 replies; 4+ messages in thread
From: Bo Liu @ 2023-01-29 9:11 UTC (permalink / raw)
To: mst, jasowang, pbonzini, stefanha
Cc: virtualization, kvm, netdev, linux-kernel, Bo Liu
Follow the advice of the Documentation/filesystems/sysfs.rst
and show() should only use sysfs_emit() or sysfs_emit_at()
when formatting the value to be returned to user space.
Signed-off-by: Bo Liu <liubo03@inspur.com>
---
drivers/vhost/scsi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index dca6346d75b3..5cdfa0bfc075 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -2092,7 +2092,7 @@ static ssize_t vhost_scsi_tpg_attrib_fabric_prot_type_show(
struct vhost_scsi_tpg *tpg = container_of(se_tpg,
struct vhost_scsi_tpg, se_tpg);
- return sprintf(page, "%d\n", tpg->tv_fabric_prot_type);
+ return sysfs_emit(page, "%d\n", tpg->tv_fabric_prot_type);
}
CONFIGFS_ATTR(vhost_scsi_tpg_attrib_, fabric_prot_type);
@@ -2202,7 +2202,7 @@ static ssize_t vhost_scsi_tpg_nexus_show(struct config_item *item, char *page)
mutex_unlock(&tpg->tv_tpg_mutex);
return -ENODEV;
}
- ret = snprintf(page, PAGE_SIZE, "%s\n",
+ ret = sysfs_emit(page, "%s\n",
tv_nexus->tvn_se_sess->se_node_acl->initiatorname);
mutex_unlock(&tpg->tv_tpg_mutex);
@@ -2427,7 +2427,7 @@ static void vhost_scsi_drop_tport(struct se_wwn *wwn)
static ssize_t
vhost_scsi_wwn_version_show(struct config_item *item, char *page)
{
- return sprintf(page, "TCM_VHOST fabric module %s on %s/%s"
+ return sysfs_emit(page, "TCM_VHOST fabric module %s on %s/%s"
"on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname,
utsname()->machine);
}
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] vhost-scsi: convert sysfs snprintf and sprintf to sysfs_emit
2023-01-29 9:11 [PATCH] vhost-scsi: convert sysfs snprintf and sprintf to sysfs_emit Bo Liu
@ 2023-01-29 10:32 ` Simon Horman
2023-01-30 19:33 ` Stefan Hajnoczi
1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2023-01-29 10:32 UTC (permalink / raw)
To: Bo Liu
Cc: mst, jasowang, pbonzini, stefanha, virtualization, kvm, netdev,
linux-kernel
On Sun, Jan 29, 2023 at 04:11:45AM -0500, Bo Liu wrote:
> Follow the advice of the Documentation/filesystems/sysfs.rst
> and show() should only use sysfs_emit() or sysfs_emit_at()
> when formatting the value to be returned to user space.
>
> Signed-off-by: Bo Liu <liubo03@inspur.com>
FWIIW,
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vhost-scsi: convert sysfs snprintf and sprintf to sysfs_emit
2023-01-29 9:11 [PATCH] vhost-scsi: convert sysfs snprintf and sprintf to sysfs_emit Bo Liu
2023-01-29 10:32 ` Simon Horman
@ 2023-01-30 19:33 ` Stefan Hajnoczi
2023-01-31 7:00 ` Chaitanya Kulkarni
1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2023-01-30 19:33 UTC (permalink / raw)
To: Bo Liu; +Cc: mst, jasowang, pbonzini, virtualization, kvm, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 441 bytes --]
On Sun, Jan 29, 2023 at 04:11:45AM -0500, Bo Liu wrote:
> Follow the advice of the Documentation/filesystems/sysfs.rst
> and show() should only use sysfs_emit() or sysfs_emit_at()
> when formatting the value to be returned to user space.
>
> Signed-off-by: Bo Liu <liubo03@inspur.com>
> ---
> drivers/vhost/scsi.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vhost-scsi: convert sysfs snprintf and sprintf to sysfs_emit
2023-01-30 19:33 ` Stefan Hajnoczi
@ 2023-01-31 7:00 ` Chaitanya Kulkarni
0 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2023-01-31 7:00 UTC (permalink / raw)
To: Bo Liu; +Cc: kvm, mst, netdev, linux-kernel, virtualization, pbonzini
On 1/30/23 11:33, Stefan Hajnoczi wrote:
> On Sun, Jan 29, 2023 at 04:11:45AM -0500, Bo Liu wrote:
>> Follow the advice of the Documentation/filesystems/sysfs.rst
>> and show() should only use sysfs_emit() or sysfs_emit_at()
>> when formatting the value to be returned to user space.
>>
>> Signed-off-by: Bo Liu <liubo03@inspur.com>
>> ---
>> drivers/vhost/scsi.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-31 7:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-29 9:11 [PATCH] vhost-scsi: convert sysfs snprintf and sprintf to sysfs_emit Bo Liu
2023-01-29 10:32 ` Simon Horman
2023-01-30 19:33 ` Stefan Hajnoczi
2023-01-31 7:00 ` Chaitanya Kulkarni
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).