From d6638a3b20954f972c83668f12c1d8b1b92601b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Mon, 17 Jan 2022 21:58:58 +0100 Subject: [PATCH] logger: make buffer size configurable during compilation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: I5c50b4281cb1790248a39821c76f3ee874c76851 Signed-off-by: Łukasz Stelmach (cherry picked from commit 8f6200ba3f59394ec34ae091308bfb6e49ff8008) --- kernel/Makefile | 3 ++- kernel/logger.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 2f7ab69..3eb3c85 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,8 +1,9 @@ PWD := $(shell pwd) LD = ${CROSS_COMPILE}ld +LOGGER_BUFFER_SIZE ?= 256 # See commit 0b999ae3614d0 ("Merge tag 'compiler-attributes-for-linus-v5.0-rc7'"[..]) for rationale -CFLAGS_logger.o += -Wno-error=missing-attributes +CFLAGS_logger.o += -Wno-error=missing-attributes -DLOGGER_BUFFER_SIZE=$(LOGGER_BUFFER_SIZE) 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 c4216f7..8b241e5 100644 --- a/kernel/logger.c +++ b/kernel/logger.c @@ -46,6 +46,10 @@ #include +#ifndef LOGGER_BUFFER_SIZE +#define LOGGER_BUFFER_SIZE 256 +#endif + /** * struct logger_log - represents a specific log, such as 'main' or 'radio' * @buffer: The actual ring buffer @@ -1334,19 +1338,19 @@ static int __init logger_init(void) { int ret; - ret = create_log(LOGGER_LOG_MAIN, 256*1024); + ret = create_log(LOGGER_LOG_MAIN, LOGGER_BUFFER_SIZE*1024); if (unlikely(ret)) goto out; - ret = create_log(LOGGER_LOG_EVENTS, 256*1024); + ret = create_log(LOGGER_LOG_EVENTS, LOGGER_BUFFER_SIZE*1024); if (unlikely(ret)) goto out; - ret = create_log(LOGGER_LOG_RADIO, 256*1024); + ret = create_log(LOGGER_LOG_RADIO, LOGGER_BUFFER_SIZE*1024); if (unlikely(ret)) goto out; - ret = create_log(LOGGER_LOG_SYSTEM, 256*1024); + ret = create_log(LOGGER_LOG_SYSTEM, LOGGER_BUFFER_SIZE*1024); if (unlikely(ret)) goto out; -- 2.34.1