Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs: sysfs: convert remaining scnprintf to sysfs_emit
@ 2022-10-18 12:53 David Sterba
  2022-10-18 13:06 ` Johannes Thumshirn
  2022-10-18 14:24 ` Josef Bacik
  0 siblings, 2 replies; 3+ messages in thread
From: David Sterba @ 2022-10-18 12:53 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The sysfs_emit is the safe API for writing to the sysfs files,
previously converted from scnprintf, there's one left to do in
btrfs_read_policy_show.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 699b54b3acaa..20ba663bc4c1 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -1160,16 +1160,16 @@ static ssize_t btrfs_read_policy_show(struct kobject *kobj,
 
 	for (i = 0; i < BTRFS_NR_READ_POLICY; i++) {
 		if (fs_devices->read_policy == i)
-			ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s[%s]",
+			ret += sysfs_emit_at(buf, ret, "%s[%s]",
 					 (ret == 0 ? "" : " "),
 					 btrfs_read_policy_name[i]);
 		else
-			ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s%s",
+			ret += sysfs_emit_at(buf, ret, "%s%s",
 					 (ret == 0 ? "" : " "),
 					 btrfs_read_policy_name[i]);
 	}
 
-	ret += scnprintf(buf + ret, PAGE_SIZE - ret, "\n");
+	ret += sysfs_emit_at(buf, ret, "\n");
 
 	return ret;
 }
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: sysfs: convert remaining scnprintf to sysfs_emit
  2022-10-18 12:53 [PATCH] btrfs: sysfs: convert remaining scnprintf to sysfs_emit David Sterba
@ 2022-10-18 13:06 ` Johannes Thumshirn
  2022-10-18 14:24 ` Josef Bacik
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2022-10-18 13:06 UTC (permalink / raw)
  To: David Sterba, linux-btrfs@vger.kernel.org

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: sysfs: convert remaining scnprintf to sysfs_emit
  2022-10-18 12:53 [PATCH] btrfs: sysfs: convert remaining scnprintf to sysfs_emit David Sterba
  2022-10-18 13:06 ` Johannes Thumshirn
@ 2022-10-18 14:24 ` Josef Bacik
  1 sibling, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2022-10-18 14:24 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

On Tue, Oct 18, 2022 at 02:53:49PM +0200, David Sterba wrote:
> The sysfs_emit is the safe API for writing to the sysfs files,
> previously converted from scnprintf, there's one left to do in
> btrfs_read_policy_show.
> 
> Signed-off-by: David Sterba <dsterba@suse.com>

Reviewed-by; Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-18 14:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-18 12:53 [PATCH] btrfs: sysfs: convert remaining scnprintf to sysfs_emit David Sterba
2022-10-18 13:06 ` Johannes Thumshirn
2022-10-18 14:24 ` Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox