From: Greg KH <gregkh@linuxfoundation.org>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH next 0/3] debugfs: introduce debugfs_create_single/seq[,_data]
Date: Fri, 29 Nov 2019 23:23:10 +0100 [thread overview]
Message-ID: <20191129222310.GA3712618@kroah.com> (raw)
In-Reply-To: <20191129221938.GB3710566@kroah.com>
On Fri, Nov 29, 2019 at 11:19:38PM +0100, Greg KH wrote:
> On Fri, Nov 29, 2019 at 11:16:38PM +0800, Kefeng Wang wrote:
> >
> >
> > On 2019/11/29 22:21, Greg KH wrote:
> > > On Fri, Nov 29, 2019 at 05:27:49PM +0800, Kefeng Wang wrote:
> > >> Like proc_create_single/seq[,_data] in procfs, we could provide similar debugfs
> > >> helper to reduce losts of boilerplate code.
> > >>
> > >> debugfs_create_single[,_data]
> > >> creates a file in debugfs with the extra data and a seq_file show callback.
> > >> debugfs_create_seq[,_data]
> > >> creates a file in debugfs with the extra data and a seq_operations.
> > >>
> > >> There is a object dynamically allocated in the helper, which is used to store
> > >> extra data, we need free it when remove the debugfs file.
> > >>
> > >> If the change is acceptable, we could change the caller one by one.
> > >
> > > I would like to see a user of this and how you would convert it, in
> > > order to see if this is worth it or not.
> >
> > I have some diff patches, the conversion is in progress. current statistics
> > are as follows,
> >
> > 1) debugfs: switch to debugfs_create_seq[,_data]
> > 19 files changed, 85 insertions(+), 620 deletions(-)
> > 2) debugfs: switch to debugfs_create_single[,_data]
> > 70 files changed, 249 insertions(+), 1482 deletions(-)
> >
> > Here are some examples,
> > 1) debugfs_create_seq
> > diff --git a/mm/vmstat.c b/mm/vmstat.c
> > index 78d53378db99..62c26772f24c 100644
> > --- a/mm/vmstat.c
> > +++ b/mm/vmstat.c
> > @@ -2057,18 +2057,6 @@ static const struct seq_operations unusable_op = {
> > .show = unusable_show,
> > };
> >
> > -static int unusable_open(struct inode *inode, struct file *file)
> > -{
> > - return seq_open(file, &unusable_op);
> > -}
> > -
> > -static const struct file_operations unusable_file_ops = {
> > - .open = unusable_open,
> > - .read = seq_read,
> > - .llseek = seq_lseek,
> > - .release = seq_release,
> > -};
> > -
>
> Can't this file just use the normal file macro/interface for debugfs
> files instead? Hm, maybe not, it seems the celf code wants to do much
> the same as above, but is seq_read() really needed for these?
I refer to DEFINE_SIMPLE_ATTRIBUTE(), sorry for not saying that here.
And if they do not work, how about creating:
DEFINE_SEQ_ATTRIBUTE()
in much the same way for the whole kernel to use.
thanks,
greg k-h
prev parent reply other threads:[~2019-11-29 22:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-29 9:27 [PATCH next 0/3] debugfs: introduce debugfs_create_single/seq[,_data] Kefeng Wang
2019-11-29 9:27 ` [PATCH next 1/3] debugfs: Provide debugfs_[set|clear|test]_lowest_bit() Kefeng Wang
2019-11-29 9:27 ` [PATCH next 2/3] debugfs: introduce debugfs_create_single[,_data] Kefeng Wang
2019-12-03 8:38 ` [PATCH next 2/3] debugfs: introduce debugfs_create_single[, _data] Dan Carpenter
2019-12-03 8:38 ` [PATCH next 2/3] debugfs: introduce debugfs_create_single[,_data] Dan Carpenter
2019-12-03 8:38 ` [PATCH next 2/3] debugfs: introduce debugfs_create_single[, _data] Dan Carpenter
2019-12-03 9:02 ` [kbuild-all] " Rong Chen
2019-12-03 9:02 ` [kbuild-all] Re: [PATCH next 2/3] debugfs: introduce debugfs_create_single[,_data] Rong Chen
2019-12-03 9:02 ` [PATCH next 2/3] debugfs: introduce debugfs_create_single[, _data] Rong Chen
2019-12-03 9:32 ` [kbuild-all] " Dan Carpenter
2019-12-03 9:32 ` [kbuild-all] Re: [PATCH next 2/3] debugfs: introduce debugfs_create_single[,_data] Dan Carpenter
2019-12-03 9:32 ` [PATCH next 2/3] debugfs: introduce debugfs_create_single[, _data] Dan Carpenter
2019-11-29 9:27 ` [PATCH next 3/3] debugfs: introduce debugfs_create_seq[,_data] Kefeng Wang
2019-11-29 14:22 ` Greg KH
2019-11-29 15:03 ` Kefeng Wang
2019-11-29 22:16 ` Greg KH
2019-11-29 14:21 ` [PATCH next 0/3] debugfs: introduce debugfs_create_single/seq[,_data] Greg KH
2019-11-29 15:16 ` Kefeng Wang
2019-11-29 22:19 ` Greg KH
2019-11-29 22:23 ` Greg KH [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=20191129222310.GA3712618@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wangkefeng.wang@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.