From f990d839af5003034ae107c4b15ba6304bdc1e92 Mon Sep 17 00:00:00 2001 From: icex2 Date: Thu, 15 Aug 2024 11:34:31 +0200 Subject: [PATCH] chore: Remove property (node) log from API, make ext(ension) function There is no need for different implementations for this depending on the property (node) backend. Thus, have these as ext(ension) functions that already use parts of the actual API to implement logging property (node) structures. --- src/main/avs-ext/property-node.c | 294 --------------------------- src/main/avs-ext/property.c | 20 -- src/main/core/property-ext.c | 26 ++- src/main/core/property-ext.h | 5 + src/main/core/property-node-ext.c | 138 ++++++++++++- src/main/core/property-node-ext.h | 8 +- src/main/core/property-node-trace.c | 11 - src/main/core/property-node.c | 10 - src/main/core/property-node.h | 5 - src/main/core/property-trace.c | 11 - src/main/core/property.c | 11 - src/main/core/property.h | 5 - src/main/launcher/avs-config.c | 2 +- src/main/launcher/bootstrap-config.c | 2 - src/main/launcher/bootstrap.c | 15 +- src/main/launcher/launcher.c | 15 +- 16 files changed, 176 insertions(+), 402 deletions(-) diff --git a/src/main/avs-ext/property-node.c b/src/main/avs-ext/property-node.c index e7a9942..67a4c57 100644 --- a/src/main/avs-ext/property-node.c +++ b/src/main/avs-ext/property-node.c @@ -15,299 +15,6 @@ #define AVS_PROPERTY_STRUCTURE_META_SIZE 576 -// Guestimate, should be long enough, I hope? -#define AVS_PROPERTY_NODE_PATH_LEN_MAX 4096 -// 256 found in AVS code as size used on property_node_name -#define AVS_PROPERTY_NODE_NAME_SIZE_MAX 256 -// Guestimate, should be enough, I hope? -#define AVS_PROPERTY_NODE_ATTR_NAME_SIZE_MAX 128 - -static void _avs_ext_property_node_log_rec( - struct property_node *parent_node, - const char *parent_path, - bt_core_log_message_t log_message) -{ - char cur_path[AVS_PROPERTY_NODE_PATH_LEN_MAX]; - char cur_node_name[AVS_PROPERTY_NODE_NAME_SIZE_MAX]; - - struct property_node *child_node; - enum property_type property_type; - - int8_t value_s8; - int16_t value_s16; - int32_t value_s32; - int64_t value_s64; - uint8_t value_u8; - uint16_t value_u16; - uint32_t value_u32; - uint64_t value_u64; - char value_str[4096]; - bool value_bool; - - avs_error error; - - // Carry on the full root path down the node tree - property_node_name(parent_node, cur_node_name, sizeof(cur_node_name)); - - str_cpy(cur_path, sizeof(cur_path), parent_path); - str_cat(cur_path, sizeof(cur_path), "/"); - str_cat(cur_path, sizeof(cur_path), cur_node_name); - - child_node = property_node_traversal(parent_node, TRAVERSE_FIRST_CHILD); - - // parent node is a leaf node, print all data of it - if (child_node == NULL) { - property_type = property_node_type(parent_node); - - switch (property_type) { - case PROPERTY_TYPE_VOID: - log_message(LOG_MODULE, "%s: ", cur_path); - break; - - case PROPERTY_TYPE_S8: - error = property_node_read( - parent_node, property_type, &value_s8, sizeof(value_s8)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } else { - log_message(LOG_MODULE, "%s: %" PRId8, cur_path, value_s8); - } - - break; - - case PROPERTY_TYPE_S16: - error = property_node_read( - parent_node, property_type, &value_s16, sizeof(value_s16)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } else { - log_message( - LOG_MODULE, "%s: %" PRId16, cur_path, value_s16); - } - - break; - - case PROPERTY_TYPE_S32: - error = property_node_read( - parent_node, property_type, &value_s32, sizeof(value_s32)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } else { - log_message( - LOG_MODULE, "%s: %" PRId32, cur_path, value_s32); - } - - break; - - case PROPERTY_TYPE_S64: - error = property_node_read( - parent_node, property_type, &value_s64, sizeof(value_s64)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } else { - log_message( - LOG_MODULE, "%s: %" PRId64, cur_path, value_s64); - } - - break; - - case PROPERTY_TYPE_U8: - error = property_node_read( - parent_node, property_type, &value_u8, sizeof(value_u8)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } else { - log_message(LOG_MODULE, "%s: %" PRIu8, cur_path, value_u8); - } - - break; - - case PROPERTY_TYPE_U16: - error = property_node_read( - parent_node, property_type, &value_u16, sizeof(value_u16)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } else { - log_message( - LOG_MODULE, "%s: %" PRIu16, cur_path, value_u16); - } - - break; - - case PROPERTY_TYPE_U32: - error = property_node_read( - parent_node, property_type, &value_u32, sizeof(value_u32)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } else { - log_message( - LOG_MODULE, "%s: %" PRIu32, cur_path, value_u32); - } - - break; - - case PROPERTY_TYPE_U64: - error = property_node_read( - parent_node, property_type, &value_u64, sizeof(value_u64)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } else { - log_message( - LOG_MODULE, "%s: %" PRIu64, cur_path, value_u64); - } - - break; - - case PROPERTY_TYPE_STR: - error = property_node_read( - parent_node, property_type, value_str, sizeof(value_str)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } else { - log_message(LOG_MODULE, "%s: %s", cur_path, value_str); - } - - break; - - case PROPERTY_TYPE_BOOL: - error = property_node_read( - parent_node, - property_type, - &value_bool, - sizeof(value_bool)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } else { - log_message(LOG_MODULE, "%s: %d", cur_path, value_bool); - } - - break; - - case PROPERTY_TYPE_BIN: - log_message(LOG_MODULE, "%s: ", cur_path); - break; - - case PROPERTY_TYPE_ATTR: - error = property_node_read( - parent_node, property_type, value_str, sizeof(value_str)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } else { - log_message(LOG_MODULE, "%s@: %s", cur_path, value_str); - } - - break; - - case PROPERTY_TYPE_VOID_WITH_ATTRIBUTES: - log_message(LOG_MODULE, "%s: ", cur_path); - - child_node = - property_node_traversal(parent_node, TRAVERSE_FIRST_ATTR); - - while (child_node) { - _avs_ext_property_node_log_rec( - child_node, cur_path, log_message); - - child_node = property_node_traversal( - child_node, TRAVERSE_NEXT_SIBLING); - } - - break; - - case PROPERTY_TYPE_STR_WITH_ATTRIBUTES: - error = property_node_read( - parent_node, property_type, value_str, sizeof(value_str)); - - if (AVS_IS_ERROR(error)) { - log_fatal( - "%s, property read failed: %s", - cur_path, - avs_ext_error_str(error)); - } - - log_message(LOG_MODULE, "%s: %s", cur_path, value_str); - - child_node = - property_node_traversal(parent_node, TRAVERSE_FIRST_ATTR); - - while (child_node) { - _avs_ext_property_node_log_rec( - child_node, cur_path, log_message); - - child_node = property_node_traversal( - child_node, TRAVERSE_NEXT_SIBLING); - } - - break; - - default: - log_fatal("%s: (%d)", cur_path, property_type); - break; - } - } else { - while (child_node) { - _avs_ext_property_node_log_rec(child_node, cur_path, log_message); - - child_node = - property_node_traversal(child_node, TRAVERSE_NEXT_SIBLING); - } - } -} - -static void _avs_ext_property_node_log( - const core_property_node_t *node_, bt_core_log_message_t log_messsage) -{ - avs_ext_property_internal_node_t *node; - - node = (avs_ext_property_internal_node_t *) node_; - - _avs_ext_property_node_log_rec(node->node, "", log_messsage); -} - static core_property_node_result_t _avs_ext_property_node_name_get( const core_property_node_t *node_, char *name, size_t len) { @@ -1353,7 +1060,6 @@ void avs_ext_property_node_core_api_get(core_property_node_api_t *api) api->version = 1; - api->v1.log = _avs_ext_property_node_log; api->v1.name_get = _avs_ext_property_node_name_get; api->v1.size = _avs_ext_property_node_size; api->v1.search = _avs_ext_property_node_search; diff --git a/src/main/avs-ext/property.c b/src/main/avs-ext/property.c index 0977803..6711161 100644 --- a/src/main/avs-ext/property.c +++ b/src/main/avs-ext/property.c @@ -292,25 +292,6 @@ static core_property_result_t _avs_ext_property_clone( return CORE_PROPERTY_RESULT_SUCCESS; } -static void _avs_ext_property_log( - const core_property_t *property_, bt_core_log_message_t log_message) -{ - avs_ext_property_internal_node_t node; - core_property_node_api_t node_api; - - node.property = (avs_ext_property_internal_property_t *) (property_); - node.node = property_search(node.property->property, NULL, "/"); - - if (node.node == NULL) { - log_message(LOG_MODULE, ""); - return; - } - - avs_ext_property_node_core_api_get(&node_api); - - node_api.v1.log((const core_property_node_t *) &node, log_message); -} - static core_property_result_t _avs_ext_property_root_node_get( const core_property_t *property_, core_property_node_t *node_) { @@ -374,7 +355,6 @@ static void _avs_ext_property_core_api_get(core_property_api_t *api) api->v1.str_load = _avs_ext_property_str_load; api->v1.size = _avs_ext_property_size; api->v1.clone = _avs_ext_property_clone; - api->v1.log = _avs_ext_property_log; api->v1.root_node_get = _avs_ext_property_root_node_get; api->v1.other_node_insert = _avs_ext_property_other_node_insert; api->v1.free = _avs_ext_property_free; diff --git a/src/main/core/property-ext.c b/src/main/core/property-ext.c index 0aecf63..bcedba0 100644 --- a/src/main/core/property-ext.c +++ b/src/main/core/property-ext.c @@ -5,6 +5,24 @@ #include "main/core/property-node-ext.h" #include "main/core/property.h" +void core_property_ext_log( + const core_property_t *property, bt_core_log_message_t log_message) +{ + core_property_node_t node; + core_property_node_result_t node_result; + + node_result = core_property_root_node_get(property, &node); + + if (node_result == CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND) { + log_message(LOG_MODULE, ""); + return; + } else if (CORE_PROPERTY_NODE_RESULT_IS_ERROR(node_result)) { + return; + } + + core_property_node_ext_log(&node, log_message); +} + core_property_result_t core_property_ext_many_merge( const core_property_t **properties, size_t count, @@ -31,18 +49,10 @@ core_property_result_t core_property_ext_many_merge( return CORE_PROPERTY_RESULT_SUCCESS; } - core_property_log(merged_property, log_misc_func); - - for (i = 0; i < count; i++) { - core_property_log(properties[i], log_misc_func); - } - for (i = 1; i < count; i++) { result2 = core_property_node_ext_merge_do( merged_property, properties[i], &tmp); - core_property_log(tmp, log_misc_func); - if (CORE_PROPERTY_NODE_RESULT_IS_ERROR(result2)) { core_property_free(&merged_property); return CORE_PROPERTY_RESULT_ERROR_INTERNAL; diff --git a/src/main/core/property-ext.h b/src/main/core/property-ext.h index 58936db..ad93446 100644 --- a/src/main/core/property-ext.h +++ b/src/main/core/property-ext.h @@ -1,8 +1,13 @@ #ifndef CORE_PROPERTY_EXT_H #define CORE_PROPERTY_EXT_H +#include "iface-core/log.h" + #include "main/core/property.h" +void core_property_ext_log( + const core_property_t *property, bt_core_log_message_t log_message); + core_property_result_t core_property_ext_many_merge( core_property_t **properties, size_t count, core_property_t **out_property); diff --git a/src/main/core/property-node-ext.c b/src/main/core/property-node-ext.c index bafab38..3f53a62 100644 --- a/src/main/core/property-node-ext.c +++ b/src/main/core/property-node-ext.c @@ -1,5 +1,7 @@ #define LOG_MODULE "core-property-node-ext" +#include + #include "iface-core/log.h" #include "core/property-node-ext.h" @@ -91,6 +93,137 @@ static core_property_node_result_t _core_property_node_ext_merge_recursive_do( return CORE_PROPERTY_NODE_RESULT_SUCCESS; } +static core_property_node_result_t _core_property_node_ext_log_rec( + const core_property_node_t *parent_node, + const char *parent_path, + bt_core_log_message_t log_message) +{ + core_property_node_result_t result; + + char property_type[16]; + + char cur_path[CORE_PROPERTY_NODE_PATH_LEN_MAX]; + char cur_node_name[CORE_PROPERTY_NODE_NAME_SIZE_MAX]; + + core_property_node_t child_node; + core_property_node_t tmp; + + int8_t value_s8; + int16_t value_s16; + int32_t value_s32; + int64_t value_s64; + uint8_t value_u8; + uint16_t value_u16; + uint32_t value_u32; + uint64_t value_u64; + char value_str[4096]; + bool value_bool; + + // Carry on the full root path down the node tree + result = core_property_node_name_get(parent_node, cur_node_name, sizeof(cur_node_name)); + + str_cpy(cur_path, sizeof(cur_path), parent_path); + str_cat(cur_path, sizeof(cur_path), "/"); + str_cat(cur_path, sizeof(cur_path), cur_node_name); + + result = core_property_node_child_get(parent_node, &child_node); + + // parent node is a leaf node, print all data of it + if (result == CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND) { + result = core_property_node_attr_read(parent_node, "__type", property_type, sizeof(property_type)); + + if (result == CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND) { + // void type if doesn't have __type attribute + log_message(LOG_MODULE, "%s: ", cur_path); + } else if (str_eq(property_type, "s8")) { + result = core_property_node_s8_read(parent_node, &value_s8); + core_property_node_fatal_on_error(result); + + log_message(LOG_MODULE, "%s: %" PRId8, cur_path, value_s8); + } else if (str_eq(property_type, "s16")) { + result = core_property_node_s16_read(parent_node, &value_s16); + core_property_node_fatal_on_error(result); + + log_message(LOG_MODULE, "%s: %" PRId16, cur_path, value_s16); + } else if (str_eq(property_type, "s32")) { + result = core_property_node_s32_read(parent_node, &value_s32); + core_property_node_fatal_on_error(result); + + log_message(LOG_MODULE, "%s: %" PRId32, cur_path, value_s32); + } else if (str_eq(property_type, "s64")) { + result = core_property_node_s64_read(parent_node, &value_s64); + core_property_node_fatal_on_error(result); + + log_message(LOG_MODULE, "%s: %" PRId64, cur_path, value_s64); + } else if (str_eq(property_type, "u8")) { + result = core_property_node_u8_read(parent_node, &value_u8); + core_property_node_fatal_on_error(result); + + log_message(LOG_MODULE, "%s: %" PRIu8, cur_path, value_u8); + } else if (str_eq(property_type, "u16")) { + result = core_property_node_u16_read(parent_node, &value_u16); + core_property_node_fatal_on_error(result); + + log_message(LOG_MODULE, "%s: %" PRIu16, cur_path, value_u16); + } else if (str_eq(property_type, "u32")) { + result = core_property_node_u32_read(parent_node, &value_u32); + core_property_node_fatal_on_error(result); + + log_message(LOG_MODULE, "%s: %" PRIu32, cur_path, value_u32); + } else if (str_eq(property_type, "u64")) { + result = core_property_node_u64_read(parent_node, &value_u64); + core_property_node_fatal_on_error(result); + + log_message(LOG_MODULE, "%s: %" PRIu64, cur_path, value_u64); + } else if (str_eq(property_type, "str")) { + result = core_property_node_str_read(parent_node, value_str, sizeof(value_str)); + core_property_node_fatal_on_error(result); + + log_message(LOG_MODULE, "%s: %s", cur_path, value_str); + } else if (str_eq(property_type, "bool")) { + result = core_property_node_bool_read(parent_node, &value_bool); + core_property_node_fatal_on_error(result); + + log_message(LOG_MODULE, "%s: %d", cur_path, value_bool); + } else if (str_eq(property_type, "bin")) { + log_message(LOG_MODULE, "%s: ", cur_path); + } else { + log_fatal("%s: (%d)", cur_path, property_type); + } + + // TODO attribute traversal is missing here, needs an interface allowing arbitrary + // traversal on core_property_node + } else { + do { + result = _core_property_node_ext_log_rec(&child_node, cur_path, log_message); + + if (CORE_PROPERTY_NODE_RESULT_IS_ERROR(result)) { + return result; + } + + result = core_property_node_next_sibling_get(&child_node, &tmp); + memcpy(&child_node, &tmp, sizeof(core_property_node_t)); + + // No more siblings + if (result == CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND) { + break; + } + + if (CORE_PROPERTY_NODE_RESULT_IS_ERROR(result)) { + return result; + } + } while (true); + } + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +void core_property_node_ext_log( + const core_property_node_t *node, bt_core_log_message_t log_message) +{ + _core_property_node_ext_log_rec(node, "", log_message); +} + core_property_node_result_t core_property_node_ext_u8_read( const core_property_node_t *node, const char *name, uint8_t *value) { @@ -593,17 +726,12 @@ core_property_node_result_t core_property_node_ext_merge_with_strategies_do( return CORE_PROPERTY_NODE_RESULT_ERROR_INTERNAL; } - core_property_node_log(&merged_node, log_misc_func); - core_property_node_log(&source_node, log_misc_func); - ctx.path = ""; ctx.strategies = strategies; property_node_result = _core_property_node_ext_merge_recursive_do( &merged_node, &source_node, &ctx); - core_property_node_log(&merged_node, log_misc_func); - if (CORE_PROPERTY_NODE_RESULT_IS_ERROR(property_node_result)) { core_property_free(&merged_property); } diff --git a/src/main/core/property-node-ext.h b/src/main/core/property-node-ext.h index 04115c8..b9a0aa3 100644 --- a/src/main/core/property-node-ext.h +++ b/src/main/core/property-node-ext.h @@ -30,6 +30,9 @@ typedef struct core_property_node_ext_merge_strategies { uint8_t num; } core_property_node_ext_merge_strategies_t; +void core_property_node_ext_log( + const core_property_node_t *node, bt_core_log_message_t log_message); + core_property_node_result_t core_property_node_ext_u8_read( const core_property_node_t *node, const char *name, uint8_t *value); core_property_node_result_t core_property_node_ext_u16_read( @@ -43,11 +46,6 @@ core_property_node_result_t core_property_node_ext_str_read( const char *name, char *value, size_t len); -core_property_node_result_t core_property_node_ext_attr_read( - const core_property_node_t *node, - const char *name, - char *value, - size_t len); core_property_node_result_t core_property_node_ext_u8_read_or_default( const core_property_node_t *node, diff --git a/src/main/core/property-node-trace.c b/src/main/core/property-node-trace.c index cdb86bf..11dc15c 100644 --- a/src/main/core/property-node-trace.c +++ b/src/main/core/property-node-trace.c @@ -8,16 +8,6 @@ static core_property_node_api_t _core_property_node_trace_target_api; -static void _core_property_node_trace_log( - const core_property_node_t *node, bt_core_log_message_t log_message) -{ - log_misc(">>> log(%p)", node); - - _core_property_node_trace_target_api.v1.log(node, log_message); - - log_misc("<<< log(%p)", node); -} - static core_property_node_result_t _core_property_node_trace_name_get( const core_property_node_t *node, char *name, size_t len) { @@ -833,7 +823,6 @@ void core_property_node_trace_core_api_get(core_property_node_api_t *api) api->version = 1; - api->v1.log = _core_property_node_trace_log; api->v1.name_get = _core_property_node_trace_name_get; api->v1.size = _core_property_node_trace_size; api->v1.search = _core_property_node_trace_search; diff --git a/src/main/core/property-node.c b/src/main/core/property-node.c index 858a409..ed51dc3 100644 --- a/src/main/core/property-node.c +++ b/src/main/core/property-node.c @@ -36,7 +36,6 @@ void core_property_node_api_set(const core_property_node_api_t *api) } if (api->version == 1) { - CORE_PROPERTY_NODE_ASSERT_IMPLEMENTED(api->v1.log, log); CORE_PROPERTY_NODE_ASSERT_IMPLEMENTED(api->v1.name_get, name_get); CORE_PROPERTY_NODE_ASSERT_IMPLEMENTED(api->v1.size, size); CORE_PROPERTY_NODE_ASSERT_IMPLEMENTED(api->v1.search, search); @@ -119,7 +118,6 @@ const char *core_property_node_result_to_str(core_property_node_result_t result) default: return "Undefined error"; } -} void core_property_node_fatal_on_error(core_property_node_result_t result) { @@ -135,14 +133,6 @@ void core_property_node_fatal_on_error(core_property_node_result_t result) } } -void core_property_node_log( - const core_property_node_t *node, bt_core_log_message_t log_message) -{ - log_assert(_core_property_node_api_is_valid()); - log_assert(node); - log_assert(log_message); - - _core_property_node_api.v1.log(node, log_message); } core_property_node_result_t core_property_node_name_get( diff --git a/src/main/core/property-node.h b/src/main/core/property-node.h index fd9e0f4..cf35351 100644 --- a/src/main/core/property-node.h +++ b/src/main/core/property-node.h @@ -26,8 +26,6 @@ typedef enum core_property_node_result { CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND = 2, } core_property_node_result_t; -typedef void (*core_property_node_log_t)( - const core_property_node_t *node, bt_core_log_message_t log_message); typedef core_property_node_result_t (*core_property_node_name_get_t)( const core_property_node_t *node, char *name, size_t len); typedef core_property_node_result_t (*core_property_node_size_t)( @@ -162,7 +160,6 @@ typedef struct core_property_node_api { uint16_t version; struct { - core_property_node_log_t log; core_property_node_name_get_t name_get; core_property_node_size_t size; core_property_node_search_t search; @@ -214,8 +211,6 @@ const char * core_property_node_result_to_str(core_property_node_result_t result); void core_property_node_fatal_on_error(core_property_node_result_t result); -void core_property_node_log( - const core_property_node_t *node, bt_core_log_message_t log_message); core_property_node_result_t core_property_node_name_get( const core_property_node_t *node, char *name, size_t len); core_property_node_result_t diff --git a/src/main/core/property-trace.c b/src/main/core/property-trace.c index 6c358a8..fd403c5 100644 --- a/src/main/core/property-trace.c +++ b/src/main/core/property-trace.c @@ -99,16 +99,6 @@ static core_property_result_t _core_property_trace_clone( return result; } -static void _core_property_trace_log( - const core_property_t *property, bt_core_log_message_t log_message) -{ - log_misc(">>> log(%p)", property); - - _core_property_trace_target_api.v1.log(property, log_message); - - log_misc("<<< log(%p)", property); -} - static core_property_result_t _core_property_trace_root_node_get( const core_property_t *property, core_property_node_t *node) { @@ -176,7 +166,6 @@ void core_property_trace_core_api_get(core_property_api_t *api) api->v1.str_load = _core_property_trace_str_load; api->v1.size = _core_property_trace_size; api->v1.clone = _core_property_trace_clone; - api->v1.log = _core_property_trace_log; api->v1.root_node_get = _core_property_trace_root_node_get; api->v1.other_node_insert = _core_property_trace_other_node_insert; api->v1.free = _core_property_trace_free; diff --git a/src/main/core/property.c b/src/main/core/property.c index e20e8be..5532b34 100644 --- a/src/main/core/property.c +++ b/src/main/core/property.c @@ -43,7 +43,6 @@ void core_property_api_set(const core_property_api_t *api) CORE_PROPERTY_ASSERT_IMPLEMENTED(api->v1.str_load, str_load); CORE_PROPERTY_ASSERT_IMPLEMENTED(api->v1.size, size); CORE_PROPERTY_ASSERT_IMPLEMENTED(api->v1.clone, clone); - CORE_PROPERTY_ASSERT_IMPLEMENTED(api->v1.log, log); CORE_PROPERTY_ASSERT_IMPLEMENTED(api->v1.root_node_get, root_node_get); CORE_PROPERTY_ASSERT_IMPLEMENTED( api->v1.other_node_insert, other_node_insert); @@ -159,16 +158,6 @@ core_property_result_t core_property_clone( return _core_property_api.v1.clone(property, property_cloned); } -void core_property_log( - const core_property_t *property, bt_core_log_message_t log_message) -{ - log_assert(_core_property_api_is_valid()); - log_assert(property); - log_assert(log_message); - - _core_property_api.v1.log(property, log_message); -} - core_property_result_t core_property_root_node_get( const core_property_t *property, core_property_node_t *node) { diff --git a/src/main/core/property.h b/src/main/core/property.h index cf88ffd..d9962ca 100644 --- a/src/main/core/property.h +++ b/src/main/core/property.h @@ -39,8 +39,6 @@ typedef core_property_result_t (*core_property_size_t)( const core_property_t *property, size_t *size); typedef core_property_result_t (*core_property_clone_t)( const core_property_t *property, core_property_t **result); -typedef void (*core_property_log_t)( - const core_property_t *property, bt_core_log_message_t log_message); typedef core_property_result_t (*core_property_root_node_get_t)( const core_property_t *property, core_property_node_t *result); typedef core_property_result_t (*core_property_other_node_insert_t)( @@ -56,7 +54,6 @@ typedef struct core_property_api { core_property_str_load_t str_load; core_property_size_t size; core_property_clone_t clone; - core_property_log_t log; core_property_root_node_get_t root_node_get; core_property_other_node_insert_t other_node_insert; core_property_free_t free; @@ -80,8 +77,6 @@ core_property_result_t core_property_size(const core_property_t *property, size_t *size); core_property_result_t core_property_clone( const core_property_t *property, core_property_t **property_cloned); -void core_property_log( - const core_property_t *property, bt_core_log_message_t log_message); core_property_result_t core_property_root_node_get( const core_property_t *property, core_property_node_t *node); core_property_result_t core_property_other_node_insert( diff --git a/src/main/launcher/avs-config.c b/src/main/launcher/avs-config.c index c3358aa..eaa2eee 100644 --- a/src/main/launcher/avs-config.c +++ b/src/main/launcher/avs-config.c @@ -225,7 +225,7 @@ void avs_config_root_get( log_assert(node); result = core_property_root_node_get(property, node); - core_property_fatal_on_error(result); + core_property_node_fatal_on_error(result); result = core_property_node_name_get(node, node_name, sizeof(node_name)); core_property_node_fatal_on_error(result); diff --git a/src/main/launcher/bootstrap-config.c b/src/main/launcher/bootstrap-config.c index c9264d6..fef4f7a 100644 --- a/src/main/launcher/bootstrap-config.c +++ b/src/main/launcher/bootstrap-config.c @@ -669,8 +669,6 @@ void bootstrap_config_load( log_misc(ROOT_NODE "/startup/%s: loading merged result...", profile); - core_property_node_log(&startup_node, log_misc_func); - _bootstrap_config_load_bootstrap(&startup_node, profile, &config->startup); log_misc("Loading finished"); diff --git a/src/main/launcher/bootstrap.c b/src/main/launcher/bootstrap.c index feb3ee1..0edff90 100644 --- a/src/main/launcher/bootstrap.c +++ b/src/main/launcher/bootstrap.c @@ -8,6 +8,7 @@ #include "core/log-sink-std.h" #include "core/property-ext.h" +#include "core/property-node-ext.h" #include "core/property-node.h" #include "core/property.h" @@ -184,7 +185,7 @@ void bootstrap_avs_init( if (_bootstrap_log_property_configs) { log_misc("avs-config from file: %s", config->config_file); - core_property_log(file_property, log_misc_func); + core_property_ext_log(file_property, log_misc_func); } merged_property = @@ -194,7 +195,7 @@ void bootstrap_avs_init( if (_bootstrap_log_property_configs) { log_misc("avs-config merged with overrides"); - core_property_log(merged_property, log_misc_func); + core_property_ext_log(merged_property, log_misc_func); } avs_config_root_get(merged_property, &root_node); @@ -204,7 +205,7 @@ void bootstrap_avs_init( if (_bootstrap_log_property_configs) { log_misc("avs-config final"); - core_property_log(merged_property, log_misc_func); + core_property_ext_log(merged_property, log_misc_func); } avs_fs_assert_root_device_exists(&root_node); @@ -241,7 +242,7 @@ void bootstrap_eamuse_init( if (_bootstrap_log_property_configs) { log_misc("eamuse-config from file: %s", config->config_file); - core_property_log(file_property, log_misc_func); + core_property_ext_log(file_property, log_misc_func); } prop_result = core_property_ext_merge( @@ -252,7 +253,7 @@ void bootstrap_eamuse_init( if (_bootstrap_log_property_configs) { log_misc("eamuse-config merged with overrides"); - core_property_log(merged_property, log_misc_func); + core_property_ext_log(merged_property, log_misc_func); } eamuse_config_root_get(merged_property, &root_node); @@ -261,7 +262,7 @@ void bootstrap_eamuse_init( if (_bootstrap_log_property_configs) { log_misc("eamuse-config final"); - core_property_log(merged_property, log_misc_func); + core_property_ext_log(merged_property, log_misc_func); } eamuse_init(&root_node); @@ -317,7 +318,7 @@ void bootstrap_app_init( if (_bootstrap_log_property_configs) { log_misc("app-config"); - core_property_node_log(&node, log_misc_func); + core_property_node_ext_log(&node, log_misc_func); } app_init_invoke(&_bootstrap_app, ea3_ident_config, &node); diff --git a/src/main/launcher/launcher.c b/src/main/launcher/launcher.c index 8616cf9..ecd1927 100644 --- a/src/main/launcher/launcher.c +++ b/src/main/launcher/launcher.c @@ -17,6 +17,7 @@ #include "core/log-sink-file.h" #include "core/log-sink-list.h" #include "core/log-sink-std.h" +#include "core/property-ext.h" #include "core/thread-crt.h" #include "iface-core/log.h" @@ -218,16 +219,16 @@ _launcher_config_full_resolved_log(const struct launcher_config *config) if (config->debug.log_property_configs) { log_misc("launcher-config resolved properties"); log_misc("bootstrap-config"); - core_property_log(config->bootstrap.property, log_misc_func); + core_property_ext_log(config->bootstrap.property, log_misc_func); log_misc("avs-config"); - core_property_log(config->avs.property, log_misc_func); + core_property_ext_log(config->avs.property, log_misc_func); log_misc("ea3-ident-config"); - core_property_log(config->ea3_ident.property, log_misc_func); + core_property_ext_log(config->ea3_ident.property, log_misc_func); log_misc("eamuse-config"); - core_property_log(config->eamuse.property, log_misc_func); + core_property_ext_log(config->eamuse.property, log_misc_func); } } @@ -333,7 +334,7 @@ void _launcher_hooks_load( if (debug_log_property_configs) { log_misc("Property hook config: %s", config->hook[i].path); - core_property_log(config->hook[i].property, log_misc_func); + core_property_ext_log(config->hook[i].property, log_misc_func); } result_prop = core_property_root_node_get( @@ -362,7 +363,7 @@ static void _launcher_ea3_ident_config_load( if (log_property_configs) { log_misc("Property ea3-ident-config"); - core_property_log(launcher_config->property, log_misc_func); + core_property_ext_log(launcher_config->property, log_misc_func); } if (!ea3_ident_config_hardid_is_defined(config)) { @@ -453,7 +454,7 @@ void _launcher_init( if (launcher_config->debug.log_property_configs) { log_misc("launcher-config"); - core_property_log(launcher_property, log_misc_func); + core_property_ext_log(launcher_property, log_misc_func); } core_property_free(&launcher_property);