From b964913ab378f11141556fc179817b48608a094a Mon Sep 17 00:00:00 2001 From: Tobias Oetiker Date: Tue, 16 May 2017 10:32:19 +0200 Subject: [PATCH] export 3 extra functions rrd_reduce_data(), rrd_lcd() and rrd_cf_conv() --- src/librrd.sym | 3 +++ src/rrd_create.c | 38 +++++++++++++++++++------------------- src/rrd_dump.c | 4 ++-- src/rrd_fetch.c | 4 ++-- src/rrd_format.c | 2 +- src/rrd_graph.c | 8 ++++---- src/rrd_graph.h | 6 +++--- src/rrd_graph_helper.c | 6 +++--- src/rrd_hw.c | 14 +++++++------- src/rrd_info.c | 2 +- src/rrd_modify.c | 14 +++++++------- src/rrd_restore.c | 2 +- src/rrd_tool.h | 2 +- src/rrd_tune.c | 8 ++++---- src/rrd_update.c | 8 ++++---- src/rrd_xport.c | 2 +- 16 files changed, 63 insertions(+), 60 deletions(-) diff --git a/src/librrd.sym b/src/librrd.sym index 17bb693c..c5a707d8 100644 --- a/src/librrd.sym +++ b/src/librrd.sym @@ -69,6 +69,9 @@ rrd_update_v_r rrd_version rrd_write rrd_xport +rrd_reduce_data +rrd_lcd +rrd_cf_conv rrdc_connect rrdc_is_connected rrdc_is_any_connected diff --git a/src/rrd_create.c b/src/rrd_create.c index ec6b4d39..53eb74b4 100644 --- a/src/rrd_create.c +++ b/src/rrd_create.c @@ -463,7 +463,7 @@ int parseRRA(const char *def, case 0: if (sscanf(token, CF_NAM_FMT, rra_def->cf_nam) != 1) rrd_set_error("Failed to parse CF name"); - cf_id = cf_conv(rra_def->cf_nam); + cf_id = rrd_cf_conv(rra_def->cf_nam); switch (cf_id) { case CF_MHWPREDICT: if (*require_version == NULL || atoi(*require_version) < atoi(RRD_VERSION4)) { @@ -514,7 +514,7 @@ int parseRRA(const char *def, rra_def->pdp_cnt = 1; break; case 1: - switch (cf_conv + switch (rrd_cf_conv (rra_def->cf_nam)) { case CF_HWPREDICT: case CF_MHWPREDICT: @@ -536,7 +536,7 @@ int parseRRA(const char *def, } break; case 2: - switch (cf_conv + switch (rrd_cf_conv (rra_def->cf_nam)) { case CF_HWPREDICT: case CF_MHWPREDICT: @@ -580,7 +580,7 @@ int parseRRA(const char *def, } break; case 3: - switch (cf_conv(rra_def->cf_nam)) { + switch (rrd_cf_conv(rra_def->cf_nam)) { case CF_HWPREDICT: case CF_MHWPREDICT: if (rrd_strtodbl(token, NULL, &tmpdbl, NULL) != 2 @@ -632,7 +632,7 @@ int parseRRA(const char *def, } break; case 4: - switch (cf_conv(rra_def->cf_nam)) { + switch (rrd_cf_conv(rra_def->cf_nam)) { case CF_FAILURES: /* specifies the index (1-based) of CF_DEVSEASONAL array * associated with this CF_DEVFAILURES array. */ @@ -727,8 +727,8 @@ rra_def_t *handle_dependent_rras(rra_def_t *rra_def_array, rra_def_t *rra_def = rra_def_array + (*rra_cnt-1); /* should we create CF_SEASONAL, CF_DEVSEASONAL, and CF_DEVPREDICT? */ - if ((cf_conv(rra_def->cf_nam) == CF_HWPREDICT - || cf_conv(rra_def->cf_nam) == CF_MHWPREDICT) + if ((rrd_cf_conv(rra_def->cf_nam) == CF_HWPREDICT + || rrd_cf_conv(rra_def->cf_nam) == CF_MHWPREDICT) && rra_def->par[RRA_dependent_rra_idx].u_cnt == INT_MAX) { rra_def->par[RRA_dependent_rra_idx].u_cnt = *rra_cnt-1; #ifdef DEBUG @@ -1172,7 +1172,7 @@ rra_def_t * create_hw_contingent_rras(rra_def_t *rra_defs, void init_cdp(const rrd_t *rrd, const rra_def_t *rra_def, const pdp_prep_t *pdp_prep, cdp_prep_t *cdp_prep) { - switch (cf_conv(rra_def->cf_nam)) { + switch (rrd_cf_conv(rra_def->cf_nam)) { case CF_HWPREDICT: case CF_MHWPREDICT: init_hwpredict_cdp(cdp_prep); @@ -1771,10 +1771,10 @@ static rrd_value_t prefill_finish(rra_def_t UNUSED(*rra_def), enum cf_en current } static int order_candidates(candidate_t *a, candidate_t *b, const candidate_t UNUSED(*target)) { - enum cf_en acf = cf_conv(a->rra->cf_nam); - enum cf_en bcf = cf_conv(b->rra->cf_nam); + enum cf_en acf = rrd_cf_conv(a->rra->cf_nam); + enum cf_en bcf = rrd_cf_conv(b->rra->cf_nam); - enum cf_en tcf = cf_conv(target->rra->cf_nam); + enum cf_en tcf = rrd_cf_conv(target->rra->cf_nam); int astep = a->rrd->stat_head->pdp_step; int bstep = b->rrd->stat_head->pdp_step; @@ -1809,9 +1809,9 @@ static int order_candidates(candidate_t *a, candidate_t *b, const candidate_t UN /* select AVERAGE and same CF RRAs. */ static int select_create_candidates(const rra_def_t *tofill, const rra_def_t *maybe) { - enum cf_en cf = cf_conv(maybe->cf_nam); + enum cf_en cf = rrd_cf_conv(maybe->cf_nam); if (cf == CF_AVERAGE) return 1; - if (cf == cf_conv(tofill->cf_nam)) return 1; + if (cf == rrd_cf_conv(tofill->cf_nam)) return 1; return 0; } @@ -2034,7 +2034,7 @@ static void prefill_cdp_prep(candidate_t *target, (target->cdp + target->extra.l)->scratch[CDP_unkn_pdp_cnt].u_cnt = 0; - enum cf_en tcf = cf_conv(target->rra->cf_nam); + enum cf_en tcf = rrd_cf_conv(target->rra->cf_nam); time_t t; rra_def_t *cdp_rra = rrd->rra_def + cdp_rra_index; @@ -2211,7 +2211,7 @@ static long rra_for_cdp_prefilling(rrd_t *rrd, int *added) original_total_rows += rra->row_cnt; largest_pdp = max(largest_pdp, rra->pdp_cnt); - if (rra->pdp_cnt == 1 && cf_conv(rra->cf_nam) == CF_AVERAGE) { + if (rra->pdp_cnt == 1 && rrd_cf_conv(rra->cf_nam) == CF_AVERAGE) { if (average_1_pdp_rra == NULL) { average_1_pdp_rra = rra; found_rra_index = rra_index; @@ -2292,8 +2292,8 @@ static void remove_temporary_rra_for_cdp_prefilling(rrd_t *rrd, long added_index } static int cdp_match(const rra_def_t *tofill, const rra_def_t *maybe) { - enum cf_en mcf = cf_conv(maybe->cf_nam); - if (cf_conv(tofill->cf_nam) == mcf && + enum cf_en mcf = rrd_cf_conv(maybe->cf_nam); + if (rrd_cf_conv(tofill->cf_nam) == mcf && tofill->pdp_cnt == maybe->pdp_cnt) { return 1; } @@ -2331,7 +2331,7 @@ static int rrd_prefill_data(rrd_t *rrd, const GList *sources, mapping_t *mapping candidate_t target = { .rrd = rrd, .rra = rra_def, - .rra_cf = cf_conv(rra_def->cf_nam), + .rra_cf = rrd_cf_conv(rra_def->cf_nam), .rra_index = rra_index, .values = rrd->rrd_value + rrd->stat_head->ds_cnt * total_rows, .cdp = rrd->cdp_prep + rrd->stat_head->ds_cnt * rra_index, @@ -2395,7 +2395,7 @@ static int rrd_prefill_data(rrd_t *rrd, const GList *sources, mapping_t *mapping candidate_t target = { .rrd = rrd, .rra = rrd->rra_def + rra_index, - .rra_cf = cf_conv(rrd->rra_def[rra_index].cf_nam), + .rra_cf = rrd_cf_conv(rrd->rra_def[rra_index].cf_nam), .rra_index = rra_index, .values = rrd->rrd_value + rrd->stat_head->ds_cnt * total_rows, .cdp = rrd->cdp_prep + rrd->stat_head->ds_cnt * rra_index, diff --git a/src/rrd_dump.c b/src/rrd_dump.c index bc826421..3653f012 100644 --- a/src/rrd_dump.c +++ b/src/rrd_dump.c @@ -210,7 +210,7 @@ int rrd_dump_cb_r( /* support for RRA parameters */ CB_PUTS("\t\t\n"); - switch (cf_conv(rrd.rra_def[i].cf_nam)) { + switch (rrd_cf_conv(rrd.rra_def[i].cf_nam)) { case CF_HWPREDICT: case CF_MHWPREDICT: CB_FMTS("\t\t%0.10e\n", @@ -294,7 +294,7 @@ int rrd_dump_cb_r( CB_FMTS("\t\t\t%0.10e\n", value); } - switch (cf_conv(rrd.rra_def[i].cf_nam)) { + switch (rrd_cf_conv(rrd.rra_def[i].cf_nam)) { case CF_HWPREDICT: case CF_MHWPREDICT: value = rrd.cdp_prep[i * rrd.stat_head->ds_cnt + ii]. diff --git a/src/rrd_fetch.c b/src/rrd_fetch.c index 9466d615..1c3e7f5c 100644 --- a/src/rrd_fetch.c +++ b/src/rrd_fetch.c @@ -226,7 +226,7 @@ int rrd_fetch_r( { /* two dimensional array containing the data */ enum cf_en cf_idx; - if ((int) (cf_idx = cf_conv(cf)) == -1) { + if ((int) (cf_idx = rrd_cf_conv(cf)) == -1) { return -1; } @@ -342,7 +342,7 @@ int rrd_fetch_fn( /* find the rra which best matches the requirements */ for (i = 0; (unsigned) i < rrd.stat_head->rra_cnt; i++) { - enum cf_en rratype=cf_conv(rrd.rra_def[i].cf_nam); + enum cf_en rratype=rrd_cf_conv(rrd.rra_def[i].cf_nam); /* handle this RRA */ if ( /* if we found a direct match */ diff --git a/src/rrd_format.c b/src/rrd_format.c index 1a317433..32a051a2 100644 --- a/src/rrd_format.c +++ b/src/rrd_format.c @@ -27,7 +27,7 @@ enum dst_en dst_conv( } -enum cf_en cf_conv( +enum cf_en rrd_cf_conv( const char *string) { diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 2ec9462f..20f946fc 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -759,7 +759,7 @@ void apply_gridfit( /* reduce data reimplementation by Alex */ -int reduce_data( +int rrd_reduce_data( enum cf_en cf, /* which consolidation function ? */ unsigned long cur_step, /* step the data currently is in */ time_t *start, /* start, end and step as requested ... */ @@ -1033,7 +1033,7 @@ int data_fetch( im->gdes[i].step = max(im->gdes[i].step,im->step); if (ft_step < im->gdes[i].step) { - if (!reduce_data(im->gdes[i].cf_reduce_set ? im->gdes[i].cf_reduce : im->gdes[i].cf, + if (!rrd_reduce_data(im->gdes[i].cf_reduce_set ? im->gdes[i].cf_reduce : im->gdes[i].cf, ft_step, &im->gdes[i].start, &im->gdes[i].end, @@ -1072,7 +1072,7 @@ int data_fetch( /* find the greatest common divisor for all the numbers in the 0 terminated num array */ -long lcd( +long rrd_lcd( long *num) { long rest; @@ -1253,7 +1253,7 @@ int data_calc( /* Now find the resulting step. All steps in all * used RRAs have to be visited */ - im->gdes[gdi].step = lcd(steparray); + im->gdes[gdi].step = rrd_lcd(steparray); free(steparray); if ((im->gdes[gdi].data = (rrd_value_t*)malloc(((im->gdes[gdi].end - diff --git a/src/rrd_graph.h b/src/rrd_graph.h index a90a0ff6..77dd2236 100644 --- a/src/rrd_graph.h +++ b/src/rrd_graph.h @@ -216,7 +216,7 @@ typedef struct graph_desc_t { long ds; /* data source number */ char daemon[256]; enum cf_en cf; /* consolidation function */ - enum cf_en cf_reduce; /* consolidation function for reduce_data() */ + enum cf_en cf_reduce; /* consolidation function for rrd_reduce_data() */ int cf_reduce_set; /* is the cf_reduce option set */ struct gfx_color_t col, col2; /* graph color */ double gradheight; @@ -382,7 +382,7 @@ void expand_range( image_desc_t *); void apply_gridfit( image_desc_t *); -int reduce_data( +int rrd_reduce_data( enum cf_en, unsigned long, time_t *, @@ -392,7 +392,7 @@ int reduce_data( rrd_value_t **); int data_fetch( image_desc_t *); -long lcd( +long rrd_lcd( long *); int data_calc( image_desc_t *); diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index 3f5c832e..94b1b22d 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -506,7 +506,7 @@ static graph_desc_t* newGraphDescription(image_desc_t *const im,enum gf_en gf,pa if (bitscmp(PARSE_REDUCE)) { char *reduce=getKeyValueArgument("reduce",1,pa); if (reduce) { - gdp->cf_reduce=cf_conv(reduce); + gdp->cf_reduce=rrd_cf_conv(reduce); gdp->cf_reduce_set=1; dprintfparsed("got reduce: %s (%i)\n",reduce,gdp->cf_reduce); if (((int)gdp->cf_reduce)==-1) { rrd_set_error("bad reduce CF: %s",reduce); return NULL; } @@ -798,7 +798,7 @@ static graph_desc_t* newGraphDescription(image_desc_t *const im,enum gf_en gf,pa gdp->ds_nam[DS_NAM_SIZE - 1] = '\0'; } if (cf) { - gdp->cf=cf_conv(cf); + gdp->cf=rrd_cf_conv(cf); if (((int)gdp->cf)==-1) { rrd_set_error("bad CF: %s",cf); return NULL; } } else { if (bitscmp(PARSE_CF)) { gdp->cf = (enum cf_en) -1; }} @@ -1266,7 +1266,7 @@ static int parse_gprint(enum gf_en gf,parsedargs_t*pa,image_desc_t *const im) { if (((int)gdp->cf)==-1) { keyvalue_t* first=getFirstUnusedArgument(1,pa); if (first) { - gdp->cf=cf_conv(first->value); + gdp->cf=rrd_cf_conv(first->value); if (((int)gdp->cf)==-1) { rrd_set_error("bad CF for DEF/CDEF: %s",first->value); return 1; } } else { rrd_set_error("No positional CDEF"); return 1; } diff --git a/src/rrd_hw.c b/src/rrd_hw.c index 4d74c1e9..9ce351f8 100644 --- a/src/rrd_hw.c +++ b/src/rrd_hw.c @@ -91,7 +91,7 @@ void erase_violations( char *violations_array; /* check that rra_idx is a CF_FAILURES array */ - if (cf_conv(rrd->rra_def[rra_idx].cf_nam) != CF_FAILURES) { + if (rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam) != CF_FAILURES) { #ifdef DEBUG fprintf(stderr, "erase_violations called for non-FAILURES RRA: %s\n", rrd->rra_def[rra_idx].cf_nam); @@ -245,13 +245,13 @@ int apply_smoother( free(buffers); free(working_average); - if (cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_SEASONAL) { + if (rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_SEASONAL) { rrd_value_t ( *init_seasonality) ( rrd_value_t seasonal_coef, rrd_value_t intercept); - switch (cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) { + switch (rrd_cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) { case CF_HWPREDICT: init_seasonality = hw_additive_init_seasonality; break; @@ -350,7 +350,7 @@ void reset_aberrant_coefficients( /* loop over the RRAs */ for (rra_idx = 0; rra_idx < rrd->stat_head->rra_cnt; rra_idx++) { cdp_idx = rra_idx * (rrd->stat_head->ds_cnt) + ds_idx; - switch (cf_conv(rrd->rra_def[rra_idx].cf_nam)) { + switch (rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam)) { case CF_HWPREDICT: case CF_MHWPREDICT: init_hwpredict_cdp(&(rrd->cdp_prep[cdp_idx])); @@ -463,7 +463,7 @@ int update_aberrant_CF( return update_devpredict(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx); case CF_SEASONAL: - switch (cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) { + switch (rrd_cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) { case CF_HWPREDICT: return update_seasonal(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx, seasonal_coef, @@ -476,7 +476,7 @@ int update_aberrant_CF( return -1; } case CF_DEVSEASONAL: - switch (cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) { + switch (rrd_cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) { case CF_HWPREDICT: return update_devseasonal(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx, seasonal_coef, @@ -489,7 +489,7 @@ int update_aberrant_CF( return -1; } case CF_FAILURES: - switch (cf_conv + switch (rrd_cf_conv (rrd->rra_def[hw_dep_idx(rrd, hw_dep_idx(rrd, rra_idx))]. cf_nam)) { case CF_HWPREDICT: diff --git a/src/rrd_info.c b/src/rrd_info.c index e7682afa..dc04c5c6 100644 --- a/src/rrd_info.c +++ b/src/rrd_info.c @@ -256,7 +256,7 @@ rrd_info_t *rrd_info_r( info.u_str = rrd.rra_def[i].cf_nam; cd = rrd_info_push(cd, sprintf_alloc("rra[%d].cf", i), RD_I_STR, info); - current_cf = cf_conv(rrd.rra_def[i].cf_nam); + current_cf = rrd_cf_conv(rrd.rra_def[i].cf_nam); info.u_cnt = rrd.rra_def[i].row_cnt; cd = rrd_info_push(cd, sprintf_alloc("rra[%d].rows", i), RD_I_CNT, diff --git a/src/rrd_modify.c b/src/rrd_modify.c index 369d7a1f..aa34f86f 100644 --- a/src/rrd_modify.c +++ b/src/rrd_modify.c @@ -78,8 +78,8 @@ static int sort_candidates(const void *va, const void *vb) { } static int select_for_modify(const rra_def_t *tofill, const rra_def_t *maybe) { - enum cf_en cf = cf_conv(tofill->cf_nam); - enum cf_en other_cf = cf_conv(maybe->cf_nam); + enum cf_en cf = rrd_cf_conv(tofill->cf_nam); + enum cf_en other_cf = rrd_cf_conv(maybe->cf_nam); return (other_cf == cf || (other_cf == CF_AVERAGE /*&& other_rra->pdp_cnt == 1*/)); } @@ -121,7 +121,7 @@ candidate_t *find_candidate_rras(const rrd_t *rrd, const rra_def_t *rra, int *cn .rra_index = i, .values = rrd->rrd_value + rrd->stat_head->ds_cnt * total_rows, .rra = rrd->rra_def + i, - .rra_cf = cf_conv(rrd->rra_def[i].cf_nam), + .rra_cf = rrd_cf_conv(rrd->rra_def[i].cf_nam), .ptr = rrd->rra_ptr + i, .cdp = rrd->cdp_prep + rrd->stat_head->ds_cnt * i, .extra = extra @@ -417,7 +417,7 @@ static int populate_row(const rrd_t *in_rrd, if (in_rrd->stat_head->rra_cnt < 1) return 0; - enum cf_en cf = cf_conv(new_rra->cf_nam); + enum cf_en cf = rrd_cf_conv(new_rra->cf_nam); switch (cf) { case CF_AVERAGE: case CF_MINIMUM: @@ -706,7 +706,7 @@ static int stretch_rras(rrd_t *out, int stretch) { unsigned int rra_index, ds_index; for (rra_index = 0 ; rra_index < out->stat_head->rra_cnt ; rra_index++) { rra_def_t *rra = out->rra_def + rra_index; - enum cf_en cf = cf_conv(rra->cf_nam); + enum cf_en cf = rrd_cf_conv(rra->cf_nam); cdp_prep_t *cdp_prep_row = out->cdp_prep + rra_index * ds_cnt; for (ds_index = 0 ; ds_index < ds_cnt ; ds_index++) { @@ -1018,7 +1018,7 @@ static void prepare_CDPs(const rrd_t *in, rrd_t *out, rra_def_t *rra_def = out->rra_def + curr_rra; - enum cf_en cf = cf_conv(rra_def->cf_nam); + enum cf_en cf = rrd_cf_conv(rra_def->cf_nam); int candidates_cnt = 0; candidate_t *candidates = NULL; candidate_t *chosen_candidate = NULL; @@ -1033,7 +1033,7 @@ static void prepare_CDPs(const rrd_t *in, rrd_t *out, rra_def_t *cand_rra = c->rrd->rra_def + c->rra_index; // we only accept AVERAGE RRAs or RRAs with pdp_cnt == 1 - if (cand_rra->pdp_cnt == 1 || cf_conv(cand_rra->cf_nam) == CF_AVERAGE) { + if (cand_rra->pdp_cnt == 1 || rrd_cf_conv(cand_rra->cf_nam) == CF_AVERAGE) { chosen_candidate = c; break; } diff --git a/src/rrd_restore.c b/src/rrd_restore.c index ba9375a7..9c7f7cfd 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -813,7 +813,7 @@ static int parse_tag_rra_cf( if (status != 0) return status; - status = cf_conv(rra_def->cf_nam); + status = rrd_cf_conv(rra_def->cf_nam); if (status == -1) { rrd_set_error("parse_tag_rra_cf: Unknown consolidation function: %s", rra_def->cf_nam); diff --git a/src/rrd_tool.h b/src/rrd_tool.h index 0d9ca5d4..4f7dfb37 100644 --- a/src/rrd_tool.h +++ b/src/rrd_tool.h @@ -134,7 +134,7 @@ typedef int (*rrd_fetch_cb_t)( #define RRD_EXCL (1<<5) #define RRD_READVALUES (1<<6) - enum cf_en cf_conv( + enum cf_en rrd_cf_conv( const char *string); enum dst_en dst_conv( const char *string); diff --git a/src/rrd_tune.c b/src/rrd_tune.c index c82fe874..11a9ea21 100644 --- a/src/rrd_tune.c +++ b/src/rrd_tune.c @@ -451,7 +451,7 @@ static int set_hwarg( } /* does the appropriate RRA exist? */ for (i = 0; i < rrd->stat_head->rra_cnt; ++i) { - if (cf_conv(rrd->rra_def[i].cf_nam) == cf) { + if (rrd_cf_conv(rrd->rra_def[i].cf_nam) == cf) { rra_idx = i; break; } @@ -491,7 +491,7 @@ static int set_hwsmootharg( } /* does the appropriate RRA exist? */ for (i = 0; i < rrd->stat_head->rra_cnt; ++i) { - if (cf_conv(rrd->rra_def[i].cf_nam) == cf) { + if (rrd_cf_conv(rrd->rra_def[i].cf_nam) == cf) { rra_idx = i; break; } @@ -528,7 +528,7 @@ static int set_deltaarg( /* does the appropriate RRA exist? */ for (i = 0; i < rrd->stat_head->rra_cnt; ++i) { - if (cf_conv(rrd->rra_def[i].cf_nam) == CF_FAILURES) { + if (rrd_cf_conv(rrd->rra_def[i].cf_nam) == CF_FAILURES) { rra_idx = i; break; } @@ -561,7 +561,7 @@ static int set_windowarg( } /* does the appropriate RRA exist? */ for (i = 0; i < rrd->stat_head->rra_cnt; ++i) { - if (cf_conv(rrd->rra_def[i].cf_nam) == CF_FAILURES) { + if (rrd_cf_conv(rrd->rra_def[i].cf_nam) == CF_FAILURES) { rra_idx = i; break; } diff --git a/src/rrd_update.c b/src/rrd_update.c index c9614132..b36593ea 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -1772,7 +1772,7 @@ static int update_all_cdp_prep( rra_start = rra_begin; for (rra_idx = 0; rra_idx < rrd->stat_head->rra_cnt; rra_idx++) { - current_cf = cf_conv(rrd->rra_def[rra_idx].cf_nam); + current_cf = rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam); start_pdp_offset = rrd->rra_def[rra_idx].pdp_cnt - proc_pdp_cnt % rrd->rra_def[rra_idx].pdp_cnt; @@ -2207,7 +2207,7 @@ static int update_aberrant_cdps( rra_start = rra_begin; for (rra_idx = 0; rra_idx < rrd->stat_head->rra_cnt; rra_idx++) { if (rrd->rra_def[rra_idx].pdp_cnt == 1) { - current_cf = cf_conv(rrd->rra_def[rra_idx].cf_nam); + current_cf = rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam); if (current_cf == CF_SEASONAL || current_cf == CF_DEVSEASONAL) { if (scratch_idx == CDP_primary_val) { lookup_seasonal(rrd, rra_idx, rra_start, rrd_file, @@ -2382,8 +2382,8 @@ static int smooth_all_rras( unsigned long rra_idx; for (rra_idx = 0; rra_idx < rrd->stat_head->rra_cnt; ++rra_idx) { - if (cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_DEVSEASONAL || - cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_SEASONAL) { + if (rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_DEVSEASONAL || + rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_SEASONAL) { #ifdef DEBUG fprintf(stderr, "Running smoother for rra %lu\n", rra_idx); #endif diff --git a/src/rrd_xport.c b/src/rrd_xport.c index 0bd1f71b..c63a9cc4 100644 --- a/src/rrd_xport.c +++ b/src/rrd_xport.c @@ -317,7 +317,7 @@ static int rrd_xport_fn( } *step_list_ptr=0; /* find a common step */ - *step = lcd(step_list); + *step = rrd_lcd(step_list); /* printf("step: %lu\n",*step); */ free(step_list); -- 2.47.2