diff options
author | Saya Sugiura <ssugiura@jp.adit-jv.com> | 2019-02-19 13:52:18 +0900 |
---|---|---|
committer | Saya Sugiura <ssugiura@jp.adit-jv.com> | 2019-06-18 17:22:09 +0900 |
commit | 711c9b884cf8f869511b31133dc9f7959c9ab843 (patch) | |
tree | 4fb8b154d916d43b4da890f2b0f1d623edbe8349 /src/offlinelogstorage/dlt_offline_logstorage.h | |
parent | b049b408f7b15ef5ecdc71723812f43161d25ce8 (diff) | |
download | DLT-daemon-711c9b884cf8f869511b31133dc9f7959c9ab843.tar.gz |
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 <ssugiura@jp.adit-jv.com>
Diffstat (limited to 'src/offlinelogstorage/dlt_offline_logstorage.h')
-rw-r--r-- | src/offlinelogstorage/dlt_offline_logstorage.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/offlinelogstorage/dlt_offline_logstorage.h b/src/offlinelogstorage/dlt_offline_logstorage.h index e28e535..33f55f6 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage.h +++ b/src/offlinelogstorage/dlt_offline_logstorage.h @@ -54,7 +54,6 @@ #define DLT_OFFLINE_LOGSTORAGE_H #include <search.h> -#include <stdbool.h> #include "dlt_common.h" #include "dlt-daemon_cfg.h" #include "dlt_config_file_parser.h" @@ -125,6 +124,7 @@ typedef struct unsigned int offset; /* current write offset */ unsigned int wrap_around_cnt; /* wrap around counter */ unsigned int last_sync_offset; /* last sync position */ + unsigned int end_sync_offset; /* end position of previous round */ } DltLogStorageCacheFooter; typedef struct @@ -164,6 +164,8 @@ struct DltLogStorageFilterConfig char *dev_path, int log_msg_size); int (*dlt_logstorage_write)(DltLogStorageFilterConfig *config, + DltLogStorageUserConfig *file_config, + char *dev_path, unsigned char *data1, int size1, unsigned char *data2, @@ -180,10 +182,6 @@ struct DltLogStorageFilterConfig void *cache; /* log data cache */ unsigned int specific_size; /* cache size used for specific_size sync strategy */ unsigned int current_write_file_offset; /* file offset for specific_size sync strategy */ - unsigned int total_write_count; /* total count of data need to sync to file */ - bool pre_cache_sync; /* sync done in previous wrap around */ - bool cur_cache_sync; /* sync done in present cache */ - bool sync_from_start; /* sync done from start of cache */ DltLogStorageFileList *records; /* File name list */ }; |