From patchwork Thu Dec 20 17:06:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABtan_Rivet?= X-Patchwork-Id: 49205 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7AC371BDB8; Thu, 20 Dec 2018 18:07:25 +0100 (CET) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 7984C1BD7E for ; Thu, 20 Dec 2018 18:07:21 +0100 (CET) Received: by mail-wr1-f67.google.com with SMTP id v13so2531754wrw.5 for ; Thu, 20 Dec 2018 09:07:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uie/3rwQ24KmeEpvlOrXaqi5jI/o7o1nZhLCcUAXDZQ=; b=khEzqVlpZx98cx+QcJ/YCq6syTf4WYUhCc9sJfBZAAQuPtqS2zFZeXtVirwsdwzKXP 5GeAHiw952mlFqNDCBVQGeH5Wily6Nxo2VD2d+IDc44LvcWk55BgPo5MSdZtq+NccTsK 5oLFYbCX4RAZ/xphw7f4sRt1bUpYyM12rVZC4WSOggmRadvJjwlc560KaIhMflWu44Gx muIHb9jerGwiJIaOJd+e12AeyrYZOHjDr1a5a+vD98J7E7Fd8Vatv/YTSch6z+EU8WED skbUdkuaCVQSNHflDPmXizwiYnN+9cHb5Nq6FCzP0FVd0r99vZsY3V/jvTdW8ttZyrqn WmiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uie/3rwQ24KmeEpvlOrXaqi5jI/o7o1nZhLCcUAXDZQ=; b=T1lqMYiJd00NPUPRqO/p0rhlIP+RX4oM7nPtS7G4ZQdfQOESvjv3PUM01/dP3CBdW8 zugUFcpHat43FhAm7gwkvtL/Ln9/kzUOZ7rJ3CGcn8kovp7NLFhHDSXu9hSEKKl1r/m8 s2pJgnZVc6FMcLyRKD73EWdo8mcGUPhubqzCIHQVNLdOxTYccMYECt9h31FzaInx+FRn Dk0St7LriCGgLNBmhIGUtpaGvfHc0Ohdih1nrDIgb68o/dnXSHVHW6OkH3EFys00XNEX PNbOt8m7gTVac3DjH0EO8TmMJd2FxU17FZ6y/zYPOB08w/HJeDsgEY9oktsJ63q24GlF WV4A== X-Gm-Message-State: AA+aEWbqVjnlW3JiilvjadmT7E/Hh4OMuHc0/t+DXc3bPXlTq3w8eUKI vcRL2zCz+Vy4b+gsO7hFKYBcpiIbVgQ= X-Google-Smtp-Source: AFSGD/UHBu2BQsdI/8FP7ejNIzu3bWoGl2dxo6jeiWa7gwRqxYfg6Xysdrtduwge4lBcM2bjEIo47A== X-Received: by 2002:adf:a357:: with SMTP id d23mr24294425wrb.195.1545325640702; Thu, 20 Dec 2018 09:07:20 -0800 (PST) Received: from bidouze.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id n5sm11951688wrr.94.2018.12.20.09.07.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Dec 2018 09:07:19 -0800 (PST) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 20 Dec 2018 18:06:44 +0100 Message-Id: <64e6b0b1b696b3e99e28ab35f42b1e94e8e42582.1545325395.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v1 5/8] option: check against common option on register X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Not only check against other registered options, but also common EAL options. This will mitigate user confusion. Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/rte_option.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/librte_eal/common/rte_option.c b/lib/librte_eal/common/rte_option.c index d94363872..ae8a0e2ca 100644 --- a/lib/librte_eal/common/rte_option.c +++ b/lib/librte_eal/common/rte_option.c @@ -2,6 +2,7 @@ * Copyright(c) 2018 Intel Corporation. */ +#include #include #include @@ -9,6 +10,8 @@ #include #include "eal_private.h" +#include "eal_internal_cfg.h" /* Necessary for eal_options.h */ +#include "eal_options.h" TAILQ_HEAD(rte_option_list, rte_option); @@ -39,6 +42,17 @@ void __rte_experimental rte_option_register(struct rte_option *opt) { struct rte_option *option; + const struct option *gopt; + + gopt = &eal_long_options[0]; + while (gopt->name != NULL) { + if (strcmp(gopt->name, opt->name) == 0) { + RTE_LOG(ERR, EAL, "Option %s is already a common EAL option.\n", + opt->name); + return; + } + gopt++; + } TAILQ_FOREACH(option, &rte_option_list, next) { if (strcmp(opt->name, option->name) == 0) {