[dpdk-dev] [PATCH 8/8] log: hide internal log structure
Stephen Hemminger
stephen at networkplumber.org
Tue Oct 22 18:35:20 CEST 2019
On Tue, 22 Oct 2019 11:32:41 +0200
David Marchand <david.marchand at redhat.com> wrote:
> No need to expose rte_logs, hide it and remove it from the current ABI.
>
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> ---
> lib/librte_eal/common/eal_common_log.c | 23 ++++++++++++++++-------
> lib/librte_eal/common/include/rte_log.h | 20 +++-----------------
> lib/librte_eal/rte_eal_version.map | 1 -
> 3 files changed, 19 insertions(+), 25 deletions(-)
>
> diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
> index cfe9599..3a7ab88 100644
> --- a/lib/librte_eal/common/eal_common_log.c
> +++ b/lib/librte_eal/common/eal_common_log.c
> @@ -17,13 +17,6 @@
>
> #include "eal_private.h"
>
> -/* global log structure */
> -struct rte_logs rte_logs = {
> - .type = ~0,
> - .level = RTE_LOG_DEBUG,
> - .file = NULL,
> -};
> -
> struct rte_eal_opt_loglevel {
> /** Next list entry */
> TAILQ_ENTRY(rte_eal_opt_loglevel) next;
> @@ -58,6 +51,22 @@ struct rte_log_dynamic_type {
> uint32_t loglevel;
> };
>
> +/** The rte_log structure. */
> +struct rte_logs {
> + uint32_t type; /**< Bitfield with enabled logs. */
> + uint32_t level; /**< Log level. */
> + FILE *file; /**< Output file set by rte_openlog_stream, or NULL. */
> + size_t dynamic_types_len;
> + struct rte_log_dynamic_type *dynamic_types;
> +};
> +
> +/* global log structure */
> +static struct rte_logs rte_logs = {
> + .type = ~0,
> + .level = RTE_LOG_DEBUG,
> + .file = NULL,
> +};
> +
> /* per core log */
> static RTE_DEFINE_PER_LCORE(struct log_cur_msg, log_cur_msg);
>
> diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
> index 1bb0e66..a8d0eb7 100644
> --- a/lib/librte_eal/common/include/rte_log.h
> +++ b/lib/librte_eal/common/include/rte_log.h
> @@ -26,20 +26,6 @@ extern "C" {
> #include <rte_config.h>
> #include <rte_compat.h>
>
> -struct rte_log_dynamic_type;
> -
> -/** The rte_log structure. */
> -struct rte_logs {
> - uint32_t type; /**< Bitfield with enabled logs. */
> - uint32_t level; /**< Log level. */
> - FILE *file; /**< Output file set by rte_openlog_stream, or NULL. */
> - size_t dynamic_types_len;
> - struct rte_log_dynamic_type *dynamic_types;
> -};
> -
> -/** Global log information */
> -extern struct rte_logs rte_logs;
> -
> /* SDK log type */
> #define RTE_LOGTYPE_EAL 0 /**< Log related to eal. */
> #define RTE_LOGTYPE_MALLOC 1 /**< Log related to malloc. */
> @@ -260,7 +246,7 @@ void rte_log_dump(FILE *f);
> * to rte_openlog_stream().
> *
> * The level argument determines if the log should be displayed or
> - * not, depending on the global rte_logs variable.
> + * not, depending on the global log level and the per logtype level.
> *
> * The preferred alternative is the RTE_LOG() because it adds the
> * level and type in the logged string.
> @@ -291,8 +277,8 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...)
> * to rte_openlog_stream().
> *
> * The level argument determines if the log should be displayed or
> - * not, depending on the global rte_logs variable. A trailing
> - * newline may be added if needed.
> + * not, depending on the global log level and the per logtype level.
> + * A trailing newline may be added if needed.
> *
> * The preferred alternative is the RTE_LOG() because it adds the
> * level and type in the logged string.
> diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
> index 6d7e0e4..ca9ace0 100644
> --- a/lib/librte_eal/rte_eal_version.map
> +++ b/lib/librte_eal/rte_eal_version.map
> @@ -45,7 +45,6 @@ DPDK_2.0 {
> rte_log;
> rte_log_cur_msg_loglevel;
> rte_log_cur_msg_logtype;
> - rte_logs;
> rte_malloc;
> rte_malloc_dump_stats;
> rte_malloc_get_socket_stats;
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
More information about the dev
mailing list