|
|
049c96 |
From eb7bc8d12d4b763c3938086b9a7aa7ae45a40a5d Mon Sep 17 00:00:00 2001
|
|
|
049c96 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
049c96 |
Date: Tue, 23 Feb 2016 18:26:25 +0100
|
|
|
049c96 |
Subject: [PATCH] ip link: Shortify printing the usage of link type
|
|
|
049c96 |
|
|
|
049c96 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1269528
|
|
|
049c96 |
Upstream Status: iproute2.git commit 561e650eff679
|
|
|
049c96 |
Conflicts: Reapplying an already backported commit, just applying
|
|
|
049c96 |
it's changes to ip/iplink_bond.c.
|
|
|
049c96 |
|
|
|
049c96 |
commit 561e650eff679296d3f4c12657721ae769cbc187
|
|
|
049c96 |
Author: vadimk <vadim4j@gmail.com>
|
|
|
049c96 |
Date: Tue Sep 30 08:17:31 2014 +0300
|
|
|
049c96 |
|
|
|
049c96 |
ip link: Shortify printing the usage of link type
|
|
|
049c96 |
|
|
|
049c96 |
Allow to print particular link type usage by:
|
|
|
049c96 |
|
|
|
049c96 |
ip link help [TYPE]
|
|
|
049c96 |
|
|
|
049c96 |
Currently to print usage for some link type it is needed
|
|
|
049c96 |
to use the following way:
|
|
|
049c96 |
|
|
|
049c96 |
ip link { add | del | set } type TYPE help
|
|
|
049c96 |
|
|
|
049c96 |
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
|
|
|
049c96 |
---
|
|
|
049c96 |
ip/iplink_bond.c | 16 ++++++++++++++--
|
|
|
049c96 |
1 file changed, 14 insertions(+), 2 deletions(-)
|
|
|
049c96 |
|
|
|
049c96 |
diff --git a/ip/iplink_bond.c b/ip/iplink_bond.c
|
|
|
049c96 |
index 539a2e6..a573f92 100644
|
|
|
049c96 |
--- a/ip/iplink_bond.c
|
|
|
049c96 |
+++ b/ip/iplink_bond.c
|
|
|
049c96 |
@@ -112,9 +112,9 @@ static int get_index(const char **tbl, char *name)
|
|
|
049c96 |
return -1;
|
|
|
049c96 |
}
|
|
|
049c96 |
|
|
|
049c96 |
-static void explain(void)
|
|
|
049c96 |
+static void print_explain(FILE *f)
|
|
|
049c96 |
{
|
|
|
049c96 |
- fprintf(stderr,
|
|
|
049c96 |
+ fprintf(f,
|
|
|
049c96 |
"Usage: ... bond [ mode BONDMODE ] [ active_slave SLAVE_DEV ]\n"
|
|
|
049c96 |
" [ clear_active_slave ] [ miimon MIIMON ]\n"
|
|
|
049c96 |
" [ updelay UPDELAY ] [ downdelay DOWNDELAY ]\n"
|
|
|
049c96 |
@@ -147,6 +147,11 @@ static void explain(void)
|
|
|
049c96 |
);
|
|
|
049c96 |
}
|
|
|
049c96 |
|
|
|
049c96 |
+static void explain(void)
|
|
|
049c96 |
+{
|
|
|
049c96 |
+ print_explain(stderr);
|
|
|
049c96 |
+}
|
|
|
049c96 |
+
|
|
|
049c96 |
static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
|
|
|
049c96 |
struct nlmsghdr *n)
|
|
|
049c96 |
{
|
|
|
049c96 |
@@ -531,9 +536,16 @@ static void bond_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
049c96 |
}
|
|
|
049c96 |
}
|
|
|
049c96 |
|
|
|
049c96 |
+static void bond_print_help(struct link_util *lu, int argc, char **argv,
|
|
|
049c96 |
+ FILE *f)
|
|
|
049c96 |
+{
|
|
|
049c96 |
+ print_explain(f);
|
|
|
049c96 |
+}
|
|
|
049c96 |
+
|
|
|
049c96 |
struct link_util bond_link_util = {
|
|
|
049c96 |
.id = "bond",
|
|
|
049c96 |
.maxattr = IFLA_BOND_MAX,
|
|
|
049c96 |
.parse_opt = bond_parse_opt,
|
|
|
049c96 |
.print_opt = bond_print_opt,
|
|
|
049c96 |
+ .print_help = bond_print_help,
|
|
|
049c96 |
};
|
|
|
049c96 |
--
|
|
|
049c96 |
1.8.3.1
|
|
|
049c96 |
|