All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2 0/3] iplink: shortify printing the usage of bridge
@ 2015-08-12  6:03 Zhang Shengju
  2015-08-12  6:03 ` [PATCH iproute2 1/3] iplink: add missing link type Zhang Shengju
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Zhang Shengju @ 2015-08-12  6:03 UTC (permalink / raw)
  To: netdev; +Cc: Zhang Shengju

This patch set enables bridge related links to print usage with short format.
Or else it is needed to use the following way:
	    
  ip link { add | del | set } type TYPE help

Zhang Shengju (3):
  iplink: add missing link type
  iplink: use the short format to print help info
  iplink: shortify printing the usage of link type

 ip/iplink.c              |  2 +-
 ip/iplink_bridge.c       | 16 ++++++++++++++--
 ip/iplink_bridge_slave.c | 16 ++++++++++++++--
 3 files changed, 29 insertions(+), 5 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH iproute2 1/3] iplink: add missing link type
  2015-08-12  6:03 [PATCH iproute2 0/3] iplink: shortify printing the usage of bridge Zhang Shengju
@ 2015-08-12  6:03 ` Zhang Shengju
  2015-08-12  6:03 ` [PATCH iproute2 2/3] iplink: use the short format to print help info Zhang Shengju
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Zhang Shengju @ 2015-08-12  6:03 UTC (permalink / raw)
  To: netdev; +Cc: Zhang Shengju

Add missing link type "bridge_slave".

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 ip/iplink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ip/iplink.c b/ip/iplink.c
index de5a3c9..7e5c466 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -93,7 +93,7 @@ void iplink_usage(void)
 		fprintf(stderr, "TYPE := { vlan | veth | vcan | dummy | ifb | macvlan | macvtap |\n");
 		fprintf(stderr, "          bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan |\n");
 		fprintf(stderr, "          gre | gretap | ip6gre | ip6gretap | vti | nlmon |\n");
-		fprintf(stderr, "          bond_slave | ipvlan | geneve }\n");
+		fprintf(stderr, "          bond_slave | ipvlan | geneve | bridge_slave }\n");
 	}
 	exit(-1);
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH iproute2 2/3] iplink: use the short format to print help info
  2015-08-12  6:03 [PATCH iproute2 0/3] iplink: shortify printing the usage of bridge Zhang Shengju
  2015-08-12  6:03 ` [PATCH iproute2 1/3] iplink: add missing link type Zhang Shengju
@ 2015-08-12  6:03 ` Zhang Shengju
  2015-08-12  6:03 ` [PATCH iproute2 3/3] iplink: shortify printing the usage of link type Zhang Shengju
  2015-08-12 16:08 ` [PATCH iproute2 0/3] iplink: shortify printing the usage of bridge Stephen Hemminger
  3 siblings, 0 replies; 5+ messages in thread
From: Zhang Shengju @ 2015-08-12  6:03 UTC (permalink / raw)
  To: netdev; +Cc: Zhang Shengju

Allow to print link type usage by: ip link help bridge

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 ip/iplink_bridge.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
index 297160c..1e69960 100644
--- a/ip/iplink_bridge.c
+++ b/ip/iplink_bridge.c
@@ -17,9 +17,9 @@
 #include "utils.h"
 #include "ip_common.h"
 
-static void explain(void)
+static void print_explain(FILE *f)
 {
-	fprintf(stderr,
+	fprintf(f,
 		"Usage: ... bridge [ forward_delay FORWARD_DELAY ]\n"
 		"                  [ hello_time HELLO_TIME ]\n"
 		"                  [ max_age MAX_AGE ]\n"
@@ -29,6 +29,11 @@ static void explain(void)
 	);
 }
 
+static void explain(void)
+{
+	print_explain(stderr);
+}
+
 static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
 			    struct nlmsghdr *n)
 {
@@ -111,9 +116,16 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 			rta_getattr_u32(tb[IFLA_BR_MAX_AGE]));
 }
 
+static void bridge_print_help(struct link_util *lu, int argc, char **argv,
+		FILE *f)
+{
+	print_explain(f);
+}
+
 struct link_util bridge_link_util = {
 	.id		= "bridge",
 	.maxattr	= IFLA_BR_MAX,
 	.parse_opt	= bridge_parse_opt,
 	.print_opt	= bridge_print_opt,
+	.print_help     = bridge_print_help,
 };
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH iproute2 3/3] iplink: shortify printing the usage of link type
  2015-08-12  6:03 [PATCH iproute2 0/3] iplink: shortify printing the usage of bridge Zhang Shengju
  2015-08-12  6:03 ` [PATCH iproute2 1/3] iplink: add missing link type Zhang Shengju
  2015-08-12  6:03 ` [PATCH iproute2 2/3] iplink: use the short format to print help info Zhang Shengju
@ 2015-08-12  6:03 ` Zhang Shengju
  2015-08-12 16:08 ` [PATCH iproute2 0/3] iplink: shortify printing the usage of bridge Stephen Hemminger
  3 siblings, 0 replies; 5+ messages in thread
From: Zhang Shengju @ 2015-08-12  6:03 UTC (permalink / raw)
  To: netdev; +Cc: Zhang Shengju

Allow to print link type usage by: ip link help bridge_slave

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 ip/iplink_bridge_slave.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c
index a285185..4593872 100644
--- a/ip/iplink_bridge_slave.c
+++ b/ip/iplink_bridge_slave.c
@@ -19,9 +19,9 @@
 #include "utils.h"
 #include "ip_common.h"
 
-static void explain(void)
+static void print_explain(FILE *f)
 {
-	fprintf(stderr,
+	fprintf(f,
 		"Usage: ... bridge_slave [ state STATE ] [ priority PRIO ] [cost COST ]\n"
 		"                        [ guard {on | off} ]\n"
 		"                        [ hairpin {on | off} ] \n"
@@ -32,6 +32,11 @@ static void explain(void)
 	);
 }
 
+static void explain(void)
+{
+	print_explain(stderr);
+}
+
 static const char *port_states[] = {
 	[BR_STATE_DISABLED] = "disabled",
 	[BR_STATE_LISTENING] = "listening",
@@ -172,10 +177,17 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
 	return 0;
 }
 
+static void bridge_slave_print_help(struct link_util *lu, int argc, char **argv,
+		FILE *f)
+{
+	print_explain(f);
+}
+
 struct link_util bridge_slave_link_util = {
 	.id		= "bridge",
 	.maxattr	= IFLA_BRPORT_MAX,
 	.print_opt	= bridge_slave_print_opt,
 	.parse_opt	= bridge_slave_parse_opt,
+	.print_help     = bridge_slave_print_help,
 	.slave		= true,
 };
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH iproute2 0/3] iplink: shortify printing the usage of bridge
  2015-08-12  6:03 [PATCH iproute2 0/3] iplink: shortify printing the usage of bridge Zhang Shengju
                   ` (2 preceding siblings ...)
  2015-08-12  6:03 ` [PATCH iproute2 3/3] iplink: shortify printing the usage of link type Zhang Shengju
@ 2015-08-12 16:08 ` Stephen Hemminger
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2015-08-12 16:08 UTC (permalink / raw)
  To: Zhang Shengju; +Cc: netdev

On Wed, 12 Aug 2015 06:03:21 +0000
Zhang Shengju <zhangshengju@cmss.chinamobile.com> wrote:

> This patch set enables bridge related links to print usage with short format.
> Or else it is needed to use the following way:
> 	    
>   ip link { add | del | set } type TYPE help
> 
> Zhang Shengju (3):
>   iplink: add missing link type
>   iplink: use the short format to print help info
>   iplink: shortify printing the usage of link type
> 
>  ip/iplink.c              |  2 +-
>  ip/iplink_bridge.c       | 16 ++++++++++++++--
>  ip/iplink_bridge_slave.c | 16 ++++++++++++++--
>  3 files changed, 29 insertions(+), 5 deletions(-)
> 

All 3 and the typo patch applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-12 16:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-12  6:03 [PATCH iproute2 0/3] iplink: shortify printing the usage of bridge Zhang Shengju
2015-08-12  6:03 ` [PATCH iproute2 1/3] iplink: add missing link type Zhang Shengju
2015-08-12  6:03 ` [PATCH iproute2 2/3] iplink: use the short format to print help info Zhang Shengju
2015-08-12  6:03 ` [PATCH iproute2 3/3] iplink: shortify printing the usage of link type Zhang Shengju
2015-08-12 16:08 ` [PATCH iproute2 0/3] iplink: shortify printing the usage of bridge Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.