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]
Message-Id: <20230407060901.22446-1-frank.li@vivo.com>
Date:   Fri,  7 Apr 2023 14:09:00 +0800
From:   Yangtao Li <frank.li@...o.com>
To:     gregkh@...uxfoundation.org
Cc:     chao@...nel.org, damien.lemoal@...nsource.wdc.com,
        frank.li@...o.com, huyue2@...lpad.com, jefflexu@...ux.alibaba.com,
        jth@...nel.org, linux-erofs@...ts.ozlabs.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        naohiro.aota@....com, rafael@...nel.org, xiang@...nel.org
Subject: Re: [PATCH 2/3] erofs: convert to use kobject_is_added()

Hi Greg,

> just let it hang off as a separate structure (i.e. a pointer to something else.)

I have made some attempts. According to my understanding, the reason why the
filesystem needs to embed the kobj structure (not a pointer) is that the kobj_to_sbi
method is required in the attr_store/attr_show method for subsequent data processing.

130 static ssize_t erofs_attr_store(struct kobject *kobj, struct attribute *attr,
131                                                 const char *buf, size_t len)
132 {
133         struct erofs_sb_info *sbi = container_of(kobj, struct erofs_sb_info,
134                                                 s_kobj);

If we turn the kobject in sbi into a pointer, then we need to insert a pointer
to sbi in the kobject, or perform the following encapsulation.

struct filesystem_kobject {
        struct kobject kobject;
	void *private;
};

Later, I thought I could send some demo code that strips the kobject in sbi into a pointer.

BTW, Now sysfs.c in many file systems is full of a lot of repetitive code, maybe we can abstract the common part?
Like filesystem_attr、filesystem_kobject_ops、filesystem_kobject_ktype...

Thx,
Yangtao

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ