From 4b37b62c2f4f6bc38f61b867a0f9a3238e9cd741 Mon Sep 17 00:00:00 2001 From: YingJie Fu Date: Tue, 13 Aug 2024 18:19:49 -0700 Subject: [PATCH] rever the changes and fix tests/internal/config_map.c --- plugins/in_head/in_head.c | 2 +- plugins/in_tail/tail_config.h | 4 ++-- src/flb_config_map.c | 12 ++++++------ tests/internal/config_map.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/in_head/in_head.c b/plugins/in_head/in_head.c index afc4be53fef..bf2a1ea2034 100644 --- a/plugins/in_head/in_head.c +++ b/plugins/in_head/in_head.c @@ -426,7 +426,7 @@ static struct flb_config_map config_map[] = { "Set the record key" }, { - FLB_CONFIG_MAP_SIZE, "buf_size", DEFAULT_BUF_SIZE, + FLB_CONFIG_MAP_INT, "buf_size", DEFAULT_BUF_SIZE, 0, FLB_TRUE, offsetof(struct flb_in_head_config, buf_size), "Set the read buffer size" }, diff --git a/plugins/in_tail/tail_config.h b/plugins/in_tail/tail_config.h index e8c28185a4e..dc2f6480a08 100644 --- a/plugins/in_tail/tail_config.h +++ b/plugins/in_tail/tail_config.h @@ -83,9 +83,9 @@ struct flb_tail_config { int refresh_interval_sec; /* seconds to re-scan */ long refresh_interval_nsec;/* nanoseconds to re-scan */ int read_from_head; /* read new files from head */ - time_t rotate_wait; /* sec to wait on rotated files */ + int rotate_wait; /* sec to wait on rotated files */ int watcher_interval; /* watcher interval */ - time_t ignore_older; /* ignore fields older than X seconds */ + int ignore_older; /* ignore fields older than X seconds */ time_t last_pending; /* last time a 'pending signal' was emitted' */ struct mk_list *path_list; /* list of paths to scan (glob) */ flb_sds_t path_key; /* key name of file path */ diff --git a/src/flb_config_map.c b/src/flb_config_map.c index 126dd9fe1cc..f09a689a0bb 100644 --- a/src/flb_config_map.c +++ b/src/flb_config_map.c @@ -166,7 +166,7 @@ static int translate_default_value(struct flb_config_map *map, char *val) entry->val.s_num = flb_utils_size_to_bytes(val); } else if (map->type == FLB_CONFIG_MAP_TIME) { - entry->val.s_num = flb_utils_time_to_seconds(val); + entry->val.i_num = flb_utils_time_to_seconds(val); } else if (map->type >= FLB_CONFIG_MAP_CLIST && map->type <= FLB_CONFIG_MAP_SLIST_4) { @@ -650,8 +650,8 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co *m_s_num = m->value.val.s_num; } else if (m->type == FLB_CONFIG_MAP_TIME) { - m_s_num = (size_t *) (base + m->offset); - *m_s_num = m->value.val.s_num; + m_i_num = (int *) (base + m->offset); + *m_i_num = m->value.val.i_num; } else if (m->type == FLB_CONFIG_MAP_BOOL) { m_bool = (int *) (base + m->offset); @@ -717,7 +717,7 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co entry->val.s_num = flb_utils_size_to_bytes(kv->val); } else if (m->type == FLB_CONFIG_MAP_TIME) { - entry->val.s_num = flb_utils_time_to_seconds(kv->val); + entry->val.i_num = flb_utils_time_to_seconds(kv->val); } else if (m->type == FLB_CONFIG_MAP_BOOL) { ret = flb_utils_bool(kv->val); @@ -793,8 +793,8 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co *m_s_num = flb_utils_size_to_bytes(kv->val); } else if (m->type == FLB_CONFIG_MAP_TIME) { - m_s_num = (size_t *) (base + m->offset); - *m_s_num = flb_utils_time_to_seconds(kv->val); + m_i_num = (int *) (base + m->offset); + *m_i_num = flb_utils_time_to_seconds(kv->val); } else if (m->type == FLB_CONFIG_MAP_VARIANT) { m_variant = (struct cfl_variant **) (base + m->offset); diff --git a/tests/internal/config_map.c b/tests/internal/config_map.c index 687e2313ac6..941b815e902 100644 --- a/tests/internal/config_map.c +++ b/tests/internal/config_map.c @@ -13,7 +13,7 @@ struct context { /* Single values */ int num_int; size_t size; - time_t time; + int time; int boolean; double num_double; flb_sds_t string;