close(*fd);
}
+static inline bool is_core_buffer(log_id_t buf_id)
+{
+ static bool const is_core [LOG_ID_MAX] = {
+ [LOG_ID_MAIN ] = true,
+ [LOG_ID_SYSTEM] = true,
+ [LOG_ID_RADIO ] = true,
+ [LOG_ID_APPS ] = true,
+ };
+
+ if (buf_id < 0 || buf_id >= NELEMS(is_core))
+ return false;
+ return is_core [buf_id];
+}
+
char * log_name_by_id(log_id_t id);
log_id_t log_id_by_name(const char *name);
assert(reader);
assert(buf_id > LOG_ID_INVALID);
assert(buf_id < LOG_ID_MAX);
- assert(buf_id != LOG_ID_KMSG);
- assert(buf_id != LOG_ID_SYSLOG);
+ assert(is_core_buffer(buf_id));
assert(server);
__attribute__((cleanup(reader_logger_cleanup))) struct reader_logger *ret = reader_logger_alloc();
get_dlogutil_line_params(configline, ¶ms);
int r;
- if (g_backend.use_logger_by_default && params.buf_id != LOG_ID_KMSG && params.buf_id != LOG_ID_SYSLOG) {
+ if (g_backend.use_logger_by_default && is_core_buffer(params.buf_id)) {
struct reader_logger *reader = NULL;
r = create_reader_logger_from_dlogutil_line(¶ms, server, &reader);
if (r == 0)