remove global visibility of log variables, remove circular .h dependancy
This commit is contained in:
+22
-30
@@ -46,7 +46,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
#include "common/utils/LOG/log_extern.h"
|
#include "common/utils/LOG/log.h"
|
||||||
|
|
||||||
// main log variables
|
// main log variables
|
||||||
|
|
||||||
@@ -58,18 +58,16 @@ void read_cpu_hardware (void) __attribute__ ((constructor));
|
|||||||
void read_cpu_hardware (void) {}
|
void read_cpu_hardware (void) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
log_mem_cnt_t log_mem_d[2];
|
static log_mem_cnt_t log_mem_d[2];
|
||||||
int log_mem_flag = 0;
|
static int log_mem_flag = 0;
|
||||||
volatile int log_mem_side=0;
|
volatile int log_mem_side=0;
|
||||||
pthread_mutex_t log_mem_lock;
|
static pthread_mutex_t log_mem_lock;
|
||||||
pthread_cond_t log_mem_notify;
|
static pthread_cond_t log_mem_notify;
|
||||||
pthread_t log_mem_thread;
|
static pthread_t log_mem_thread;
|
||||||
int log_mem_file_cnt=0;
|
static int log_mem_file_cnt=0;
|
||||||
volatile int log_mem_write_flag=0;
|
volatile int log_mem_write_flag=0;
|
||||||
volatile int log_mem_write_side=0;
|
volatile int log_mem_write_side=0;
|
||||||
char __log_mem_filename[1024]={0};
|
static char * log_mem_filename;
|
||||||
char * log_mem_filename = &__log_mem_filename[0];
|
|
||||||
char logmem_filename[1024] = {0};
|
|
||||||
|
|
||||||
const mapping log_level_names[] = {{"error", OAILOG_ERR},
|
const mapping log_level_names[] = {{"error", OAILOG_ERR},
|
||||||
{"warn", OAILOG_WARNING},
|
{"warn", OAILOG_WARNING},
|
||||||
@@ -935,28 +933,22 @@ static void log_output_memory(log_component_t *c, const char *file, const char *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int logInit_log_mem (void)
|
int logInit_log_mem (char * filename)
|
||||||
{
|
{
|
||||||
if (log_mem_flag == 1) {
|
log_mem_flag = 1;
|
||||||
log_mem_d[0].buf_p = malloc(LOG_MEM_SIZE);
|
log_mem_filename = filename; // in present code, the parameter is safe permanent pointer
|
||||||
log_mem_d[0].buf_index = 0;
|
log_mem_d[0].buf_p = malloc(LOG_MEM_SIZE);
|
||||||
log_mem_d[0].enable_flag = 1;
|
log_mem_d[0].buf_index = 0;
|
||||||
log_mem_d[1].buf_p = malloc(LOG_MEM_SIZE);
|
log_mem_d[0].enable_flag = 1;
|
||||||
log_mem_d[1].buf_index = 0;
|
log_mem_d[1].buf_p = malloc(LOG_MEM_SIZE);
|
||||||
log_mem_d[1].enable_flag = 1;
|
log_mem_d[1].buf_index = 0;
|
||||||
log_mem_side = 0;
|
log_mem_d[1].enable_flag = 1;
|
||||||
if ((pthread_mutex_init(&log_mem_lock, NULL) != 0) || (pthread_cond_init(&log_mem_notify, NULL) != 0)) {
|
log_mem_side = 0;
|
||||||
log_mem_d[1].enable_flag=0;
|
if ((pthread_mutex_init(&log_mem_lock, NULL) != 0) || (pthread_cond_init(&log_mem_notify, NULL) != 0)) {
|
||||||
return -1;
|
log_mem_d[1].enable_flag=0;
|
||||||
}
|
return -1;
|
||||||
pthread_create(&log_mem_thread, NULL, (void *(*)(void *))flush_mem_to_file, (void *)NULL);
|
|
||||||
} else {
|
|
||||||
log_mem_d[0].buf_p = NULL;
|
|
||||||
log_mem_d[1].buf_p = NULL;
|
|
||||||
log_mem_d[0].enable_flag = 0;
|
|
||||||
log_mem_d[1].enable_flag = 0;
|
|
||||||
}
|
}
|
||||||
|
pthread_create(&log_mem_thread, NULL, (void *(*)(void *))flush_mem_to_file, (void *)NULL);
|
||||||
printf("log init done\n");
|
printf("log init done\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -272,8 +272,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
/*--- INCLUDES ---------------------------------------------------------------*/
|
|
||||||
# include "log_if.h"
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
int logInit (void);
|
int logInit (void);
|
||||||
void logTerm (void);
|
void logTerm (void);
|
||||||
@@ -299,7 +298,7 @@ int register_log_component(char *name, char *fext, int compidx);
|
|||||||
#define LOG_MEM_SIZE 100*1024*1024
|
#define LOG_MEM_SIZE 100*1024*1024
|
||||||
#define LOG_MEM_FILE "./logmem.log"
|
#define LOG_MEM_FILE "./logmem.log"
|
||||||
void flush_mem_to_file(void);
|
void flush_mem_to_file(void);
|
||||||
int logInit_log_mem(void);
|
int logInit_log_mem(char*);
|
||||||
void close_log_mem(void);
|
void close_log_mem(void);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
|
||||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.openairinterface.org/?page_id=698
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*-------------------------------------------------------------------------------
|
|
||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
|
||||||
* contact@openairinterface.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
extern log_t *g_log;
|
|
||||||
|
|
||||||
extern const mapping log_level_names[];
|
|
||||||
extern const mapping log_options[];
|
|
||||||
extern const mapping log_maskmap[];
|
|
||||||
extern int log_mem_flag;
|
|
||||||
extern char * log_mem_filename;
|
|
||||||
extern char logmem_filename[1024];
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
|
||||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.openairinterface.org/?page_id=698
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*-------------------------------------------------------------------------------
|
|
||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
|
||||||
* contact@openairinterface.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*! \file log_if.h
|
|
||||||
* \brief log interface
|
|
||||||
* \author Navid Nikaein
|
|
||||||
* \date 2009 - 2014
|
|
||||||
* \version 0.3
|
|
||||||
* \warning This component can be runned only in user-space
|
|
||||||
* @ingroup routing
|
|
||||||
*/
|
|
||||||
|
|
||||||
// LTS: kept this file for compatibility
|
|
||||||
// this file was probably a trial to separate internal functions and external ones
|
|
||||||
// but it has never been finished, most source code include directly log.h (not log_if.h)
|
|
||||||
#include "log.h"
|
|
||||||
@@ -902,7 +902,6 @@ INPUT = \
|
|||||||
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/LOG/vcd_signal_dumper.h \
|
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/LOG/vcd_signal_dumper.h \
|
||||||
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/LOG/log.c \
|
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/LOG/log.c \
|
||||||
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/LOG/log.h \
|
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/LOG/log.h \
|
||||||
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/LOG/log_extern.h \
|
|
||||||
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/time_stat.h \
|
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/time_stat.h \
|
||||||
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/ocp_itti/all_msg.h \
|
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/ocp_itti/all_msg.h \
|
||||||
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/ocp_itti/intertask_interface.h \
|
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/ocp_itti/intertask_interface.h \
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
#include "common/ran_context.h"
|
#include "common/ran_context.h"
|
||||||
#include "RRC/LTE/rrc_extern.h"
|
#include "RRC/LTE/rrc_extern.h"
|
||||||
#include "PHY_INTERFACE/phy_interface.h"
|
#include "PHY_INTERFACE/phy_interface.h"
|
||||||
#include "common/utils/LOG/log_extern.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "UTIL/OTG/otg_tx.h"
|
#include "UTIL/OTG/otg_tx.h"
|
||||||
#include "UTIL/OTG/otg_externs.h"
|
#include "UTIL/OTG/otg_externs.h"
|
||||||
#include "UTIL/MATH/oml.h"
|
#include "UTIL/MATH/oml.h"
|
||||||
|
|||||||
@@ -138,10 +138,8 @@ void get_common_options(configmodule_interface_t *cfg, uint32_t execmask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (logmem_filename != NULL && strlen(logmem_filename) > 0) {
|
if (logmem_filename != NULL && strlen(logmem_filename) > 0) {
|
||||||
log_mem_filename = &logmem_filename[0];
|
printf("Enabling OPT for log save at memory %s\n",logmem_filename);
|
||||||
log_mem_flag = 1;
|
logInit_log_mem(logmem_filename);
|
||||||
printf("Enabling OPT for log save at memory %s\n",log_mem_filename);
|
|
||||||
logInit_log_mem();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noS1) {
|
if (noS1) {
|
||||||
|
|||||||
@@ -953,7 +953,7 @@ typedef enum {no_relay=1,unicast_relay_type1,unicast_relay_type2, multicast_rela
|
|||||||
|
|
||||||
#define NB_BANDS_MAX 8
|
#define NB_BANDS_MAX 8
|
||||||
|
|
||||||
#include "common/utils/LOG/log_extern.h"
|
#include "common/utils/LOG/log.h"
|
||||||
extern pthread_cond_t sync_cond;
|
extern pthread_cond_t sync_cond;
|
||||||
extern pthread_mutex_t sync_mutex;
|
extern pthread_mutex_t sync_mutex;
|
||||||
extern int sync_var;
|
extern int sync_var;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "LAYER2/MAC/defs.h"
|
#include "LAYER2/MAC/defs.h"
|
||||||
#include "PHY_INTERFACE/defs.h"
|
#include "PHY_INTERFACE/defs.h"
|
||||||
#include "LAYER2/MAC/vars.h"
|
#include "LAYER2/MAC/vars.h"
|
||||||
#include "UTIL/LOG/log_extern.h"
|
#include "UTIL/LOG/log.h"
|
||||||
|
|
||||||
uint16_t n_rnti = 0x1235;
|
uint16_t n_rnti = 0x1235;
|
||||||
int n_users = 1;
|
int n_users = 1;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include "SCHED/vars.h"
|
#include "SCHED/vars.h"
|
||||||
#include "LAYER2/MAC/vars.h"
|
#include "LAYER2/MAC/vars.h"
|
||||||
|
|
||||||
#include "UTIL/LOG/log_extern.h"
|
#include "UTIL/LOG/log.h"
|
||||||
|
|
||||||
#include "unitary_defs.h"
|
#include "unitary_defs.h"
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "common/utils/nr/nr_common.h"
|
#include "common/utils/nr/nr_common.h"
|
||||||
#include "common/utils/LOG/log_extern.h"
|
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "common/utils/ocp_itti/intertask_interface.h"
|
#include "common/utils/ocp_itti/intertask_interface.h"
|
||||||
#include "openair2/GNB_APP/gnb_paramdef.h"
|
#include "openair2/GNB_APP/gnb_paramdef.h"
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "log_extern.h"
|
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "intertask_interface.h"
|
#include "intertask_interface.h"
|
||||||
#include "s1ap_eNB.h"
|
#include "s1ap_eNB.h"
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "common/utils/nr/nr_common.h"
|
#include "common/utils/nr/nr_common.h"
|
||||||
#include "common/utils/LOG/log_extern.h"
|
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "oai_asn1.h"
|
#include "oai_asn1.h"
|
||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pdcp_sequence_manager.h"
|
#include "pdcp_sequence_manager.h"
|
||||||
#include "common/utils//LOG/log_if.h"
|
#include "common/utils//LOG/log.h"
|
||||||
#include "pdcp_util.h"
|
#include "pdcp_util.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include "cli.h"
|
#include "cli.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "log_extern.h"
|
|
||||||
|
|
||||||
extern cli_config *cli_cfg;
|
extern cli_config *cli_cfg;
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ This header file must be included */
|
|||||||
#endif
|
#endif
|
||||||
#ifndef project_include
|
#ifndef project_include
|
||||||
#define project_include
|
#define project_include
|
||||||
#include "common/utils/LOG/log_if.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "PHY/defs_RU.h"
|
#include "PHY/defs_RU.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include "common/utils/LOG/log_extern.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "common_lib.h"
|
#include "common_lib.h"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,7 @@
|
|||||||
#include "LAYER2/RLC/AM_v9.3.0/rlc_am.h"
|
#include "LAYER2/RLC/AM_v9.3.0/rlc_am.h"
|
||||||
#include "LAYER2/MAC/defs.h"
|
#include "LAYER2/MAC/defs.h"
|
||||||
#include "LAYER2/MAC/vars.h"
|
#include "LAYER2/MAC/vars.h"
|
||||||
#include "UTIL/LOG/log_if.h"
|
#include "UTIL/LOG/log.h"
|
||||||
#include "UTIL/LOG/log_extern.h"
|
|
||||||
#include "RRC/LTE/vars.h"
|
#include "RRC/LTE/vars.h"
|
||||||
#include "PHY_INTERFACE/vars.h"
|
#include "PHY_INTERFACE/vars.h"
|
||||||
#include "UTIL/AT_COMMANDS/parser.h"
|
#include "UTIL/AT_COMMANDS/parser.h"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "MAC_INTERFACE/vars.h"
|
#include "MAC_INTERFACE/vars.h"
|
||||||
#include "LAYER2/MAC/vars.h"
|
#include "LAYER2/MAC/vars.h"
|
||||||
#include "UTIL/LOG/log_if.h"
|
#include "UTIL/LOG/log.h"
|
||||||
#include "test_util.h"
|
#include "test_util.h"
|
||||||
#include "test_pdcp.h"
|
#include "test_pdcp.h"
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,7 @@
|
|||||||
|
|
||||||
#include "LAYER2/MAC/defs.h"
|
#include "LAYER2/MAC/defs.h"
|
||||||
#include "LAYER2/MAC/vars.h"
|
#include "LAYER2/MAC/vars.h"
|
||||||
#include "UTIL/LOG/log_if.h"
|
#include "UTIL/LOG/log.h"
|
||||||
#include "UTIL/LOG/log_extern.h"
|
|
||||||
#include "RRC/LTE/vars.h"
|
#include "RRC/LTE/vars.h"
|
||||||
#include "PHY_INTERFACE/vars.h"
|
#include "PHY_INTERFACE/vars.h"
|
||||||
#include "LAYER2/PDCP_v10.1.0/pdcp.h"
|
#include "LAYER2/PDCP_v10.1.0/pdcp.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user