diff options
author | Saya Sugiura <ssugiura@jp.adit-jv.com> | 2020-07-31 18:13:24 +0900 |
---|---|---|
committer | Saya Sugiura <ssugiura@jp.adit-jv.com> | 2021-01-06 09:15:12 +0900 |
commit | a82d12d001ec31b32136a238ad840af0a48e9496 (patch) | |
tree | 47f0dc42808a1b960b0d75e33d9c17f992ffa545 | |
parent | 3d79dc0d08f4762c72ea92d3fa1d85f45d6a6fb2 (diff) | |
download | DLT-daemon-a82d12d001ec31b32136a238ad840af0a48e9496.tar.gz |
logstorage: Modify rearranging file
This commit updates dlt_logstorage_rearrange_file_name() to perform
following:
- If the maximum index isn't equal to maxcounter, do not rearrange the
file name
- If the maximum index reaches to maxcounter:
- If minimum index is not 1, do not rearrange the file name
- If minimum index is 1, check if there's any indexes which the gap
is more than 1. If exists, take those indexes as latest and oldest.
Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
-rw-r--r-- | src/offlinelogstorage/dlt_offline_logstorage_behavior.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c index ac3b372..75be657 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c +++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c @@ -173,8 +173,17 @@ void dlt_logstorage_rearrange_file_name(DltLogStorageFileList **head) if ((head == NULL) || (*head == NULL) || ((*head)->next == NULL)) return; + if ((*head)->idx != 1) + { + /* Do not sort */ + return; + } + for (n = *head; n != NULL; n = n->next) { - if (n && n_prev) { + /* Compare the diff between n->idx and n_prev->idx only if + * wrap_post and wrap_pre are not set yet. Otherwise continue the loop + * until the tail */ + if (n && n_prev && !wrap_post && !wrap_pre) { if ((n->idx - n_prev->idx) != 1) { wrap_post = n; wrap_pre = n_prev; |