From d3c9360c1b673381bd9c5d3e7210fd80cf700a0f Mon Sep 17 00:00:00 2001 From: Mateusz Majewski Date: Fri, 25 Oct 2019 09:30:34 +0200 Subject: [PATCH] Rename log_filter to dlogutil_filter_options This also changes the namespace, as log_filter used to be a typedef, but dlogutil_filter_options is just a normal struct. Change-Id: I7a0aed07fd8ec0318e07269307c65d09d66e65fe --- include/fd_info.h | 4 ++-- include/logprint.h | 24 +++++++++++------------- include/logretrieve.h | 2 +- src/logger/logger_internal.h | 2 +- src/shared/fd_info.c | 2 +- src/shared/fdi_logger.c | 2 +- src/shared/fdi_pipe.c | 4 ++-- src/shared/logprint.c | 30 +++++++++++++++--------------- src/shared/logretrieve.c | 2 +- src/tests/fd_info.c | 22 +++++++++++----------- src/tests/fdi_logger.c | 10 +++++----- src/tests/fdi_pipe.c | 2 +- src/tests/filters.c | 14 +++++++------- src/tests/logprint.c | 6 +++--- src/tests/logutil.c | 16 ++++++++-------- 15 files changed, 70 insertions(+), 72 deletions(-) diff --git a/include/fd_info.h b/include/fd_info.h index d1940ee..1566551 100644 --- a/include/fd_info.h +++ b/include/fd_info.h @@ -54,7 +54,7 @@ struct fd_ops { /// Transition into a state that allows reading and printing out logs /// Return values > 0 mean everything went fine but we don't want to print - int (*prepare_print)(struct fd_info *fdi, int dump, log_filter *filter_object); + int (*prepare_print)(struct fd_info *fdi, int dump, struct dlogutil_filter_options *filter_object); /// Clear the buffer int (*clear)(struct fd_info *fdi); @@ -70,6 +70,6 @@ struct fd_info *fdi_create(struct fd_ops *ops, const char *name); void fdi_free(struct fd_info *fdi); void fdi_array_free(struct fd_info ***arr); bool fdi_has_log(struct fd_info *fdi); -int fdi_push_log(struct fd_info *fdi, struct sort_vector *logs, dlogutil_write_callback callback, void *userdata, log_filter *filter); +int fdi_push_log(struct fd_info *fdi, struct sort_vector *logs, dlogutil_write_callback callback, void *userdata, struct dlogutil_filter_options *filter); struct dlogutil_entry *fdi_extract_entry(struct fd_info *fdi); int fdi_read(struct fd_info *fdi); diff --git a/include/logprint.h b/include/logprint.h index 109dafe..b87d010 100644 --- a/include/logprint.h +++ b/include/logprint.h @@ -52,16 +52,14 @@ struct log_format { bool color; }; -typedef struct log_filter_t log_filter; +struct dlogutil_filter_options *log_filter_new(); -log_filter *log_filter_new(); - -void log_filter_free(log_filter *p_filter); +void log_filter_free(struct dlogutil_filter_options *p_filter); /** * Returns a deep copy of the passed object. */ -log_filter *log_filter_from_filter(const log_filter *p_filter); +struct dlogutil_filter_options *log_filter_from_filter(const struct dlogutil_filter_options *p_filter); /** * Returns FORMAT_OFF on invalid string @@ -78,7 +76,7 @@ log_print_format log_format_from_string(const char *s); * */ -int log_add_filter_rule(log_filter *p_filter, const char *filterExpression); +int log_add_filter_rule(struct dlogutil_filter_options *p_filter, const char *filterExpression); /** * filterString: a whitespace-separated set of filter expressions @@ -90,7 +88,7 @@ int log_add_filter_rule(log_filter *p_filter, const char *filterExpression); * */ -int log_add_filter_string(log_filter *p_filter, const char *filterString); +int log_add_filter_string(struct dlogutil_filter_options *p_filter, const char *filterString); /** @@ -105,7 +103,7 @@ int log_add_filter_string(log_filter *p_filter, const char *filterString); * */ -int log_add_filter_pid(log_filter *p_filter, pid_t pid); +int log_add_filter_pid(struct dlogutil_filter_options *p_filter, pid_t pid); /** @@ -120,9 +118,9 @@ int log_add_filter_pid(log_filter *p_filter, pid_t pid); * */ -int log_add_filter_tid(log_filter *p_filter, pid_t tid); +int log_add_filter_tid(struct dlogutil_filter_options *p_filter, pid_t tid); -void log_filter_clear(log_filter *p_filter); +void log_filter_clear(struct dlogutil_filter_options *p_filter); struct tag_and_prio { char *tag; @@ -145,16 +143,16 @@ typedef struct FilterInfo_t { }; } FilterInfo; -list_head log_filter_get_list(log_filter *p_filter); +list_head log_filter_get_list(struct dlogutil_filter_options *p_filter); -log_priority log_filter_get_global_priority(log_filter *p_filter, bool *is_exact); +log_priority log_filter_get_global_priority(struct dlogutil_filter_options *p_filter, bool *is_exact); /** * returns true if this log line should be printed based on its entry * data (priority, tag, pid and tid), and false if it should not */ bool log_should_print_line( - log_filter *p_filter, const struct dlogutil_entry *entry); + struct dlogutil_filter_options *p_filter, const struct dlogutil_entry *entry); /** * Returns pointer to log entry tag diff --git a/include/logretrieve.h b/include/logretrieve.h index 024ddf1..ed1daa8 100644 --- a/include/logretrieve.h +++ b/include/logretrieve.h @@ -4,7 +4,7 @@ #include struct additional_options { - log_filter *filter_object; + struct dlogutil_filter_options *filter_object; size_t logs_dump; size_t logs_size; }; diff --git a/src/logger/logger_internal.h b/src/logger/logger_internal.h index 5fda29a..3c64d46 100644 --- a/src/logger/logger_internal.h +++ b/src/logger/logger_internal.h @@ -136,7 +136,7 @@ typedef int (*service_reader_t)(struct reader *reader); struct reader { struct fd_entity fd_entity; struct log_file file; - log_filter* filter; + struct dlogutil_filter_options* filter; struct log_buffer* buf_ptr; int read_fd; bool dumpcount; diff --git a/src/shared/fd_info.c b/src/shared/fd_info.c index 478aa1a..053dcd3 100644 --- a/src/shared/fd_info.c +++ b/src/shared/fd_info.c @@ -76,7 +76,7 @@ void fdi_array_free(struct fd_info ***arr) free(*arr); } -int fdi_push_log(struct fd_info *fdi, struct sort_vector *logs, dlogutil_write_callback callback, void *userdata, log_filter *filter) +int fdi_push_log(struct fd_info *fdi, struct sort_vector *logs, dlogutil_write_callback callback, void *userdata, struct dlogutil_filter_options *filter) { assert(fdi); assert(userdata); diff --git a/src/shared/fdi_logger.c b/src/shared/fdi_logger.c index c3fd6f6..fd358a5 100644 --- a/src/shared/fdi_logger.c +++ b/src/shared/fdi_logger.c @@ -159,7 +159,7 @@ static void logger_destroy(struct fd_info *fdi) fdi->priv_data = NULL; } -static int logger_prepare_print(struct fd_info *fdi, int dump, log_filter *filter_object) +static int logger_prepare_print(struct fd_info *fdi, int dump, struct dlogutil_filter_options *filter_object) { assert(fdi); struct logger_priv_data *const lpd = (struct logger_priv_data *)fdi->priv_data; diff --git a/src/shared/fdi_pipe.c b/src/shared/fdi_pipe.c index d75db46..8bd1353 100644 --- a/src/shared/fdi_pipe.c +++ b/src/shared/fdi_pipe.c @@ -77,7 +77,7 @@ static int pipe_clear(struct fd_info *fdi) * @param[in] sock_fd Socket file descriptor * @return 0 on success, -errno on failure */ -static int send_logger_request(log_filter *filters, int dump, int sock_fd) +static int send_logger_request(struct dlogutil_filter_options *filters, int dump, int sock_fd) { assert(filters); assert(sock_fd >= 0); @@ -192,7 +192,7 @@ static void pipe_destroy(struct fd_info *fdi) fdi->priv_data = NULL; } -static int pipe_prepare_print(struct fd_info *fdi, int dump, log_filter *filter_object) +static int pipe_prepare_print(struct fd_info *fdi, int dump, struct dlogutil_filter_options *filter_object) { assert(filter_object); assert(fdi); diff --git a/src/shared/logprint.c b/src/shared/logprint.c index 254d2b4..5352518 100644 --- a/src/shared/logprint.c +++ b/src/shared/logprint.c @@ -32,7 +32,7 @@ #define FILTERINFO_PID_NONE -1 #define FILTERINFO_TID_NONE -1 -struct log_filter_t { +struct dlogutil_filter_options { list_head filters; log_priority global_pri; bool exact_global_pri; @@ -201,7 +201,7 @@ char filter_pri_to_char(log_priority pri) * @param[in] entry The log entry to filter * @return True if the line should be printed, else false */ -bool log_should_print_line(log_filter *p_filter, const struct dlogutil_entry *entry) +bool log_should_print_line(struct dlogutil_filter_options *p_filter, const struct dlogutil_entry *entry) { assert(p_filter); assert(entry); @@ -267,11 +267,11 @@ bool log_should_print_line(log_filter *p_filter, const struct dlogutil_entry *en * @return The new structure (or NULL if allocation failed). * @see log_filter_free */ -log_filter *log_filter_new(void) +struct dlogutil_filter_options *log_filter_new(void) { - log_filter *p_ret; + struct dlogutil_filter_options *p_ret; - p_ret = calloc(1, sizeof(log_filter)); + p_ret = calloc(1, sizeof(struct dlogutil_filter_options)); if (!p_ret) return NULL; @@ -288,9 +288,9 @@ log_filter *log_filter_new(void) * @return The new structure (or NULL if allocation failed) * @see log_filter_free */ -log_filter *log_filter_from_filter(const log_filter *p_filter) +struct dlogutil_filter_options *log_filter_from_filter(const struct dlogutil_filter_options *p_filter) { - log_filter *p_ret; + struct dlogutil_filter_options *p_ret; if (!(p_ret = log_filter_new())) return NULL; @@ -313,7 +313,7 @@ log_filter *log_filter_from_filter(const log_filter *p_filter) * @details Deallocates the entire log format structure * @param[in] p_format The structure to deallocate */ -void log_filter_free(log_filter *p_filter) +void log_filter_free(struct dlogutil_filter_options *p_filter) { if (p_filter) { log_filter_clear(p_filter); @@ -322,7 +322,7 @@ void log_filter_free(log_filter *p_filter) } } -void log_filter_clear(log_filter *p_filter) +void log_filter_clear(struct dlogutil_filter_options *p_filter) { assert(p_filter); @@ -331,14 +331,14 @@ void log_filter_clear(log_filter *p_filter) p_filter->exact_global_pri = false; } -list_head log_filter_get_list(log_filter *p_filter) +list_head log_filter_get_list(struct dlogutil_filter_options *p_filter) { assert(p_filter); return p_filter->filters; } -log_priority log_filter_get_global_priority(log_filter *p_filter, bool *is_exact) +log_priority log_filter_get_global_priority(struct dlogutil_filter_options *p_filter, bool *is_exact) { assert(is_exact); assert(p_filter); @@ -388,7 +388,7 @@ log_print_format log_format_from_string(const char *formatString) * @return 0 on success, else -1 * @remarks Assumes single threaded execution */ -int log_add_filter_rule(log_filter *p_filter, +int log_add_filter_rule(struct dlogutil_filter_options *p_filter, const char *filterExpression) { size_t tagNameLength, priPosition; @@ -465,7 +465,7 @@ error: * @return 0 on success, else -1 * @remarks Assumes single threaded execution */ -int log_add_filter_string(log_filter *p_filter, +int log_add_filter_string(struct dlogutil_filter_options *p_filter, const char *filterString) { assert(p_filter); @@ -504,7 +504,7 @@ error: * @return 0 on success, else -ENOMEM * @remarks Assumes single threaded execution */ -int log_add_filter_pid(log_filter *p_filter, pid_t pid) +int log_add_filter_pid(struct dlogutil_filter_options *p_filter, pid_t pid) { assert(p_filter); @@ -523,7 +523,7 @@ int log_add_filter_pid(log_filter *p_filter, pid_t pid) * @return 0 on success, else -ENOMEM * @remarks Assumes single threaded execution */ -int log_add_filter_tid(log_filter *p_filter, pid_t tid) +int log_add_filter_tid(struct dlogutil_filter_options *p_filter, pid_t tid) { assert(p_filter); diff --git a/src/shared/logretrieve.c b/src/shared/logretrieve.c index c4d3626..6f7e5a4 100644 --- a/src/shared/logretrieve.c +++ b/src/shared/logretrieve.c @@ -117,7 +117,7 @@ struct fd_info *find_earliest_log(struct fd_info **data_fds, int fd_count, enum return best_fdi; } -int put_logs_into_vector(struct fd_info **data_fds, int fd_count, int nfds, struct sort_vector *logs, dlogutil_write_callback callback, void *userdata, log_filter *filter) +int put_logs_into_vector(struct fd_info **data_fds, int fd_count, int nfds, struct sort_vector *logs, dlogutil_write_callback callback, void *userdata, struct dlogutil_filter_options *filter) { assert(data_fds); assert(logs); diff --git a/src/tests/fd_info.c b/src/tests/fd_info.c index fcb856f..dbd159f 100644 --- a/src/tests/fd_info.c +++ b/src/tests/fd_info.c @@ -81,9 +81,9 @@ void test_destroy(struct fd_info *fdi) } static bool should_print_line = true; -bool __wrap_log_should_print_line(log_filter *p_filter, const struct dlogutil_entry *entry) +bool __wrap_log_should_print_line(struct dlogutil_filter_options *p_filter, const struct dlogutil_entry *entry) { - assert(p_filter == (log_filter *)404); + assert(p_filter == (struct dlogutil_filter_options *)404); assert(entry == (struct dlogutil_entry *)0xBADFEEL); return should_print_line; } @@ -151,23 +151,23 @@ int main() should_print_line = false; expect_free1 = (void *) 0xBADFEEL; - assert(0 == fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (log_filter *) 404)); + assert(0 == fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (struct dlogutil_filter_options *) 404)); should_print_line = true; fail_extract = true; - assert(-ENOMEM == fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (log_filter *) 404)); + assert(-ENOMEM == fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (struct dlogutil_filter_options *) 404)); fail_extract = false; sv.size = 99; expect_free1 = NULL; - assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (log_filter *) 404)); + assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (struct dlogutil_filter_options *) 404)); assert(sv_pushed); assert(!sv_flushed); sv_pushed = false; sv_push_retval = -83; expect_free1 = &G_fdi; - assert(-83 == fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (log_filter *) 404)); + assert(-83 == fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (struct dlogutil_filter_options *) 404)); assert(sv_pushed); assert(!sv_flushed); sv_push_retval = 0; @@ -175,31 +175,31 @@ int main() sv.old_logs_dumped = false; sv.start.tv_sec = 2; sv.start.tv_nsec = 0; - assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (log_filter *) 404)); + assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (struct dlogutil_filter_options *) 404)); assert(!sv.old_logs_dumped); sv.old_logs_dumped = false; sv.start.tv_sec = 1; sv.start.tv_nsec = 1; - assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (log_filter *) 404)); + assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (struct dlogutil_filter_options *) 404)); assert(!sv.old_logs_dumped); sv.old_logs_dumped = false; sv.start.tv_sec = 1; sv.start.tv_nsec = 0; - assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (log_filter *) 404)); + assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (struct dlogutil_filter_options *) 404)); assert(sv.old_logs_dumped); sv.old_logs_dumped = false; sv.start.tv_sec = 0; sv.start.tv_nsec = 2; - assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (log_filter *) 404)); + assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (struct dlogutil_filter_options *) 404)); assert(sv.old_logs_dumped); sv_pushed = false; sv.size = 0; expect_free1 = (void *) 0xBADFEEL; - assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (log_filter *) 404)); + assert(!fdi_push_log(&G_fdi, &sv, callback, (void *) 0xDEFACED, (struct dlogutil_filter_options *) 404)); assert(!sv_pushed); assert(sv_flushed); diff --git a/src/tests/fdi_logger.c b/src/tests/fdi_logger.c index c8ad86c..17ede4b 100644 --- a/src/tests/fdi_logger.c +++ b/src/tests/fdi_logger.c @@ -22,10 +22,10 @@ int __wrap_logger_open_buffer_from_config_get_path(int buf_id, const struct log_ static size_t filters_added; static char *const filter_strs[] = {"H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne"}; -int __wrap_log_add_filter_string(log_filter *p_filter, const char *filterString) +int __wrap_log_add_filter_string(struct dlogutil_filter_options *p_filter, const char *filterString) { assert(filterString); - assert(p_filter == (log_filter *) 0xCA5CADE); + assert(p_filter == (struct dlogutil_filter_options *) 0xCA5CADE); ++filters_added; for (size_t i = 0; i < NELEMS(filter_strs); ++i) @@ -180,14 +180,14 @@ int main() assert(2019 == sz); expected_ioctl = -1; - assert(!ops_logger.prepare_print(&fdi, DLOGUTIL_MODE_CONTINUOUS, (log_filter *) 0xCA5CADE)); + assert(!ops_logger.prepare_print(&fdi, DLOGUTIL_MODE_CONTINUOUS, (struct dlogutil_filter_options *) 0xCA5CADE)); expected_ioctl = LOGGER_GET_LOG_LEN; ioctl_ret = -67; - assert(-67 == ops_logger.prepare_print(&fdi, 123, (log_filter *) 0xCA5CADE)); + assert(-67 == ops_logger.prepare_print(&fdi, 123, (struct dlogutil_filter_options *) 0xCA5CADE)); expected_ioctl = LOGGER_GET_LOG_LEN; ioctl_ret = 0; - assert(1 == ops_logger.prepare_print(&fdi, 123, (log_filter *) 0xCA5CADE)); + assert(1 == ops_logger.prepare_print(&fdi, 123, (struct dlogutil_filter_options *) 0xCA5CADE)); fail_read = true; assert(-334 == ops_logger.read(&fdi)); diff --git a/src/tests/fdi_pipe.c b/src/tests/fdi_pipe.c index 980e777..8e9e07c 100644 --- a/src/tests/fdi_pipe.c +++ b/src/tests/fdi_pipe.c @@ -132,7 +132,7 @@ int main() assert(!ops_pipe.has_log(&info)); - log_filter *filter = log_filter_new(); + struct dlogutil_filter_options *filter = log_filter_new(); assert(filter); log_add_filter_string(filter, "filter0"); diff --git a/src/tests/filters.c b/src/tests/filters.c index f18d416..dee1fb8 100644 --- a/src/tests/filters.c +++ b/src/tests/filters.c @@ -29,7 +29,7 @@ int pid_tid_filter_list[] = { * @param[in] expected The expected result returned by log_should_print_line function * @return 0 if the log_should_print_line returns the expected result, 1 otherwise */ -int check_print_line_tid_single(int line, log_filter *p_filter, pthread_t tid, bool expected) +int check_print_line_tid_single(int line, struct dlogutil_filter_options *p_filter, pthread_t tid, bool expected) { struct dlogutil_entry_with_msg entry; @@ -58,7 +58,7 @@ int check_print_line_tid_single(int line, log_filter *p_filter, pthread_t tid, b * @return Number of tids for which log_should_print_line returns wrong answer */ -int check_print_line_tid(int line, log_filter *p_filter, pthread_t tid) +int check_print_line_tid(int line, struct dlogutil_filter_options *p_filter, pthread_t tid) { int result = 0; for (int tid_no = 0; tid_no < NELEMS(pid_tid_filter_list); tid_no++) @@ -75,7 +75,7 @@ int check_print_line_tid(int line, log_filter *p_filter, pthread_t tid) * @param[in] expected The expected result returned by log_should_print_line function * @return 0 if the log_should_print_line returns the expected result, 1 otherwise */ -int check_print_line_pid_single(int line, log_filter *p_filter, pid_t pid, bool expected) +int check_print_line_pid_single(int line, struct dlogutil_filter_options *p_filter, pid_t pid, bool expected) { struct dlogutil_entry_with_msg entry; @@ -104,7 +104,7 @@ int check_print_line_pid_single(int line, log_filter *p_filter, pid_t pid, bool * @return Number of pids for which log_should_print_line returns wrong answer */ -int check_print_line_pid(int line, log_filter *p_filter, pid_t pid) +int check_print_line_pid(int line, struct dlogutil_filter_options *p_filter, pid_t pid) { int result = 0; for (int pid_no = 0; pid_no < NELEMS(pid_tid_filter_list); pid_no++) @@ -122,7 +122,7 @@ int check_print_line_pid(int line, log_filter *p_filter, pid_t pid) * @param[in] expected The expected result returned by log_should_print_line function * @return 0 if the log_should_print_line returns the expected result, 1 otherwise */ -int check_print_line_tag_prior(int line, log_filter *p_filter, char *tag, int priority, bool expected) +int check_print_line_tag_prior(int line, struct dlogutil_filter_options *p_filter, char *tag, int priority, bool expected) { struct dlogutil_entry_with_msg entry; @@ -151,7 +151,7 @@ int check_print_line_tag_prior(int line, log_filter *p_filter, char *tag, int pr * @return Number of priorities for which log_should_print_line returns wrong answer */ -int check_print_line_tag(int line, log_filter *p_filter, char *tag, int priors) +int check_print_line_tag(int line, struct dlogutil_filter_options *p_filter, char *tag, int priors) { int result = 0; result += check_print_line_tag_prior(line, p_filter, tag, DLOG_VERBOSE, (priors & verbose) > 0); @@ -168,7 +168,7 @@ int main() int err; int result = 0; char *tag, *tag_short, *tag_middle, *tag_long; - log_filter *p_filter; + struct dlogutil_filter_options *p_filter; struct dlogutil_entry_with_msg entry; entry.header.tid = 0; diff --git a/src/tests/logprint.c b/src/tests/logprint.c index 063a34c..d6b4b62 100644 --- a/src/tests/logprint.c +++ b/src/tests/logprint.c @@ -525,13 +525,13 @@ void check_isatty_detection() void check_syscall_failure_handling() { - log_filter *const filter = log_filter_new(); + struct dlogutil_filter_options *const filter = log_filter_new(); assert(filter); assert(!log_add_filter_tid(filter, 123)); assert(!log_add_filter_pid(filter, 456)); assert(!log_add_filter_rule(filter, "FOO:E")); - log_filter *const clone = log_filter_from_filter(filter); + struct dlogutil_filter_options *const clone = log_filter_from_filter(filter); assert(clone); log_filter_free(clone); @@ -598,7 +598,7 @@ void check_invalid_input() assert(!log_buffer_get_message(&entry)); assert(!log_buffer_get_tag(&entry)); - log_filter *const filter = log_filter_new(); + struct dlogutil_filter_options *const filter = log_filter_new(); assert(filter); assert(-1 == log_add_filter_rule(filter, ":D")); // >mfw tagless rule gets processed correctly log_filter_free(filter); diff --git a/src/tests/logutil.c b/src/tests/logutil.c index 03d2c8d..4efdc56 100644 --- a/src/tests/logutil.c +++ b/src/tests/logutil.c @@ -8,7 +8,7 @@ bool process_log(const struct dlogutil_entry *e, struct timespec reference_ts, enum dlogutil_sorting_order stamp_type, dlogutil_write_callback callback, void *userdata, long timeout, int *callback_ret); struct fd_info *find_earliest_log(struct fd_info **data_fds, int fd_count, enum dlogutil_sorting_order sort_by); -int put_logs_into_vector(struct fd_info **data_fds, int fd_count, int nfds, struct sort_vector *logs, dlogutil_write_callback callback, void *userdata, log_filter *filter); +int put_logs_into_vector(struct fd_info **data_fds, int fd_count, int nfds, struct sort_vector *logs, dlogutil_write_callback callback, void *userdata, struct dlogutil_filter_options *filter); int validate_buffers(int *enabled_buffers); int written_logs = 0; @@ -33,7 +33,7 @@ int __wrap_clock_gettime(clockid_t clk_id, struct timespec *tp) return 0; } -bool __wrap_log_should_print_line(log_filter *p_filter, const struct dlogutil_entry *entry) +bool __wrap_log_should_print_line(struct dlogutil_filter_options *p_filter, const struct dlogutil_entry *entry) { return true; } @@ -57,9 +57,9 @@ const struct dlogutil_entry *test_peek_entry(const struct fd_info *fdi) } int fdi_push_log_ret = 0; -int __wrap_fdi_push_log(struct fd_info *fdi, struct sort_vector *logs, dlogutil_write_callback callback, void *userdata, log_filter *filter) +int __wrap_fdi_push_log(struct fd_info *fdi, struct sort_vector *logs, dlogutil_write_callback callback, void *userdata, struct dlogutil_filter_options *filter) { - assert(filter == (log_filter *)0xEEE); + assert(filter == (struct dlogutil_filter_options *)0xEEE); if (fdi_push_log_ret != 0) return fdi_push_log_ret; struct dlogutil_entry *ent = calloc(1, sizeof(struct dlogutil_entry)); @@ -195,16 +195,16 @@ int main() assert(written_logs == 1); assert(sort_vector_used_size(&sv) == 0); - assert(put_logs_into_vector(fds, 0, 1, &sv, callback, (void *)0xDDD, (log_filter *)0xEEE) == 0); + assert(put_logs_into_vector(fds, 0, 1, &sv, callback, (void *)0xDDD, (struct dlogutil_filter_options *)0xEEE) == 0); fdi_push_log_ret = -EIO; - assert(put_logs_into_vector(fds, 10, 1, &sv, callback, (void *)0xDDD, (log_filter *)0xEEE) == -EIO); + assert(put_logs_into_vector(fds, 10, 1, &sv, callback, (void *)0xDDD, (struct dlogutil_filter_options *)0xEEE) == -EIO); fdi_push_log_ret = 0; - assert(put_logs_into_vector(fds, 10, 1, &sv, callback, (void *)0xDDD, (log_filter *)0xEEE) == 0); + assert(put_logs_into_vector(fds, 10, 1, &sv, callback, (void *)0xDDD, (struct dlogutil_filter_options *)0xEEE) == 0); assert(sort_vector_used_size(&sv) == 1); - assert(put_logs_into_vector(fds, 10, 0, &sv, callback, (void *)0xDDD, (log_filter *)0xEEE) == 0); + assert(put_logs_into_vector(fds, 10, 0, &sv, callback, (void *)0xDDD, (struct dlogutil_filter_options *)0xEEE) == 0); assert(sort_vector_used_size(&sv) == 7); int buf = 0; -- 2.7.4