From: Michal Bloch Date: Mon, 27 Jan 2020 16:32:28 +0000 (+0100) Subject: libdlogutil: DLOGUTIL_MODE_FULL_DUMP is not a mode X-Git-Tag: accepted/tizen/unified/20200204.125829~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F223301%2F2;p=platform%2Fcore%2Fsystem%2Fdlog.git libdlogutil: DLOGUTIL_MODE_FULL_DUMP is not a mode Change-Id: Ia7bfd8d14b2f742edda14bc58d5eb5bde5163c79 Signed-off-by: Michal Bloch --- diff --git a/include/dlogutil.h b/include/dlogutil.h index a219c59..157483a 100644 --- a/include/dlogutil.h +++ b/include/dlogutil.h @@ -299,7 +299,7 @@ typedef int dlogutil_entry_cb(const dlogutil_entry_s *entry, void *data); * @since_tizen 6.0 * @see dlogutil_get_logs_dump() */ -static const unsigned int DLOGUTIL_MODE_FULL_DUMP = UINT_MAX; +static const unsigned int DLOGUTIL_MAX_DUMP_SIZE = UINT_MAX; /** * @brief Retrieves logs continuously, until the callback returns a non-zero value. @@ -368,7 +368,7 @@ int dlogutil_get_logs_continuous(int buffers, dlogutil_entry_cb callback, void * * Using kmsg or syslog together with other buffers is currently not allowed, * but it might be possible in the future * @param[in] entry_count Number of logs to be returned. - * It can be #DLOGUTIL_MODE_FULL_DUMP, in which case all the logs will be dumped + * It can be #DLOGUTIL_MAX_DUMP_SIZE, in which case all the logs will be dumped * @param[in] callback Callback, which will be called for each log (see dlogutil_entry_cb()). * Non-zero return value will terminate the function early * @param[in] data User data, which will be passed to the callback diff --git a/src/logutil/logutil.c b/src/logutil/logutil.c index 11a93bc..24ecaa0 100644 --- a/src/logutil/logutil.c +++ b/src/logutil/logutil.c @@ -116,7 +116,7 @@ int parse_options(int argc, char **argv, struct log_file *l_file, int *enabled_b } break; case 'd': - opt->logs_dump = DLOGUTIL_MODE_FULL_DUMP; + opt->logs_dump = DLOGUTIL_MAX_DUMP_SIZE; break; case 't': if (sscanf(optarg, "%u", &opt->logs_dump) != 1) diff --git a/src/shared/logretrieve.c b/src/shared/logretrieve.c index e8ba187..8a63bb7 100644 --- a/src/shared/logretrieve.c +++ b/src/shared/logretrieve.c @@ -226,7 +226,7 @@ int do_print(struct fd_info **data_fds, int fd_count, dlogutil_entry_cb callback if (r != 0) return r; - if (logs.dump != DLOGUTIL_MODE_CONTINUOUS && logs.dump != DLOGUTIL_MODE_FULL_DUMP) + if (logs.dump != DLOGUTIL_MODE_CONTINUOUS && logs.dump != DLOGUTIL_MAX_DUMP_SIZE) while (sort_vector_used_size(&logs) > logs.dump) sort_vector_pop(&logs); diff --git a/src/shared/sort_vector.c b/src/shared/sort_vector.c index a69d2ef..508da12 100644 --- a/src/shared/sort_vector.c +++ b/src/shared/sort_vector.c @@ -48,7 +48,7 @@ int sort_vector_finalize(struct sort_vector *logs) { assert(logs); - if (logs->dump != DLOGUTIL_MODE_FULL_DUMP && logs->dump != DLOGUTIL_MODE_CONTINUOUS) + if (logs->dump != DLOGUTIL_MAX_DUMP_SIZE && logs->dump != DLOGUTIL_MODE_CONTINUOUS) logs->size = logs->dump + 1; // +1 so that `-t 1` works (buffer must have capacity at least 2) logs->size = clamp_int(logs->size, 0, MAX_SORT_BUFFER_SIZE); @@ -122,7 +122,7 @@ int sort_vector_push(struct sort_vector *logs, dlogutil_entry_s *p, dlogutil_ent assert(p); if (sort_vector_full(logs)) { - if (logs->dump == DLOGUTIL_MODE_CONTINUOUS || logs->dump == DLOGUTIL_MODE_FULL_DUMP) { + if (logs->dump == DLOGUTIL_MODE_CONTINUOUS || logs->dump == DLOGUTIL_MAX_DUMP_SIZE) { const int r = callback(sort_vector_back(logs), userdata); if (r != 0) return r; diff --git a/tests/test_libdlogutil.c b/tests/test_libdlogutil.c index d0e26ec..4108036 100644 --- a/tests/test_libdlogutil.c +++ b/tests/test_libdlogutil.c @@ -116,7 +116,7 @@ int sorting_check(dlogutil_sorting_order_e sort_by) dlogutil_sorting_options_enable_sorting(sorting); dlogutil_sorting_options_set_sort_by(sorting, sort_by); - return dlogutil_get_logs_dump(DLOGUTIL_BUF_MAIN, DLOGUTIL_MODE_FULL_DUMP, sorting_callback, &data, sorting, NULL); + return dlogutil_get_logs_dump(DLOGUTIL_BUF_MAIN, DLOGUTIL_MAX_DUMP_SIZE, sorting_callback, &data, sorting, NULL); } bool sorting_main(int left) @@ -200,7 +200,7 @@ int clear_callback(const dlogutil_entry_s *ent, void *var) void clear_main() { assert(dlogutil_buffer_clear(DLOGUTIL_BUF_MAIN) == 0); - assert(dlogutil_get_logs_dump(DLOGUTIL_BUF_MAIN, DLOGUTIL_MODE_FULL_DUMP, clear_callback, NULL, NULL, NULL) == 0); + assert(dlogutil_get_logs_dump(DLOGUTIL_BUF_MAIN, DLOGUTIL_MAX_DUMP_SIZE, clear_callback, NULL, NULL, NULL) == 0); } enum test_mode { @@ -321,13 +321,13 @@ int main(int argc, char **argv) int r; if (t == MODE_DEFAULTS) - r = dlogutil_get_logs_dump(DLOGUTIL_BUF_MAIN, DLOGUTIL_MODE_FULL_DUMP, test_callback, &data, NULL, NULL); + r = dlogutil_get_logs_dump(DLOGUTIL_BUF_MAIN, DLOGUTIL_MAX_DUMP_SIZE, test_callback, &data, NULL, NULL); else if (t == MODE_LIMIT) r = dlogutil_get_logs_dump(DLOGUTIL_BUF_MAIN, 100, test_callback, &data, sorting, filter); else if (t == MODE_CONTINUOUS) r = dlogutil_get_logs_continuous(DLOGUTIL_BUF_MAIN, test_callback, &data, sorting, filter); else - r = dlogutil_get_logs_dump(DLOGUTIL_BUF_MAIN, DLOGUTIL_MODE_FULL_DUMP, test_callback, &data, sorting, filter); + r = dlogutil_get_logs_dump(DLOGUTIL_BUF_MAIN, DLOGUTIL_MAX_DUMP_SIZE, test_callback, &data, sorting, filter); if (t == MODE_CONTINUOUS) return EXIT_FAILURE;