mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Mihai Maruseac <mihai.maruseac@gmail.com>
Cc: davem@davemloft.net, eric.dumazet@gmail.com,
	mirq-linux@rere.qmqm.pl, therbert@google.com, jpirko@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	dbaluta@ixiacom.com, Mihai Maruseac <mmaruseac@ixiacom.com>
Subject: Re: [PATCH] dev: use ifindex hash for dev_seq_ops
Date: Wed, 12 Oct 2011 08:50:24 -0700	[thread overview]
Message-ID: <20111012085024.634281a2@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <1318413446-22258-1-git-send-email-mmaruseac@ixiacom.com>

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?


> +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.

  parent reply	other threads:[~2011-10-12 15:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-07 15:20 [PATCH] dev: use name " Mihai Maruseac
2011-10-07 16:24 ` Stephen Hemminger
2011-10-08  7:22   ` Mihai Maruseac
2011-10-10  8:43   ` Mihai Maruseac
2011-10-11  5:55     ` Stephen Hemminger
2011-10-12 10:08       ` Mihai Maruseac
2011-10-12  9:49 ` [PATCH] dev: use ifindex " Mihai Maruseac
2011-10-12  9:57 ` Mihai Maruseac
2011-10-12  9:59   ` Mihai Maruseac
2011-10-12 15:50   ` Stephen Hemminger [this message]
2011-10-14 12:20     ` Mihai Maruseac
2011-10-14  9:53   ` Mihai Maruseac
2011-10-14 12:53     ` Eric Dumazet
2011-10-17  8:03       ` Daniel Baluta
2011-10-17 15:12         ` Stephen Hemminger

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=20111012085024.634281a2@nehalam.linuxnetplumber.net \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=dbaluta@ixiacom.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jpirko@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihai.maruseac@gmail.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=mmaruseac@ixiacom.com \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome