From: David Ahern <dsahern@gmail•com>
To: Sasha Levin <sasha.levin@oracle•com>,
davem@davemloft•net, kuznet@ms2•inr.ac.ru, jmorris@namei•org,
yoshfuji@linux-ipv6•org, kaber@trash•net
Cc: netdev@vger•kernel.org, linux-kernel@vger•kernel.org
Subject: Re: [PATCH] net: Revert "fib_trie: use seq_file_net rather than seq->private"
Date: Wed, 04 Jun 2014 16:44:09 -0600 [thread overview]
Message-ID: <538FA139.4020501@gmail.com> (raw)
In-Reply-To: <538F99A2.2090102@gmail.com>
On 6/4/14, 4:11 PM, David Ahern wrote:
> On 6/4/14, 4:02 PM, Sasha Levin wrote:
>> This reverts commit 30f38d2fdd79f13fc929489f7e6e517b4a4bfe63.
>>
>> fib_triestat is surrounded by a big lie: while it claims that it's a
>> seq_file (fib_triestat_seq_open, fib_triestat_seq_show), it isn't:
>>
>> static const struct file_operations fib_triestat_fops = {
>> .owner = THIS_MODULE,
>> .open = fib_triestat_seq_open,
>> .read = seq_read,
>> .llseek = seq_lseek,
>> .release = single_release_net,
>> };
>>
>> Yes, fib_triestat is just a regular file.
If you compare fib_trie to fib_triestat the only difference is the use
of single_open_net and single_release_net by fib_triestat.
single_open_net is a wrapper to single_open passing struct net as the
private data. single_open is for seq_files:
int single_open(struct file *file, int (*show)(struct seq_file *, void *),
void *data)
{
struct seq_operations *op = kmalloc(sizeof(*op), GFP_KERNEL);
int res = -ENOMEM;
if (op) {
op->start = single_start;
op->next = single_next;
op->stop = single_stop;
op->show = show;
res = seq_open(file, op);
if (!res)
((struct seq_file *)file->private_data)->private = data;
Where is the problem using seq_file_net in fib_triestat_seq_show:
static int fib_triestat_seq_show(struct seq_file *seq, void *v)
{
struct net *net = (struct net *)seq->private;
where
static inline struct net *seq_file_net(struct seq_file *seq)
{
#ifdef CONFIG_NET_NS
return ((struct seq_net_private *)seq->private)->net;
#else
return &init_net;
#endif
}
David
next prev parent reply other threads:[~2014-06-04 22:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 22:02 [PATCH] net: Revert "fib_trie: use seq_file_net rather than seq->private" Sasha Levin
2014-06-04 22:11 ` David Ahern
2014-06-04 22:44 ` David Ahern [this message]
2014-06-04 22:11 ` Sergei Shtylyov
2014-06-04 22:12 ` David Miller
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=538FA139.4020501@gmail.com \
--to=dsahern@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=jmorris@namei$(echo .)org \
--cc=kaber@trash$(echo .)net \
--cc=kuznet@ms2$(echo .)inr.ac.ru \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=sasha.levin@oracle$(echo .)com \
--cc=yoshfuji@linux-ipv6$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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