lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 9 Nov 2021 15:31:54 +0800
From:   Huang Jianan <huangjianan@...o.com>
To:     Joe Perches <joe@...ches.com>, linux-erofs@...ts.ozlabs.org
Cc:     guoweichao@...o.com, guanyuwei@...o.com, yh@...o.com,
        zhangshiming@...o.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] erofs: add sysfs interface

在 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ