Re: [RFC PATCH 13/19] mm/damon/sysfs: implement filter dir files

From: Gutierrez Asier

Date: Tue Apr 28 2026 - 09:22:18 EST




On 4/28/2026 3:44 AM, SeongJae Park wrote:
> On Mon, 27 Apr 2026 16:24:10 +0300 Gutierrez Asier <gutierrez.asier@xxxxxxxxxxxxxxxxxxx> wrote:
>
>>
>>
>> On 4/26/2026 11:52 PM, SeongJae Park wrote:
>>> Implement sysfs files under the data probe filter directory for letting
>>> users to configure each filter.
>>>
>>> Signed-off-by: SeongJae Park <sj@xxxxxxxxxx>
>>> ---
> [...]
>>> +static ssize_t type_show(struct kobject *kobj,
>>> + struct kobj_attribute *attr, char *buf)
>>> +{
>>> + struct damon_sysfs_filter *filter = container_of(kobj,
>>> + struct damon_sysfs_filter, kobj);
>>> + int i;
>>> +
>>> + for (i = 0; i < ARRAY_SIZE(damon_sysfs_filter_type_names); i++) {
>>> + const struct damon_sysfs_filter_type_name *type_name;
>> Can we move this declaration to the top of the function?
>
> Unfortunately other parts of sysfs.c and sysfs-schemes.c including
> operations_show/store(), type_show/sotre(), metric_show/store() are also using
> this pattern. I'd like to keep the style consistency, if I'm not missing
> something and you don't mind.

Yes, it makes sense to keep the code consistent.

>
> Thanks,
> SJ
>
> [...]
>

--
Asier Gutierrez
Huawei