[dpdk-dev,2/7] eal: factorise unsupported option handling

Message ID 1411375081-27986-3-git-send-email-david.marchand@6wind.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

David Marchand Sept. 22, 2014, 8:37 a.m. UTC
  Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_eal/bsdapp/eal/eal.c   |   21 ++++++---------------
 lib/librte_eal/linuxapp/eal/eal.c |    6 ++++++
 2 files changed, 12 insertions(+), 15 deletions(-)
  

Patch

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index ffdc441..7e9f3aa 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -626,24 +626,9 @@  eal_parse_args(int argc, char **argv)
 			else if (!strcmp(lgopts[option_index].name, OPT_NO_SHCONF)) {
 				internal_config.no_shconf = 1;
 			}
-			else if (!strcmp(lgopts[option_index].name, OPT_HUGE_DIR)) {
-				RTE_LOG(ERR, EAL, "Option "OPT_HUGE_DIR" is not supported on"
-						"FreeBSD\n");
-				return -1;
-			}
 			else if (!strcmp(lgopts[option_index].name, OPT_PROC_TYPE)) {
 				internal_config.process_type = eal_parse_proc_type(optarg);
 			}
-			else if (!strcmp(lgopts[option_index].name, OPT_FILE_PREFIX)) {
-				RTE_LOG(ERR, EAL, "Option "OPT_FILE_PREFIX" is not supported on"
-						"FreeBSD\n");
-				return -1;
-			}
-			else if (!strcmp(lgopts[option_index].name, OPT_SOCKET_MEM)) {
-				RTE_LOG(ERR, EAL, "Option "OPT_SOCKET_MEM" is not supported on"
-						"FreeBSD\n");
-				return -1;
-			}
 			else if (!strcmp(lgopts[option_index].name, OPT_PCI_BLACKLIST)) {
 				if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI,
 						optarg) < 0) {
@@ -684,6 +669,12 @@  eal_parse_args(int argc, char **argv)
 					return -1;
 				}
 				internal_config.log_level = log;
+			} else {
+				RTE_LOG(ERR, EAL, "Option %s is not supported "
+					"on FreeBSD\n",
+					lgopts[option_index].name);
+				eal_usage(prgname);
+				return -1;
 			}
 			break;
 
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 633e3b8..bf63744 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -938,6 +938,12 @@  eal_parse_args(int argc, char **argv)
 			}
 			else if (!strcmp(lgopts[option_index].name, OPT_CREATE_UIO_DEV)) {
 				internal_config.create_uio_dev = 1;
+			} else {
+				RTE_LOG(ERR, EAL, "Option %s is not supported "
+					"on Linux\n",
+					lgopts[option_index].name);
+				eal_usage(prgname);
+				return -1;
 			}
 			break;