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_lookup -> log_lookup
rte_log_init -> log_init
__rte_log_register -> log_register
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: David Marchand <david.marchand@redhat.com>
#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;
* 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;
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 */
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 */
}
static int
-rte_log_lookup(const char *name)
+log_lookup(const char *name)
{
size_t i;
* 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);
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;
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;
};
/* 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;
/* 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;
#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
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) {
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);
--- /dev/null
+/* 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 */
*/
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
*
*/
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
#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"
#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);
#include <rte_spinlock.h>
#include <rte_log.h>
-#include "eal_private.h"
+#include "eal_log.h"
/*
* default log function
* 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;
#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)
eal_get_internal_configuration();
int ret;
- rte_eal_log_init(NULL, 0);
+ eal_log_init(NULL, 0);
eal_log_level_parse(argc, argv);
* 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);