netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matteo Croce <mcroce@redhat.com>
To: netdev@vger.kernel.org
Cc: David Ahern <dsahern@kernel.org>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2 0/2] refactor the 'ip netns exec' command
Date: Tue, 11 Jun 2019 00:16:11 +0200	[thread overview]
Message-ID: <20190610221613.7554-1-mcroce@redhat.com> (raw)

Refactor the netns code so less steps are needed to exec commands in a netns.
Also remove some code which became dead. bloat-o-meter output:

$ bloat-o-meter ip.old ip
add/remove: 0/5 grow/shrink: 3/3 up/down: 159/-358 (-199)
Function                                     old     new   delta
netns_add                                    971    1058     +87
cmd_exec                                     207     254     +47
on_netns_exec                                 32      57     +25
netns_restore                                 69      67      -2
netns_switch                                 838     822     -16
on_netns_label                                45       -     -45
do_netns                                    1226    1180     -46
vrf_reset                                     55       -     -55
do_each_netns                                 57       -     -57
on_netns                                      60       -     -60
netns_save                                    77       -     -77
Total: Before=667505, After=667306, chg -0.03%

Matteo Croce (2):
  netns: switch netns in the child when executing commands
  netns: make netns_{save,restore} static

 include/namespace.h |  2 --
 include/utils.h     |  5 +----
 ip/ip.c             |  1 -
 ip/ip_common.h      |  1 -
 ip/ipnetns.c        | 49 ++++++++++++++++++++++++++++++++-------------
 ip/ipvrf.c          | 16 +--------------
 lib/exec.c          |  6 +++++-
 lib/namespace.c     | 31 ----------------------------
 lib/utils.c         | 27 -------------------------
 9 files changed, 42 insertions(+), 96 deletions(-)

-- 
2.21.0


             reply	other threads:[~2019-06-10 22:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10 22:16 Matteo Croce [this message]
2019-06-10 22:16 ` [PATCH iproute2 1/2] netns: switch netns in the child when executing commands Matteo Croce
2019-06-10 22:45   ` Stephen Hemminger
2019-06-10 22:52     ` Matteo Croce
2019-06-10 23:03       ` Matteo Croce
2019-06-10 23:11         ` Stephen Hemminger
2019-06-10 22:16 ` [PATCH iproute2 2/2] netns: make netns_{save,restore} static Matteo Croce

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=20190610221613.7554-1-mcroce@redhat.com \
    --to=mcroce@redhat.com \
    --cc=dsahern@kernel.org \
    --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).