From: Yangtao Li <frank.li@vivo.com>
To: gregkh@linuxfoundation.org
Cc: chao@kernel.org, damien.lemoal@opensource.wdc.com,
frank.li@vivo.com, huyue2@coolpad.com,
jefflexu@linux.alibaba.com, jth@kernel.org,
linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, naohiro.aota@wdc.com,
rafael@kernel.org, xiang@kernel.org
Subject: Re: [PATCH 2/3] erofs: convert to use kobject_is_added()
Date: Fri, 7 Apr 2023 14:09:00 +0800 [thread overview]
Message-ID: <20230407060901.22446-1-frank.li@vivo.com> (raw)
In-Reply-To: <2023040602-stack-overture-d418@gregkh>
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
next prev parent reply other threads:[~2023-04-07 6:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-06 9:30 [PATCH 1/3] kobject: introduce kobject_is_added() Yangtao Li
2023-04-06 9:30 ` [PATCH 2/3] erofs: convert to use kobject_is_added() Yangtao Li
2023-04-06 10:03 ` Greg KH
2023-04-06 10:13 ` Gao Xiang
2023-04-06 10:27 ` Greg KH
2023-04-06 10:55 ` Gao Xiang
2023-04-06 11:19 ` Greg KH
2023-04-06 12:07 ` Yangtao Li
2023-04-06 13:50 ` Yangtao Li
2023-04-06 14:31 ` Greg KH
2023-04-06 17:52 ` Yangtao Li
2023-04-07 6:09 ` Yangtao Li [this message]
2023-04-07 7:23 ` Yangtao Li
2023-04-06 9:30 ` [PATCH 3/3] zonefs: " Yangtao Li
2023-04-06 10:05 ` Greg KH
2023-04-06 10:13 ` Damien Le Moal
2023-04-06 10:26 ` Greg KH
2023-04-06 10:58 ` Damien Le Moal
2023-04-06 11:18 ` Greg KH
2023-04-06 11:23 ` Damien Le Moal
2023-04-06 9:59 ` [PATCH 1/3] kobject: introduce kobject_is_added() Greg KH
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=20230407060901.22446-1-frank.li@vivo.com \
--to=frank.li@vivo.com \
--cc=chao@kernel.org \
--cc=damien.lemoal@opensource.wdc.com \
--cc=gregkh@linuxfoundation.org \
--cc=huyue2@coolpad.com \
--cc=jefflexu@linux.alibaba.com \
--cc=jth@kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=naohiro.aota@wdc.com \
--cc=rafael@kernel.org \
--cc=xiang@kernel.org \
/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®