From: Huang Jianan <huangjianan@oppo.com>
To: Joe Perches <joe@perches.com>, linux-erofs@lists.ozlabs.org
Cc: guoweichao@oppo.com, guanyuwei@oppo.com, yh@oppo.com,
zhangshiming@oppo.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] erofs: add sysfs interface
Date: Tue, 9 Nov 2021 15:31:54 +0800 [thread overview]
Message-ID: <a96677ff-dad0-9baa-00ba-ccc89ac3fb49@oppo.com> (raw)
In-Reply-To: <cc9807eb594b042ec2cd958f0c70c2f3dd12d58b.camel@perches.com>
在 2021/11/9 11:14, Joe Perches 写道:
> On Tue, 2021-11-09 at 10:54 +0800, Huang Jianan wrote:
>> Add sysfs interface to configure erofs related parameters in the
>> future.
> []
>> diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
> []
>> +static ssize_t erofs_attr_show(struct kobject *kobj,
>> + struct attribute *attr, char *buf)
>> +{
>> + struct erofs_sb_info *sbi = container_of(kobj, struct erofs_sb_info,
>> + s_kobj);
>> + struct erofs_attr *a = container_of(attr, struct erofs_attr, attr);
>> + unsigned char *ptr = __struct_ptr(sbi, a->struct_type, a->offset);
>> +
>> + switch (a->attr_id) {
>> + case attr_feature:
>> + return snprintf(buf, PAGE_SIZE, "supported\n");
>> + case attr_pointer_ui:
>> + if (!ptr)
>> + return 0;
>> + return snprintf(buf, PAGE_SIZE, "%u\n",
>> + *((unsigned int *) ptr));
> Prefer sysfs_emit over snprintf
>
> case attr_feature:
> return sysfs_emit(buf, "supported\n");
> case attr_pointer_ui:
> ...
> return sysfs_emit(buf, "%u\n", *(unsigned int *)ptr);
>
> etc...
>
Thanks for reminding this, I will fix it in the next version.
Thanks,
Jianan
prev parent reply other threads:[~2021-11-09 7:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 2:54 Huang Jianan
2021-11-09 2:54 ` [PATCH 2/2] erofs: add sysfs node to control sync decompression strategy Huang Jianan
2021-11-09 3:16 ` Gao Xiang
2021-11-09 7:43 ` Huang Jianan
2021-11-09 7:45 ` [PATCH v2 1/2] erofs: add sysfs interface Huang Jianan
2021-11-09 7:45 ` [PATCH v2 2/2] erofs: add sysfs node to control sync decompression strategy Huang Jianan
2021-11-09 13:27 ` Chao Yu
2021-11-09 13:14 ` [PATCH v2 1/2] erofs: add sysfs interface Chao Yu
2021-11-11 20:17 ` [PATCH 2/2] erofs: add sysfs node to control sync decompression strategy kernel test robot
2021-11-12 2:08 ` Huang Jianan
2021-11-09 3:10 ` [PATCH 1/2] erofs: add sysfs interface Gao Xiang
2021-11-09 7:29 ` Huang Jianan
2021-11-09 3:14 ` Joe Perches
2021-11-09 7:31 ` Huang Jianan [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=a96677ff-dad0-9baa-00ba-ccc89ac3fb49@oppo.com \
--to=huangjianan@oppo.com \
--cc=guanyuwei@oppo.com \
--cc=guoweichao@oppo.com \
--cc=joe@perches.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yh@oppo.com \
--cc=zhangshiming@oppo.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®