diff mbox series

btrfs: sysfs: convert remaining scnprintf to sysfs_emit

Message ID 20221018125349.31879-1-dsterba@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: sysfs: convert remaining scnprintf to sysfs_emit | expand

Commit Message

David Sterba Oct. 18, 2022, 12:53 p.m. UTC
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(-)

Comments

Johannes Thumshirn Oct. 18, 2022, 1:06 p.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Josef Bacik Oct. 18, 2022, 2:24 p.m. UTC | #2
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
diff mbox series

Patch

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;
 }