DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: mb@smartsharesystems.com, david.marchand@redhat.com,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [RFC PATCH v2 2/3] log: separate logging functions out of EAL
Date: Fri, 13 Jan 2023 16:20:00 +0000	[thread overview]
Message-ID: <20230113162001.519534-3-bruce.richardson@intel.com> (raw)
In-Reply-To: <20230113162001.519534-1-bruce.richardson@intel.com>

Move the logging capability to a separate library, free from EAL.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/eal/common/eal_private.h                  |  7 ----
 lib/eal/common/meson.build                    |  1 -
 lib/eal/include/meson.build                   |  1 -
 lib/eal/linux/meson.build                     |  1 -
 lib/eal/meson.build                           |  2 +-
 lib/eal/version.map                           | 17 ----------
 lib/eal/windows/meson.build                   |  1 -
 lib/kvargs/meson.build                        |  3 +-
 lib/{eal/common => log}/eal_common_log.c      |  1 -
 lib/{eal/common => log}/eal_log.h             | 12 +++++++
 .../linux/eal_log.c => log/eal_log_linux.c}   |  0
 .../eal_log.c => log/eal_log_windows.c}       |  0
 lib/log/meson.build                           |  9 +++++
 lib/{eal/include => log}/rte_log.h            |  0
 lib/log/version.map                           | 34 +++++++++++++++++++
 lib/meson.build                               |  1 +
 lib/telemetry/meson.build                     |  3 +-
 17 files changed, 59 insertions(+), 34 deletions(-)
 rename lib/{eal/common => log}/eal_common_log.c (99%)
 rename lib/{eal/common => log}/eal_log.h (78%)
 rename lib/{eal/linux/eal_log.c => log/eal_log_linux.c} (100%)
 rename lib/{eal/windows/eal_log.c => log/eal_log_windows.c} (100%)
 create mode 100644 lib/log/meson.build
 rename lib/{eal/include => log}/rte_log.h (100%)
 create mode 100644 lib/log/version.map

diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 0f4d75bb89..dbf60190f4 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -152,13 +152,6 @@ int rte_eal_tailqs_init(void);
  */
 int rte_eal_intr_init(void);
 
-/**
- * Close the default log stream
- *
- * This function is private to EAL.
- */
-void rte_eal_log_cleanup(void);
-
 /**
  * Init alarm mechanism. This is to allow a callback be called after
  * specific time.
diff --git a/lib/eal/common/meson.build b/lib/eal/common/meson.build
index 917758cc65..22a626ba6f 100644
--- a/lib/eal/common/meson.build
+++ b/lib/eal/common/meson.build
@@ -18,7 +18,6 @@ sources += files(
         'eal_common_interrupts.c',
         'eal_common_launch.c',
         'eal_common_lcore.c',
-        'eal_common_log.c',
         'eal_common_mcfg.c',
         'eal_common_memalloc.c',
         'eal_common_memory.c',
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index cfcd40aaed..1eaa074d1b 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -27,7 +27,6 @@ headers += files(
         'rte_keepalive.h',
         'rte_launch.h',
         'rte_lcore.h',
-        'rte_log.h',
         'rte_malloc.h',
         'rte_mcslock.h',
         'rte_memory.h',
diff --git a/lib/eal/linux/meson.build b/lib/eal/linux/meson.build
index 3cccfa36c0..1b913acc06 100644
--- a/lib/eal/linux/meson.build
+++ b/lib/eal/linux/meson.build
@@ -11,7 +11,6 @@ sources += files(
         'eal_hugepage_info.c',
         'eal_interrupts.c',
         'eal_lcore.c',
-        'eal_log.c',
         'eal_memalloc.c',
         'eal_memory.c',
         'eal_thread.c',
diff --git a/lib/eal/meson.build b/lib/eal/meson.build
index 056beb9461..af8c4eae4a 100644
--- a/lib/eal/meson.build
+++ b/lib/eal/meson.build
@@ -22,7 +22,7 @@ subdir(exec_env)
 
 subdir(arch_subdir)
 
-deps += ['kvargs']
+deps += ['log', 'kvargs']
 if not is_windows
     deps += ['telemetry']
 endif
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 7ad12a7dc9..3fb11a16b2 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -140,21 +140,6 @@ DPDK_23 {
 	rte_lcore_iterate;
 	rte_lcore_to_cpu_id;
 	rte_lcore_to_socket_id;
-	rte_log;
-	rte_log_can_log;
-	rte_log_cur_msg_loglevel;
-	rte_log_cur_msg_logtype;
-	rte_log_dump;
-	rte_log_get_global_level;
-	rte_log_get_level;
-	rte_log_get_stream;
-	rte_log_list_types;
-	rte_log_register;
-	rte_log_register_type_and_pick_level;
-	rte_log_set_global_level;
-	rte_log_set_level;
-	rte_log_set_level_pattern;
-	rte_log_set_level_regexp;
 	rte_malloc;
 	rte_malloc_dump_heaps;
 	rte_malloc_dump_stats;
@@ -225,7 +210,6 @@ DPDK_23 {
 	rte_mp_request_async;
 	rte_mp_request_sync;
 	rte_mp_sendmsg;
-	rte_openlog_stream;
 	rte_rand;
 	rte_rand_max;
 	rte_realloc;
@@ -299,7 +283,6 @@ DPDK_23 {
 	rte_vfio_noiommu_is_enabled; # WINDOWS_NO_EXPORT
 	rte_vfio_release_device; # WINDOWS_NO_EXPORT
 	rte_vfio_setup_device; # WINDOWS_NO_EXPORT
-	rte_vlog;
 	rte_zmalloc;
 	rte_zmalloc_socket;
 
diff --git a/lib/eal/windows/meson.build b/lib/eal/windows/meson.build
index e4b2427610..7756d417be 100644
--- a/lib/eal/windows/meson.build
+++ b/lib/eal/windows/meson.build
@@ -12,7 +12,6 @@ sources += files(
         'eal_hugepages.c',
         'eal_interrupts.c',
         'eal_lcore.c',
-        'eal_log.c',
         'eal_memalloc.c',
         'eal_memory.c',
         'eal_mp.c',
diff --git a/lib/kvargs/meson.build b/lib/kvargs/meson.build
index b746516965..7eae744a8f 100644
--- a/lib/kvargs/meson.build
+++ b/lib/kvargs/meson.build
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-includes = [global_inc]
-
+deps += 'log'
 sources = files('rte_kvargs.c')
 headers = files('rte_kvargs.h')
diff --git a/lib/eal/common/eal_common_log.c b/lib/log/eal_common_log.c
similarity index 99%
rename from lib/eal/common/eal_common_log.c
rename to lib/log/eal_common_log.c
index bd7b188ceb..895c4f2040 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/log/eal_common_log.c
@@ -16,7 +16,6 @@
 #include <rte_per_lcore.h>
 
 #include "eal_log.h"
-#include "eal_private.h"
 
 struct rte_log_dynamic_type {
 	const char *name;
diff --git a/lib/eal/common/eal_log.h b/lib/log/eal_log.h
similarity index 78%
rename from lib/eal/common/eal_log.h
rename to lib/log/eal_log.h
index c784fa6043..d04662729b 100644
--- a/lib/eal/common/eal_log.h
+++ b/lib/log/eal_log.h
@@ -7,26 +7,38 @@
 
 #include <stdio.h>
 #include <stdint.h>
+#include <rte_compat.h>
 
 /*
  * Initialize the default log stream.
  */
+__rte_internal
 int eal_log_init(const char *id, int facility);
 
 /*
  * Determine where log data is written when no call to rte_openlog_stream.
  */
+__rte_internal
 void eal_log_set_default(FILE *default_log);
 
 /*
  * Save a log option for later.
  */
+__rte_internal
 int eal_log_save_regexp(const char *regexp, uint32_t level);
+__rte_internal
 int eal_log_save_pattern(const char *pattern, uint32_t level);
 
 /*
  * Convert log level to string.
  */
+__rte_internal
 const char *eal_log_level2str(uint32_t level);
 
+/*
+ * Close the default log stream
+ */
+__rte_internal
+void rte_eal_log_cleanup(void);
+
 #endif /* EAL_LOG_H */
diff --git a/lib/eal/linux/eal_log.c b/lib/log/eal_log_linux.c
similarity index 100%
rename from lib/eal/linux/eal_log.c
rename to lib/log/eal_log_linux.c
diff --git a/lib/eal/windows/eal_log.c b/lib/log/eal_log_windows.c
similarity index 100%
rename from lib/eal/windows/eal_log.c
rename to lib/log/eal_log_windows.c
diff --git a/lib/log/meson.build b/lib/log/meson.build
new file mode 100644
index 0000000000..4aeb17b265
--- /dev/null
+++ b/lib/log/meson.build
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+includes += global_inc
+sources = files(
+        'eal_common_log.c',
+        'eal_log_' + exec_env + '.c'
+)
+headers = files('rte_log.h')
diff --git a/lib/eal/include/rte_log.h b/lib/log/rte_log.h
similarity index 100%
rename from lib/eal/include/rte_log.h
rename to lib/log/rte_log.h
diff --git a/lib/log/version.map b/lib/log/version.map
new file mode 100644
index 0000000000..726ff9fbcf
--- /dev/null
+++ b/lib/log/version.map
@@ -0,0 +1,34 @@
+DPDK_23 {
+	global:
+
+	rte_log;
+	rte_log_cur_msg_loglevel;
+	rte_log_cur_msg_logtype;
+	rte_log_can_log;
+	rte_log_dump;
+	rte_log_get_global_level;
+	rte_log_get_level;
+	rte_log_get_stream;
+	rte_log_list_types;
+	rte_log_register;
+	rte_log_register_type_and_pick_level;
+	rte_log_set_global_level;
+	rte_log_set_level;
+	rte_log_set_level_pattern;
+	rte_log_set_level_regexp;
+	rte_openlog_stream;
+	rte_vlog;
+
+	local: *;
+};
+
+INTERNAL {
+	global:
+
+	eal_log_init;
+	eal_log_level2str;
+	eal_log_save_pattern;
+	eal_log_save_regexp;
+	eal_log_set_default;
+	rte_eal_log_cleanup;
+};
diff --git a/lib/meson.build b/lib/meson.build
index a90fee31b7..06e8bd7206 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -9,6 +9,7 @@
 # given as a dep, no need to mention ring. This is especially true for the
 # core libs which are widely reused, so their deps are kept to a minimum.
 libraries = [
+        'log',
         'kvargs', # eal depends on kvargs
         'telemetry', # basic info querying
         'eal', # everything depends on eal
diff --git a/lib/telemetry/meson.build b/lib/telemetry/meson.build
index f84c9aa3be..489d000047 100644
--- a/lib/telemetry/meson.build
+++ b/lib/telemetry/meson.build
@@ -1,8 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-includes = [global_inc]
-
+deps += 'log'
 sources = files('telemetry.c', 'telemetry_data.c', 'telemetry_legacy.c')
 headers = files('rte_telemetry.h')
 includes += include_directories('../metrics')
-- 
2.34.1


  parent reply	other threads:[~2023-01-13 16:20 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 15:18 [RFC PATCH 0/3] Split logging " Bruce Richardson
2022-08-29 15:18 ` [RFC PATCH 1/3] os: begin separating some OS compatibility from EAL Bruce Richardson
2022-08-29 18:57   ` Morten Brørup
2022-08-30  8:41     ` Bruce Richardson
2022-08-30  8:42   ` David Marchand
2022-08-30  9:59     ` Bruce Richardson
2022-08-29 15:19 ` [RFC PATCH 2/3] log: separate logging functions out of EAL Bruce Richardson
2022-08-29 15:19 ` [RFC PATCH 3/3] telemetry: use standard logging Bruce Richardson
2023-01-13 16:19 ` [RFC PATCH v2 0/3] Split logging functionality out of EAL Bruce Richardson
2023-01-13 16:19   ` [RFC PATCH v2 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-01-13 16:41     ` Morten Brørup
2023-01-13 17:01       ` Bruce Richardson
2023-01-13 17:31         ` Tyler Retzlaff
2023-01-13 17:37           ` Bruce Richardson
2023-01-13 16:20   ` Bruce Richardson [this message]
2023-01-13 16:20   ` [RFC PATCH v2 3/3] telemetry: use standard logging Bruce Richardson
2023-01-13 20:36 ` [PATCH v3 0/3] Split logging functionality out of EAL Bruce Richardson
2023-01-13 20:36   ` [PATCH v3 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-01-13 20:36   ` [PATCH v3 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-01-13 20:36   ` [PATCH v3 3/3] telemetry: use standard logging Bruce Richardson
2023-01-20 18:21 ` [PATCH v4 0/3] Split logging functionality out of EAL Bruce Richardson
2023-01-20 18:21   ` [PATCH v4 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-01-20 18:21   ` [PATCH v4 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-01-20 18:21   ` [PATCH v4 3/3] telemetry: use standard logging Bruce Richardson
2023-01-22 14:56   ` [PATCH v4 0/3] Split logging functionality out of EAL David Marchand
2023-01-23 14:24     ` Bruce Richardson
2023-01-23 14:31       ` David Marchand
2023-01-23 14:36         ` Bruce Richardson
2023-01-23 14:42           ` David Marchand
2023-05-18 12:49 ` [PATCH v5 " Bruce Richardson
2023-05-18 12:49   ` [PATCH v5 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-05-18 12:49   ` [PATCH v5 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-05-18 12:49   ` [PATCH v5 3/3] telemetry: use standard logging Bruce Richardson
2023-07-31 10:17 ` [PATCH v6 0/3] Split logging functionality out of EAL Bruce Richardson
2023-07-31 10:17   ` [PATCH v6 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-07-31 10:17   ` [PATCH v6 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-07-31 10:17   ` [PATCH v6 3/3] telemetry: use standard logging Bruce Richardson
2023-07-31 15:38 ` [PATCH v7 0/3] Split logging functionality out of EAL Bruce Richardson
2023-07-31 15:39   ` [PATCH v7 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-08-09 11:18     ` David Marchand
2023-08-09 12:35       ` Bruce Richardson
2023-07-31 15:39   ` [PATCH v7 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-07-31 16:22     ` David Marchand
2023-07-31 16:29       ` Bruce Richardson
2023-08-09 10:00         ` Bruce Richardson
2023-08-09 11:58     ` David Marchand
2023-08-09 12:24     ` David Marchand
2023-08-09 12:32       ` Bruce Richardson
2023-07-31 15:39   ` [PATCH v7 3/3] telemetry: use standard logging Bruce Richardson
2023-08-09 13:35 ` [PATCH v8 0/3] Split logging functionality out of EAL Bruce Richardson
2023-08-09 13:35   ` [PATCH v8 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-08-09 13:35   ` [PATCH v8 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-08-09 13:35   ` [PATCH v8 3/3] telemetry: use standard logging Bruce Richardson
2023-08-11 12:46   ` [PATCH v8 0/3] Split logging functionality out of EAL David Marchand
2023-08-11 12:59     ` Bruce Richardson
2023-09-01 11:25       ` Thomas Monjalon
2023-09-01 12:26         ` Morten Brørup
2023-10-23  7:37     ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230113162001.519534-3-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).