From: Coly Li <colyli@suse.de>
To: 王擎 <wangqing@vivo.com>
Cc: "linux-bcache@vger.kernel.org" <linux-bcache@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: 回复: [PATCH] bcache: replace snprintf in show functions with sysfs_emit
Date: Wed, 13 Oct 2021 15:51:24 +0800 [thread overview]
Message-ID: <fff14784-aadf-d7b0-3aed-e2428b1a7b54@suse.de> (raw)
In-Reply-To: <SL2PR06MB3082B818199080975B93D0B6BDB79@SL2PR06MB3082.apcprd06.prod.outlook.com>
On 10/13/21 3:39 PM, 王擎 wrote:
>>> diff --git a/drivers/md/bcache/sysfs.h b/drivers/md/bcache/sysfs.h
>>> index 215df32..8bec32d 100644
>>> --- a/drivers/md/bcache/sysfs.h
>>> +++ b/drivers/md/bcache/sysfs.h
>>> @@ -51,7 +51,7 @@ STORE(fn) \
>>> #define sysfs_printf(file, fmt, ...) \
>>> do { \
>>> if (attr == &sysfs_ ## file) \
>>> - return snprintf(buf, PAGE_SIZE, fmt "\n", __VA_ARGS__); \
>>> + return sysfs_emit(buf, fmt "\n", __VA_ARGS__); \
>>> } while (0)
>>>
>>> #define sysfs_print(file, var) \
>> IMHO I like this change :-) BTW, for snprint() from util.h, it seems
>> only to be used by sysfs_print() in syfs.h, would you like to change it
>> to use sysfs_emit too ?
>>
>> Thanks for the patch.
>>
>> Coly Li
>>
> sysfs_print() should also be modified if size is a fixed value PAGE_SIZE,
> but here is param, it would be appreciate if you have better method.
Yes, I meant you may implement sysfs_print() by sysfs_emit() directly in
the way as snprint() does. Then you may remove snprint() since no one
uses it any more.
Coly Li
prev parent reply other threads:[~2021-10-13 7:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-13 3:27 Qing Wang
2021-10-13 6:59 ` Coly Li
[not found] ` <AI*ALgD1Em5Q2PfGyVlLhqrx.9.1634108359294.Hmail.wangqing@vivo.com>
2021-10-13 7:39 ` 回复: " 王擎
2021-10-13 7:51 ` Coly Li [this message]
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=fff14784-aadf-d7b0-3aed-e2428b1a7b54@suse.de \
--to=colyli@suse.de \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wangqing@vivo.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®