From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id F2DA1A0A02;
	Mon,  5 Apr 2021 21:30:15 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 0F54C140E4C;
	Mon,  5 Apr 2021 21:30:11 +0200 (CEST)
Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com
 [66.111.4.26]) by mails.dpdk.org (Postfix) with ESMTP id 251D84014E
 for <dev@dpdk.org>; Mon,  5 Apr 2021 21:30:09 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id BAB6F5C0100;
 Mon,  5 Apr 2021 15:30:08 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Mon, 05 Apr 2021 15:30:08 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding; s=fm3; bh=lGFum1wNrN28l
 /0MFa5xIO7zBo8OHjyVrwNNEBRubNA=; b=xlaRlNvzwqw10hrqypN0fPS+qFtPd
 iUmjToL/OtL5i2KJzOqNYz0UYpmbdxzeg9RKw+4lTRYePQagCpc2MoevFVDo9M6O
 H/baz2lqS2JQg1ZEuro2/jdxQdCSRtSXt12d++Opxt62XJpZkFKTb9QLu1CLl278
 lZ24pyuTgW88ifc8o87KK7N4PQ18Yk40d2Ma8CeES7CXd84dzMtmqr/lidYzyyFA
 2rIpSBHOtNVA4aNc7E5MZ+ZNyyeCceWC1B4S7ltvnHxCL9wGGbq8oJfdc9sUvRXv
 /4FysOEeLRW1oGyu9VO+0tXxoEUf7NeZbsKPxQKSDezpXUvQvWJZnqYPg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:date:from
 :in-reply-to:message-id:mime-version:references:subject:to
 :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm2; bh=lGFum1wNrN28l/0MFa5xIO7zBo8OHjyVrwNNEBRubNA=; b=meBRiILL
 KAIKGXM/vTXHvwUyv/nEWwasXsERHVbJjkoFHU/pWzS3keTeyoBrvdwlnY3AtOPz
 lpX3RJt1ZkQYLe4Nt4mbxbn5YnSvhyEn1+MGAV1ux8kOSgitYOUX3F+4ujyAjup/
 ghyZkhejTR+7JwzEhKdIZIA4bTlxyvUszxJ2QT3k1CxbJgKIbmicUMjzBn07L/jZ
 mUpdIw9GKNhYqOOnv0mgaPvebLFJ0hjSZgzHT3d3JOmKaJVkYgZZdEaL7dt4KOFx
 Ss1mKSMPtODxGYAzG3xs8IWrwLllyJkvv6lVTBZz/gL/2lE2NJQvTxs9ZLqTnLLZ
 IPYLFAIr5MgGcg==
X-ME-Sender: <xms:QGVrYCNv9829hZ-THVk7daFZcsy9CCgMVQTBUxVpxOlAP7RgUsqwQQ>
 <xme:QGVrYBoyJ12WXWdfZFxtCEong2LUIOsnz2I5udF8r6qlR7UfsHSbez5kIKkb3WLkJ
 nDqLjvlK05HIcQ0Bg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudejvddgudegtdcutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd
 enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm
 rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc
 ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt
 gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh
 fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr
 lhhonhdrnhgvth
X-ME-Proxy: <xmx:QGVrYHeFYOQI_s--pO8PIc7NdEoPPq4UOoDq1uB5Wbls2OvG1qBzMg>
 <xmx:QGVrYHQdA4NtoSrLpMZWVVmj8rNu6et6e9IS1hD79LT4vbpEGQ02GA>
 <xmx:QGVrYAYelMfoAP2Luqw1GkEWadZ45v4VLXyCxNhbIMH1pINT9zEPfA>
 <xmx:QGVrYLxDuqRxWNTfQpp6suAnYSuVDf1TYtpa6hDIkpdnTjQPptit7g>
Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 22E2524005D;
 Mon,  5 Apr 2021 15:30:07 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: david.marchand@redhat.com, Bruce Richardson <bruce.richardson@intel.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
 Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
 Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,
 Dmitry Malloy <dmitrym@microsoft.com>,
 Pallavi Kadam <pallavi.kadam@intel.com>
Date: Mon,  5 Apr 2021 21:29:57 +0200
Message-Id: <20210405193000.1113542-2-thomas@monjalon.net>
X-Mailer: git-send-email 2.31.1
In-Reply-To: <20210405193000.1113542-1-thomas@monjalon.net>
References: <20210309233116.1934666-1-thomas@monjalon.net>
 <20210405193000.1113542-1-thomas@monjalon.net>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v5 1/4] log: move private functions
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Some private log functions had a wrong "rte_" prefix.

All private log functions are moved from eal_private.h
to the new file eal_log.h:
	rte_eal_log_init -> eal_log_init
	rte_log_save_regexp -> eal_log_save_regexp
	rte_log_save_pattern -> eal_log_save_pattern
	eal_log_set_default

The static functions in the file eal_common_log.c are renamed:
	rte_log_save_level -> log_save_level
	rte_log_init -> log_init

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 lib/librte_eal/common/eal_common_log.c     | 28 +++++++++++----------
 lib/librte_eal/common/eal_common_options.c |  5 ++--
 lib/librte_eal/common/eal_log.h            | 27 ++++++++++++++++++++
 lib/librte_eal/common/eal_private.h        | 29 ----------------------
 lib/librte_eal/linux/eal.c                 |  3 ++-
 lib/librte_eal/linux/eal_log.c             |  4 +--
 lib/librte_eal/windows/eal.c               |  3 ++-
 lib/librte_eal/windows/eal_log.c           |  6 +++--
 8 files changed, 55 insertions(+), 50 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_log.h

diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
index c5554badb2..058fa10ffc 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -15,7 +15,7 @@
 #include <rte_log.h>
 #include <rte_per_lcore.h>
 
-#include "eal_private.h"
+#include "eal_log.h"
 
 struct rte_log_dynamic_type {
 	const char *name;
@@ -178,8 +178,8 @@ rte_log_set_level_regexp(const char *regex, uint32_t level)
  * Save the type string and the loglevel for later dynamic
  * logtypes which may register later.
  */
-static int rte_log_save_level(int priority,
-			      const char *regex, const char *pattern)
+static int
+log_save_level(uint32_t priority, const char *regex, const char *pattern)
 {
 	struct rte_eal_opt_loglevel *opt_ll = NULL;
 
@@ -207,9 +207,10 @@ static int rte_log_save_level(int priority,
 	return -1;
 }
 
-int rte_log_save_regexp(const char *regex, int tmp)
+int
+eal_log_save_regexp(const char *regex, uint32_t level)
 {
-	return rte_log_save_level(tmp, regex, NULL);
+	return log_save_level(level, regex, NULL);
 }
 
 /* set log level based on globbing pattern */
@@ -232,9 +233,10 @@ rte_log_set_level_pattern(const char *pattern, uint32_t level)
 	return 0;
 }
 
-int rte_log_save_pattern(const char *pattern, int priority)
+int
+eal_log_save_pattern(const char *pattern, uint32_t level)
 {
-	return rte_log_save_level(priority, NULL, pattern);
+	return log_save_level(level, NULL, pattern);
 }
 
 /* get the current loglevel for the message being processed */
@@ -250,7 +252,7 @@ int rte_log_cur_msg_logtype(void)
 }
 
 static int
-rte_log_lookup(const char *name)
+log_lookup(const char *name)
 {
 	size_t i;
 
@@ -268,7 +270,7 @@ rte_log_lookup(const char *name)
  * is not yet registered.
  */
 static int
-__rte_log_register(const char *name, int id)
+log_register(const char *name, int id)
 {
 	char *dup_name = strdup(name);
 
@@ -288,7 +290,7 @@ rte_log_register(const char *name)
 	struct rte_log_dynamic_type *new_dynamic_types;
 	int id, ret;
 
-	id = rte_log_lookup(name);
+	id = log_lookup(name);
 	if (id >= 0)
 		return id;
 
@@ -299,7 +301,7 @@ rte_log_register(const char *name)
 		return -ENOMEM;
 	rte_logs.dynamic_types = new_dynamic_types;
 
-	ret = __rte_log_register(name, rte_logs.dynamic_types_len);
+	ret = log_register(name, rte_logs.dynamic_types_len);
 	if (ret < 0)
 		return ret;
 
@@ -376,7 +378,7 @@ static const struct logtype logtype_strings[] = {
 };
 
 /* Logging should be first initializer (before drivers and bus) */
-RTE_INIT_PRIO(rte_log_init, LOG)
+RTE_INIT_PRIO(log_init, LOG)
 {
 	uint32_t i;
 
@@ -389,7 +391,7 @@ RTE_INIT_PRIO(rte_log_init, LOG)
 
 	/* register legacy log types */
 	for (i = 0; i < RTE_DIM(logtype_strings); i++)
-		__rte_log_register(logtype_strings[i].logtype,
+		log_register(logtype_strings[i].logtype,
 				logtype_strings[i].log_id);
 
 	rte_logs.dynamic_types_len = RTE_LOGTYPE_FIRST_EXT_ID;
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 622c7bc429..cd1a2856c9 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -41,6 +41,7 @@
 #include "eal_options.h"
 #include "eal_filesystem.h"
 #include "eal_private.h"
+#include "eal_log.h"
 #ifndef RTE_EXEC_ENV_WINDOWS
 #include "eal_trace.h"
 #endif
@@ -1299,7 +1300,7 @@ eal_parse_log_level(const char *arg)
 				regex, priority);
 			goto fail;
 		}
-		if (rte_log_save_regexp(regex, priority) < 0)
+		if (eal_log_save_regexp(regex, priority) < 0)
 			goto fail;
 	} else if (pattern) {
 		if (rte_log_set_level_pattern(pattern, priority) < 0) {
@@ -1307,7 +1308,7 @@ eal_parse_log_level(const char *arg)
 				pattern, priority);
 			goto fail;
 		}
-		if (rte_log_save_pattern(pattern, priority) < 0)
+		if (eal_log_save_pattern(pattern, priority) < 0)
 			goto fail;
 	} else {
 		rte_log_set_global_level(priority);
diff --git a/lib/librte_eal/common/eal_log.h b/lib/librte_eal/common/eal_log.h
new file mode 100644
index 0000000000..684650a17b
--- /dev/null
+++ b/lib/librte_eal/common/eal_log.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2021 Mellanox Technologies, Ltd
+ */
+
+#ifndef EAL_LOG_H
+#define EAL_LOG_H
+
+#include <stdio.h>
+#include <stdint.h>
+
+/*
+ * Initialize the default log stream.
+ */
+int eal_log_init(const char *id, int facility);
+
+/*
+ * Determine where log data is written when no call to rte_openlog_stream.
+ */
+void eal_log_set_default(FILE *default_log);
+
+/*
+ * Save a log option for later.
+ */
+int eal_log_save_regexp(const char *regexp, uint32_t level);
+int eal_log_save_pattern(const char *pattern, uint32_t level);
+
+#endif /* EAL_LOG_H */
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index b8a0d20021..e3512111d9 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -79,19 +79,6 @@ struct rte_config *rte_eal_get_configuration(void);
  */
 int rte_eal_memzone_init(void);
 
-/**
- * Common log initialization function (private to eal).  Determines
- * where log data is written when no call to rte_openlog_stream is
- * in effect.
- *
- * @param default_log
- *   The default log stream to be used.
- * @return
- *   - 0 on success
- *   - Negative on error
- */
-void eal_log_set_default(FILE *default_log);
-
 /**
  * Fill configuration with number of physical and logical processors
  *
@@ -143,22 +130,6 @@ int rte_eal_memory_init(void);
  */
 int rte_eal_timer_init(void);
 
-/**
- * Init the default log stream
- *
- * This function is private to EAL.
- *
- * @return
- *   0 on success, negative on error
- */
-int rte_eal_log_init(const char *id, int facility);
-
-/**
- * Save the log regexp for later
- */
-int rte_log_save_regexp(const char *type, int priority);
-int rte_log_save_pattern(const char *pattern, int priority);
-
 /**
  * Init tail queues for non-EAL library structures. This is to allow
  * the rings, mempools, etc. lists to be shared among multiple processes
diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c
index abbb537746..ac27dd4274 100644
--- a/lib/librte_eal/linux/eal.c
+++ b/lib/librte_eal/linux/eal.c
@@ -58,6 +58,7 @@
 #include "eal_hugepages.h"
 #include "eal_memcfg.h"
 #include "eal_trace.h"
+#include "eal_log.h"
 #include "eal_options.h"
 #include "eal_vfio.h"
 #include "hotplug_mp.h"
@@ -1160,7 +1161,7 @@ rte_eal_init(int argc, char **argv)
 #endif
 	}
 
-	if (rte_eal_log_init(logid, internal_conf->syslog_facility) < 0) {
+	if (eal_log_init(logid, internal_conf->syslog_facility) < 0) {
 		rte_eal_init_alert("Cannot init logging.");
 		rte_errno = ENOMEM;
 		__atomic_store_n(&run_once, 0, __ATOMIC_RELAXED);
diff --git a/lib/librte_eal/linux/eal_log.c b/lib/librte_eal/linux/eal_log.c
index 2095df74c5..c0aa1007c4 100644
--- a/lib/librte_eal/linux/eal_log.c
+++ b/lib/librte_eal/linux/eal_log.c
@@ -17,7 +17,7 @@
 #include <rte_spinlock.h>
 #include <rte_log.h>
 
-#include "eal_private.h"
+#include "eal_log.h"
 
 /*
  * default log function
@@ -46,7 +46,7 @@ static cookie_io_functions_t console_log_func = {
  * once memzones are available.
  */
 int
-rte_eal_log_init(const char *id, int facility)
+eal_log_init(const char *id, int facility)
 {
 	FILE *log_stream;
 
diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c
index 2fc3d6141c..68a1fd1d21 100644
--- a/lib/librte_eal/windows/eal.c
+++ b/lib/librte_eal/windows/eal.c
@@ -22,6 +22,7 @@
 
 #include "eal_hugepages.h"
 #include "eal_trace.h"
+#include "eal_log.h"
 #include "eal_windows.h"
 
 #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)
@@ -267,7 +268,7 @@ rte_eal_init(int argc, char **argv)
 		eal_get_internal_configuration();
 	int ret;
 
-	rte_eal_log_init(NULL, 0);
+	eal_log_init(NULL, 0);
 
 	eal_log_level_parse(argc, argv);
 
diff --git a/lib/librte_eal/windows/eal_log.c b/lib/librte_eal/windows/eal_log.c
index 875981f139..d4ea47f1c8 100644
--- a/lib/librte_eal/windows/eal_log.c
+++ b/lib/librte_eal/windows/eal_log.c
@@ -2,11 +2,13 @@
  * Copyright(c) 2017-2018 Intel Corporation
  */
 
-#include "eal_private.h"
+#include <rte_common.h>
+#include <rte_log.h>
+#include "eal_log.h"
 
 /* set the log to default function, called during eal init process. */
 int
-rte_eal_log_init(__rte_unused const char *id, __rte_unused int facility)
+eal_log_init(__rte_unused const char *id, __rte_unused int facility)
 {
 	rte_openlog_stream(stderr);
 
-- 
2.31.1