naccyde / rpms / iproute

Forked from rpms/iproute 5 months ago
Clone

Blame SOURCES/0201-iplink-bond_slave-Add-missing-help-functions.patch

049c96
From b2958475a62de444f8bf0e756406f7097a415a4b Mon Sep 17 00:00:00 2001
049c96
From: Phil Sutter <psutter@redhat.com>
049c96
Date: Wed, 20 Jul 2016 22:54:33 +0200
049c96
Subject: [PATCH] iplink: bond_slave: Add missing help functions
049c96
049c96
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1269528
049c96
Upstream Status: iproute2.git commit 25c93faa58806
049c96
049c96
commit 25c93faa58806479ea73bc2d5ceb545e5e932867
049c96
Author: Phil Sutter <phil@nwl.cc>
049c96
Date:   Sat Jul 9 11:22:46 2016 +0200
049c96
049c96
    iplink: bond_slave: Add missing help functions
049c96
049c96
    Signed-off-by: Phil Sutter <phil@nwl.cc>
049c96
---
049c96
 ip/iplink_bond_slave.c | 24 ++++++++++++++++++++++++
049c96
 1 file changed, 24 insertions(+)
049c96
049c96
diff --git a/ip/iplink_bond_slave.c b/ip/iplink_bond_slave.c
049c96
index 2f3364e..5a802b1 100644
049c96
--- a/ip/iplink_bond_slave.c
049c96
+++ b/ip/iplink_bond_slave.c
049c96
@@ -17,6 +17,16 @@
049c96
 #include "utils.h"
049c96
 #include "ip_common.h"
049c96
 
049c96
+static void print_explain(FILE *f)
049c96
+{
049c96
+	fprintf(f, "Usage: ... bond_slave [ queue_id ID ]\n");
049c96
+}
049c96
+
049c96
+static void explain(void)
049c96
+{
049c96
+	print_explain(stderr);
049c96
+}
049c96
+
049c96
 static const char *slave_states[] = {
049c96
 	[BOND_STATE_ACTIVE] = "ACTIVE",
049c96
 	[BOND_STATE_BACKUP] = "BACKUP",
049c96
@@ -99,6 +109,13 @@ static int bond_slave_parse_opt(struct link_util *lu, int argc, char **argv,
049c96
 			if (get_u16(&queue_id, *argv, 0))
049c96
 				invarg("queue_id is invalid", *argv);
049c96
 			addattr16(n, 1024, IFLA_BOND_SLAVE_QUEUE_ID, queue_id);
049c96
+		} else {
049c96
+			if (matches(*argv, "help") != 0)
049c96
+				fprintf(stderr,
049c96
+					"bond_slave: unknown option \"%s\"?\n",
049c96
+					*argv);
049c96
+			explain();
049c96
+			return -1;
049c96
 		}
049c96
 		argc--, argv++;
049c96
 	}
049c96
@@ -106,10 +123,17 @@ static int bond_slave_parse_opt(struct link_util *lu, int argc, char **argv,
049c96
 	return 0;
049c96
 }
049c96
 
049c96
+static void bond_slave_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_slave_link_util = {
049c96
 	.id		= "bond",
049c96
 	.maxattr	= IFLA_BOND_SLAVE_MAX,
049c96
 	.print_opt	= bond_slave_print_opt,
049c96
 	.parse_opt	= bond_slave_parse_opt,
049c96
+	.print_help	= bond_slave_print_help,
049c96
 	.slave		= true,
049c96
 };
049c96
-- 
049c96
1.8.3.1
049c96