lkml.org 
[lkml]   [2011]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] dev: use ifindex hash for dev_seq_ops
On Wed, Oct 12, 2011 at 6:50 PM, Stephen Hemminger
<shemminger@vyatta.com> wrote:
> On Wed, 12 Oct 2011 12:57:26 +0300
> Mihai Maruseac <mihai.maruseac@gmail.com> wrote:
>
> It looks like you lost the ability to seek back and read the header
> (start token).  How is the header handled, is possible to rewind
> the file and read it over again?

We tested with a simple program reading a part of the /proc file and
then doing a seek to the start and rereading. It worked with latest
submitted patch.

>> +static inline struct net_device *next_dev(struct seq_file *seq, loff_t *pos)
>> +{
>> +     struct dev_iter_state *state = seq->private;
>> +     struct net *net = seq_file_net(seq);
>> +     struct net_device *dev = NULL;
>> +     loff_t off;
>> +
>> +     ++*pos;
>> +     dev = dev_get_by_index_rcu(net, state->ifindex);
>
> Looks good a couple of minor nits.
>
> 1. The function should not be inline, since it is in no way performance
>   critical. The compiler will probably inline it anyway.
>
> 2. dev does not have to be initialized since it is assigned a few
>   lines later.  Most programmers are trained now to always initialize
>   variables, but often it is unnecessary.
>
> 3. The name next_dev() is a little generic; maybe a better name.
>

Fixed all of them,

Thanks,
--
Mihai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-10-14 14:23    [W:0.062 / U:1.792 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site