From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 99C95DE5 for ; Wed, 29 Mar 2017 17:53:11 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id EBA3826477; Wed, 29 Mar 2017 17:53:05 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, david.marchand@6wind.com, bruce.richardson@intel.com, keith.wiles@intel.com, stephen@networkplumber.org Date: Wed, 29 Mar 2017 17:53:20 +0200 Message-Id: <20170329155323.4760-6-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170329155323.4760-1-olivier.matz@6wind.com> References: <1489765882-30497-1-git-send-email-olivier.matz@6wind.com> <20170329155323.4760-1-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v2 5/8] eal: deprecate log functions 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: Wed, 29 Mar 2017 15:53:11 -0000 Deprecate the following functions: - rte_set_log_level(), replaced by rte_log_set_global_level() - rte_get_log_level(), replaced by rte_log_get_global_level() - rte_set_log_type(), replaced by rte_log_set_level() - rte_get_log_type(), replaced by rte_log_get_level() The new functions provide a better control of the per-type log level, and have a better name prefix (rte_log_). Signed-off-by: Olivier Matz --- doc/guides/rel_notes/deprecation.rst | 8 ++++++++ examples/quota_watermark/qw/main.c | 2 +- examples/quota_watermark/qwctl/qwctl.c | 2 +- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 ++ lib/librte_eal/common/eal_common_log.c | 24 ++++++++++++++++++++---- lib/librte_eal/common/include/rte_log.h | 19 +++++++++++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++ test/test/test_logs.c | 6 +++--- 8 files changed, 56 insertions(+), 9 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index d6544ed0a..3f7824b75 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -118,3 +118,11 @@ Deprecation Notices to specify which type of instance to create (single or burst), and additional calls for ``rte_distributor_poll_pkt_burst`` and ``rte_distributor_return_pkt_burst``, among others. + +* eal: the following functions are deprecated starting from 17.02 and will + be removed in 17.08: + + - ``rte_set_log_level``, replaced by ``rte_log_set_global_level`` + - ``rte_get_log_level``, replaced by ``rte_log_get_global_level`` + - ``rte_set_log_type``, replaced by ``rte_log_set_level`` + - ``rte_get_log_type``, replaced by ``rte_log_get_level`` diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index 57df8efdb..5ba74e2e9 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -321,7 +321,7 @@ main(int argc, char **argv) uint8_t port_id; - rte_set_log_level(RTE_LOG_INFO); + rte_log_set_global_level(RTE_LOG_INFO); ret = rte_eal_init(argc, argv); if (ret < 0) diff --git a/examples/quota_watermark/qwctl/qwctl.c b/examples/quota_watermark/qwctl/qwctl.c index 3a85cc32a..7db66a1d6 100644 --- a/examples/quota_watermark/qwctl/qwctl.c +++ b/examples/quota_watermark/qwctl/qwctl.c @@ -75,7 +75,7 @@ int main(int argc, char **argv) int ret; struct cmdline *cl; - rte_set_log_level(RTE_LOG_INFO); + rte_log_set_global_level(RTE_LOG_INFO); ret = rte_eal_init(argc, argv); if (ret < 0) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index be829cb58..bccaafad3 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -182,6 +182,8 @@ DPDK_17.02 { rte_bus_unregister; rte_log_dump; rte_log_register; + rte_log_get_global_level; + rte_log_set_global_level; rte_log_set_level; rte_log_set_level_regexp; diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index 513249e51..dd4d30ca7 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -84,20 +84,36 @@ rte_openlog_stream(FILE *f) /* Set global log level */ void -rte_set_log_level(uint32_t level) +rte_log_set_global_level(uint32_t level) { rte_logs.level = (uint32_t)level; } +/* Set global log level */ +/* replaced by rte_log_set_global_level */ +__rte_deprecated void +rte_set_log_level(uint32_t level) +{ + rte_log_set_global_level(level); +} + /* Get global log level */ uint32_t -rte_get_log_level(void) +rte_log_get_global_level(void) { return rte_logs.level; } +/* Get global log level */ +/* replaced by rte_log_get_global_level */ +uint32_t +rte_get_log_level(void) +{ + return rte_log_get_global_level(); +} + /* Set global log type */ -void +__rte_deprecated void rte_set_log_type(uint32_t type, int enable) { if (type < RTE_LOGTYPE_FIRST_EXT_ID) { @@ -114,7 +130,7 @@ rte_set_log_type(uint32_t type, int enable) } /* Get global log type */ -uint32_t +__rte_deprecated uint32_t rte_get_log_type(void) { return rte_logs.type; diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index ce48b0785..27c40b452 100644 --- a/lib/librte_eal/common/include/rte_log.h +++ b/lib/librte_eal/common/include/rte_log.h @@ -50,6 +50,8 @@ extern "C" { #include #include +#include + struct rte_log_dynamic_type; /** The rte_log structure. */ @@ -132,11 +134,26 @@ int rte_openlog_stream(FILE *f); * @param level * Log level. A value between RTE_LOG_EMERG (1) and RTE_LOG_DEBUG (8). */ +void rte_log_set_global_level(uint32_t level); + +/** + * Deprecated, replaced by rte_log_set_global_level(). + */ +__rte_deprecated void rte_set_log_level(uint32_t level); /** * Get the global log level. + * + * @return + * The current global log level. + */ +uint32_t rte_log_get_global_level(void); + +/** + * Deprecated, replaced by rte_log_get_global_level(). */ +__rte_deprecated uint32_t rte_get_log_level(void); /** @@ -147,11 +164,13 @@ uint32_t rte_get_log_level(void); * @param enable * True for enable; false for disable. */ +__rte_deprecated void rte_set_log_type(uint32_t type, int enable); /** * Get the global log type. */ +__rte_deprecated uint32_t rte_get_log_type(void); /** diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index a8116edee..3b50c4c3c 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -186,6 +186,8 @@ DPDK_17.02 { rte_bus_unregister; rte_log_dump; rte_log_register; + rte_log_get_global_level; + rte_log_set_global_level; rte_log_set_level; rte_log_set_level_regexp; diff --git a/test/test/test_logs.c b/test/test/test_logs.c index 805c56810..730a86bd9 100644 --- a/test/test/test_logs.c +++ b/test/test/test_logs.c @@ -66,12 +66,12 @@ test_logs(void) rte_log_set_level(RTE_LOGTYPE_TESTAPP2, RTE_LOG_EMERG); /* log in error level */ - rte_set_log_level(RTE_LOG_ERR); + rte_log_set_global_level(RTE_LOG_ERR); RTE_LOG(ERR, TESTAPP1, "error message\n"); RTE_LOG(CRIT, TESTAPP1, "critical message\n"); /* log in critical level */ - rte_set_log_level(RTE_LOG_CRIT); + rte_log_set_global_level(RTE_LOG_CRIT); RTE_LOG(ERR, TESTAPP2, "error message (not displayed)\n"); RTE_LOG(CRIT, TESTAPP2, "critical message\n"); @@ -79,7 +79,7 @@ test_logs(void) rte_log_set_level(RTE_LOGTYPE_TESTAPP2, RTE_LOG_DEBUG); /* log in error level */ - rte_set_log_level(RTE_LOG_ERR); + rte_log_set_global_level(RTE_LOG_ERR); RTE_LOG(ERR, TESTAPP1, "error message\n"); RTE_LOG(ERR, TESTAPP2, "error message (not displayed)\n"); -- 2.11.0