From 711c9b884cf8f869511b31133dc9f7959c9ab843 Mon Sep 17 00:00:00 2001 From: Saya Sugiura Date: Tue, 19 Feb 2019 13:52:18 +0900 Subject: Logstorage: Sync behavior bug fix This commit fixes couple of unexpected behavior on Logstorage sync behavior. - A log file is created only if necessary to avoid creating an empty log file. - The cache is synced with the condition: 1) When the ring buffer is not wrapped around, the cache is synced from last sync offset to current offset 2) When the ring buffer is wrapped around for first time and current offset is smaller than last sync offset, the cache is synced from last sync offset to end sync offset, and then from beginning to current offset 3) Otherwise, the cache is synced from offset where the log message starts to end sync offset, and then from beginning to current offset Signed-off-by: Saya Sugiura --- src/offlinelogstorage/dlt_offline_logstorage.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/offlinelogstorage/dlt_offline_logstorage.c') diff --git a/src/offlinelogstorage/dlt_offline_logstorage.c b/src/offlinelogstorage/dlt_offline_logstorage.c index 483bf8a..fe1af71 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage.c +++ b/src/offlinelogstorage/dlt_offline_logstorage.c @@ -89,11 +89,11 @@ DLT_STATIC void dlt_logstorage_filter_config_free(DltLogStorageFilterConfig *dat * @return 0 on success, -1 on error */ DLT_STATIC int dlt_logstorage_list_destroy(DltLogStorageFilterList **list, + DltLogStorageUserConfig *uconfig, + char *dev_path, int reason) { DltLogStorageFilterList *tmp = NULL; - DltLogStorageUserConfig *uconfig = NULL; - char *dev_path = NULL; while (*(list) != NULL) { tmp = *list; @@ -295,7 +295,8 @@ void dlt_logstorage_free(DltLogStorage *handle, int reason) return; } - dlt_logstorage_list_destroy(&(handle->config_list), reason); + dlt_logstorage_list_destroy(&(handle->config_list), &handle->uconfig, + handle->device_mount_point, reason); } @@ -2032,6 +2033,8 @@ int dlt_logstorage_write(DltLogStorage *handle, if (ret == 0) { /* log data (write) */ ret = config[i]->dlt_logstorage_write(config[i], + uconfig, + handle->device_mount_point, data1, size1, data2, -- cgit v1.2.1