From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 175F21BD78 for ; Thu, 20 Dec 2018 18:07:20 +0100 (CET) Received: by mail-wr1-f65.google.com with SMTP id u4so2537128wrp.3 for ; Thu, 20 Dec 2018 09:07:20 -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=P2npiJFGxtEAvJUY0SsDOH23cB3yWfyPopJj5zBAsw0=; b=Txz//tAdze7tb2U6wLCP9bjB90cmJcrUDyK5O+Gg5DtYEHzUWgb3d9dvR2nGlkP9D8 wW2a7qJsbXJhmbMW/cuHNH9gD+yv3MsDerbS3+rxT9meyISMVo5V6Gt/fjI6Z0p9uB01 Z/VN1enJV4xO/8ym2rY8O2T8aE9HPSXaAZmXkQFbEMG1RN82SObky6EMZW4okpWgEq+U MmuSnMVe/LIUDQkuibRPiobWOCs0+1jBznPCKM8ewC+5Abr05EDl3f3O/jpQy2ZI3lRU 5C6ZG/c91/vm8nGS0poDwrUpAepGdtAEJYzZun2x4UmQNmKB92QYyBrQFOIdbeyZVDk7 oiBQ== 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=P2npiJFGxtEAvJUY0SsDOH23cB3yWfyPopJj5zBAsw0=; b=kehAQgVObcHcUBHnkSMoLS/vs6TBAl1RnvNW0BmquowDbbQzxKXYkiAKRmQK+88dBm Etvv+iWLvXsTGuX3RF+1LM53y1EjjmxA0NEsVDkip6UkApyEJmpD49WFyJX6XZOEpHj0 myBr+Lwm97raR5XMSgVOAbO26QFiyZKzR8SJ9sFGlIooGdvWNQHh8V+3/Mmg+D5VjO9V VsgH6RuQE1rNA2Df9WsXbHBNnIZsYa9iOoaY5qy2gPhe9jx0aWNLFfUs6lcfF7XbaOXQ m0HFoQiBjYPtTGREPjX67SUZ13aEul8SENZbETS+bs/B/3x2fOmDNd+SmcxJQHtOLKwb 19qQ== X-Gm-Message-State: AA+aEWaUBtp1e03KDThnuwf7yYfzgQNco6mCNy5ZTqki02dyVCOuDa+l D4/LvELHKAIiCz6ugPGZYV9N3HKfFFQ= X-Google-Smtp-Source: AFSGD/W+GMaKPcTRPbO9VdG83E67IVAJBevvOToRez6BMb8uWXNZHYQn/1+OfVtABpVhKkunOC+e8Q== X-Received: by 2002:adf:f703:: with SMTP id r3mr22919878wrp.93.1545325639234; Thu, 20 Dec 2018 09:07:19 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Dec 2018 09:07:18 -0800 (PST) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 20 Dec 2018 18:06:43 +0100 Message-Id: <5ed62946ea2ffd627c5422bb5569cb0841f88a69.1545325395.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v1 4/8] option: rename name field 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: , X-List-Received-Date: Thu, 20 Dec 2018 17:07:20 -0000 option->opt_* is redundant. The field should also be constant. Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/include/rte_option.h | 2 +- lib/librte_eal/common/rte_option.c | 8 ++++---- lib/librte_telemetry/rte_telemetry.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/include/rte_option.h b/lib/librte_eal/common/include/rte_option.h index bbcc6cec9..eea95e477 100644 --- a/lib/librte_eal/common/include/rte_option.h +++ b/lib/librte_eal/common/include/rte_option.h @@ -34,7 +34,7 @@ typedef int (*rte_option_cb)(void); */ struct rte_option { TAILQ_ENTRY(rte_option) next; /**< Next entry in the list. */ - char *opt_str; /**< The option name. */ + const char *name; /**< The option name. */ const char *usage; /**< Option summary string. */ rte_option_cb cb; /**< Function called when option is used. */ int enabled; /**< Set when the option is used. */ diff --git a/lib/librte_eal/common/rte_option.c b/lib/librte_eal/common/rte_option.c index 2ed74873b..d94363872 100644 --- a/lib/librte_eal/common/rte_option.c +++ b/lib/librte_eal/common/rte_option.c @@ -26,7 +26,7 @@ rte_option_parse(const char *opt) /* Check if the option is registered */ TAILQ_FOREACH(option, &rte_option_list, next) { - if (strcmp(&opt[2], option->opt_str) == 0) { + if (strcmp(&opt[2], option->name) == 0) { option->enabled = 1; return 0; } @@ -41,9 +41,9 @@ rte_option_register(struct rte_option *opt) struct rte_option *option; TAILQ_FOREACH(option, &rte_option_list, next) { - if (strcmp(opt->opt_str, option->opt_str) == 0) { + if (strcmp(opt->name, option->name) == 0) { RTE_LOG(INFO, EAL, "Option %s has already been registered.\n", - opt->opt_str); + opt->name); return; } } @@ -75,6 +75,6 @@ rte_option_usage(void) printf("EAL dynamic options:\n"); TAILQ_FOREACH(option, &rte_option_list, next) - printf(" --%-*s %s\n", 17, option->opt_str, option->usage); + printf(" --%-*s %s\n", 17, option->name, option->usage); printf("\n"); } diff --git a/lib/librte_telemetry/rte_telemetry.c b/lib/librte_telemetry/rte_telemetry.c index 0ba6626c1..3ba7ae8de 100644 --- a/lib/librte_telemetry/rte_telemetry.c +++ b/lib/librte_telemetry/rte_telemetry.c @@ -1798,7 +1798,7 @@ rte_telemetry_json_socket_message_test(struct telemetry_impl *telemetry, int fd) int telemetry_log_level; static struct rte_option option = { - .opt_str = "telemetry", + .name = "telemetry", .usage = "Enable telemetry backend", .cb = &rte_telemetry_init, .enabled = 0 -- 2.19.1