From 15b6a1d2005e9f0422c3c40f68d0a74719efd7d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Wed, 19 Jan 2022 14:39:20 +0100 Subject: [PATCH] logger: configure buffer size separately MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add separate configuration for each buffer size. Change-Id: If7134868996a20a8fd81a6bbfbe101bad6d21824 Signed-off-by: Łukasz Stelmach --- kernel/Makefile | 12 ++++++++++-- kernel/logger.c | 24 ++++++++++++++++++------ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 3eb3c85..e8efb7d 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,9 +1,17 @@ PWD := $(shell pwd) LD = ${CROSS_COMPILE}ld -LOGGER_BUFFER_SIZE ?= 256 + +LOGGER_MAIN_BUFFER_SIZE ?= 256 +LOGGER_EVENTS_BUFFER_SIZE ?= 256 +LOGGER_RADIO_BUFFER_SIZE ?= 256 +LOGGER_SYSTEM_BUFFER_SIZE ?= 256 # See commit 0b999ae3614d0 ("Merge tag 'compiler-attributes-for-linus-v5.0-rc7'"[..]) for rationale -CFLAGS_logger.o += -Wno-error=missing-attributes -DLOGGER_BUFFER_SIZE=$(LOGGER_BUFFER_SIZE) +CFLAGS_logger.o += -Wno-error=missing-attributes \ + -DLOGGER_MAIN_BUFFER_SIZE=$(LOGGER_BUFFER_SIZE_MAIN) \ + -DLOGGER_EVENTS_BUFFER_SIZE=$(LOGGER_BUFFER_SIZE_EVENTS) \ + -DLOGGER_RADIO_BUFFER_SIZE=$(LOGGER_BUFFER_SIZE_RADIO) \ + -DLOGGER_SYSTEM_BUFFER_SIZE=$(LOGGER_BUFFER_SIZE_SYSTEM) CFLAGS_proc-tsm.o += -Wno-error=missing-attributes # Build is disabled by default so that when new module is added to this repository (and -source package), diff --git a/kernel/logger.c b/kernel/logger.c index 8b241e5..ebde6d3 100644 --- a/kernel/logger.c +++ b/kernel/logger.c @@ -46,8 +46,20 @@ #include -#ifndef LOGGER_BUFFER_SIZE -#define LOGGER_BUFFER_SIZE 256 +#ifndef LOGGER_MAIN_BUFFER_SIZE +#define LOGGER_MAIN_BUFFER_SIZE 256 +#endif + +#ifndef LOGGER_EVENTS_BUFFER_SIZE +#define LOGGER_EVENTS_BUFFER_SIZE 256 +#endif + +#ifndef LOGGER_RADIO_BUFFER_SIZE +#define LOGGER_RADIO_BUFFER_SIZE 256 +#endif + +#ifndef LOGGER_SYSTEM_BUFFER_SIZE +#define LOGGER_SYSTEM_BUFFER_SIZE 256 #endif /** @@ -1338,19 +1350,19 @@ static int __init logger_init(void) { int ret; - ret = create_log(LOGGER_LOG_MAIN, LOGGER_BUFFER_SIZE*1024); + ret = create_log(LOGGER_LOG_MAIN, LOGGER_MAIN_BUFFER_SIZE*1024); if (unlikely(ret)) goto out; - ret = create_log(LOGGER_LOG_EVENTS, LOGGER_BUFFER_SIZE*1024); + ret = create_log(LOGGER_LOG_EVENTS, LOGGER_EVENTS_BUFFER_SIZE*1024); if (unlikely(ret)) goto out; - ret = create_log(LOGGER_LOG_RADIO, LOGGER_BUFFER_SIZE*1024); + ret = create_log(LOGGER_LOG_RADIO, LOGGER_RADIO_BUFFER_SIZE*1024); if (unlikely(ret)) goto out; - ret = create_log(LOGGER_LOG_SYSTEM, LOGGER_BUFFER_SIZE*1024); + ret = create_log(LOGGER_LOG_SYSTEM, LOGGER_SYSTEM_BUFFER_SIZE*1024); if (unlikely(ret)) goto out; -- 2.7.4