[8/8] log: hide internal log structure

Message ID 1571736761-32134-9-git-send-email-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Headers
Series EAL and PCI ABI changes for 19.11 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed

Commit Message

David Marchand Oct. 22, 2019, 9:32 a.m. UTC
  No need to expose rte_logs, hide it and remove it from the current ABI.

Signed-off-by: David Marchand <david.marchand@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(-)
  

Comments

Stephen Hemminger Oct. 22, 2019, 4:35 p.m. UTC | #1
On Tue, 22 Oct 2019 11:32:41 +0200
David Marchand <david.marchand@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@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@networkplumber.org>
  
David Marchand Oct. 23, 2019, 1:02 p.m. UTC | #2
On Tue, Oct 22, 2019 at 11:33 AM David Marchand
<david.marchand@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@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(-)

Note to self.
If we go with this patch, an update of the release notes is missing.
  

Patch

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;