netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Edward Cree <ecree@solarflare.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>, netdev@vger.kernel.org
Subject: Re: [iproute PATCH] ip-route: Pretty-print expired routes
Date: Thu, 11 Aug 2016 15:54:50 +0200	[thread overview]
Message-ID: <20160811135450.GC10197@orbyte.nwl.cc> (raw)
In-Reply-To: <9d2afc01-bb48-25f7-9cad-7c4926622a38@solarflare.com>

On Thu, Aug 11, 2016 at 02:46:26PM +0100, Edward Cree wrote:
> On 10/08/16 12:14, Phil Sutter wrote:
> > Instead of printing 'expires -23sec' for expired (but not yet garbage
> > collected) routes, print 'expired 23sec' instead.
> >
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> > ---
> >  ip/iproute.c | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/ip/iproute.c b/ip/iproute.c
> > index c52294d298210..a89a26d68be0f 100644
> > --- a/ip/iproute.c
> > +++ b/ip/iproute.c
> > @@ -305,6 +305,14 @@ static void print_rtax_features(FILE *fp, unsigned int features)
> >               fprintf(fp, " 0x%x", of);
> >  }
> >
> > +static void print_expires(FILE *fp, __s32 expires, int hz)
> > +{
> > +     if (expires > 0)
> > +             fprintf(fp, " expires %dsec", expires/hz);
> > +     else
> > +             fprintf(fp, " expired %dsec", -expires/hz);
> > +}
> Perhaps something that differs by more than a single character, to
> make it stand out more?  I don't know what to suggest, though.

Yes, I thought about that, too. At first, I had "expired for %dsec" for
the second case, but decided that it was a bit too verbose given that
all route info goes into a single line and is still meant to be
human-readable. :)

Cheers, Phil

  reply	other threads:[~2016-08-11 13:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 11:14 [iproute PATCH] ip-route: Pretty-print expired routes Phil Sutter
2016-08-11 13:46 ` Edward Cree
2016-08-11 13:54   ` Phil Sutter [this message]
2016-08-12 19:58     ` Stephen Hemminger
2016-08-12 21:11       ` Phil Sutter

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=20160811135450.GC10197@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=ecree@solarflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).