Buffer traits: add `platform` 45/288445/1
authorMichal Bloch <m.bloch@samsung.com>
Wed, 15 Feb 2023 15:54:17 +0000 (16:54 +0100)
committerMichal Bloch <m.bloch@samsung.com>
Thu, 16 Feb 2023 12:10:24 +0000 (13:10 +0100)
Change-Id: I21fd715d5fc03478bfbd23affd3af8ef67f294dc
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
include/buffer_traits.h
src/shared/buffer_traits.c

index c7fe8f7..b05cc7b 100644 (file)
@@ -54,6 +54,14 @@ char * log_name_by_id(log_id_t id);
 bool is_core_buffer(log_id_t id);
 
 /**
+ * @brief Is platform buffer
+ * @details Returns whether given buffer is meant for platform use
+ * @param[in] id The ID of the buffer
+ * @return boolean
+ */
+bool is_platform_buffer(log_id_t id);
+
+/**
  * @brief Is buffer valid
  * @details Returns whether given buffer ID represents an actual buffer
  * @param[in] id The ID of the buffer
index a9dfebc..cddeca4 100644 (file)
@@ -26,13 +26,14 @@ static const struct {
        log_id_t id;
        char * name;
        bool core;
+       bool platform;
 } buffer_traits[LOG_ID_MAX] = {
-       [LOG_ID_MAIN  ] = { .name = "main"  , .core =  true, },
-       [LOG_ID_RADIO ] = { .name = "radio" , .core =  true, },
-       [LOG_ID_SYSTEM] = { .name = "system", .core =  true, },
-       [LOG_ID_APPS  ] = { .name = "apps"  , .core =  true, },
-       [LOG_ID_KMSG  ] = { .name = "kmsg"  , .core = false, },
-       [LOG_ID_SYSLOG] = { .name = "syslog", .core = false, },
+       [LOG_ID_MAIN  ] = { .name = "main"  , .core =  true, .platform =  true, },
+       [LOG_ID_RADIO ] = { .name = "radio" , .core =  true, .platform =  true, },
+       [LOG_ID_SYSTEM] = { .name = "system", .core =  true, .platform =  true, },
+       [LOG_ID_APPS  ] = { .name = "apps"  , .core =  true, .platform = false, },
+       [LOG_ID_KMSG  ] = { .name = "kmsg"  , .core = false, .platform = false, },
+       [LOG_ID_SYSLOG] = { .name = "syslog", .core = false, .platform = false, },
 };
 
 bool is_buffer_valid(log_id_t id)
@@ -46,6 +47,11 @@ bool is_core_buffer(log_id_t id)
        return is_buffer_valid(id) && buffer_traits[id].core;
 }
 
+bool is_platform_buffer(log_id_t id)
+{
+       return is_buffer_valid(id) && buffer_traits[id].platform;
+}
+
 char *log_name_by_id(log_id_t id)
 {
        return is_buffer_valid(id) ? buffer_traits[id].name : "";