+
+/* FUNCTION PROTOTYPES */
+
+int rrd_update_r(
+ const char *filename,
+ const char *tmplt,
+ int argc,
+ const char **argv);
+int _rrd_update(
+ const char *filename,
+ const char *tmplt,
+ int argc,
+ const char **argv,
+ rrd_info_t *);
+
+static int allocate_data_structures(
+ rrd_t *rrd,
+ char ***updvals,
+ rrd_value_t **pdp_temp,
+ const char *tmplt,
+ long **tmpl_idx,
+ unsigned long *tmpl_cnt,
+ unsigned long **rra_step_cnt,
+ unsigned long **skip_update,
+ rrd_value_t **pdp_new);
+
+static int parse_template(
+ rrd_t *rrd,
+ const char *tmplt,
+ unsigned long *tmpl_cnt,
+ long *tmpl_idx);
+
+static int process_arg(
+ char *step_start,
+ rrd_t *rrd,
+ rrd_file_t *rrd_file,
+ unsigned long rra_begin,
+ time_t *current_time,
+ unsigned long *current_time_usec,
+ rrd_value_t *pdp_temp,
+ rrd_value_t *pdp_new,
+ unsigned long *rra_step_cnt,
+ char **updvals,
+ long *tmpl_idx,
+ unsigned long tmpl_cnt,
+ rrd_info_t ** pcdp_summary,
+ int version,
+ unsigned long *skip_update,
+ int *schedule_smooth);
+
+static int parse_ds(
+ rrd_t *rrd,
+ char **updvals,
+ long *tmpl_idx,
+ char *input,
+ unsigned long tmpl_cnt,
+ time_t *current_time,
+ unsigned long *current_time_usec,
+ int version);
+
+static int get_time_from_reading(
+ rrd_t *rrd,
+ char timesyntax,
+ char **updvals,
+ time_t *current_time,
+ unsigned long *current_time_usec,
+ int version);
+
+static int update_pdp_prep(
+ rrd_t *rrd,
+ char **updvals,
+ rrd_value_t *pdp_new,
+ double interval);
+
+static int calculate_elapsed_steps(
+ rrd_t *rrd,
+ unsigned long current_time,
+ unsigned long current_time_usec,
+ double interval,
+ double *pre_int,
+ double *post_int,
+ unsigned long *proc_pdp_cnt);
+
+static void simple_update(
+ rrd_t *rrd,
+ double interval,
+ rrd_value_t *pdp_new);
+
+static int process_all_pdp_st(
+ rrd_t *rrd,
+ double interval,
+ double pre_int,
+ double post_int,
+ unsigned long elapsed_pdp_st,
+ rrd_value_t *pdp_new,
+ rrd_value_t *pdp_temp);
+
+static int process_pdp_st(
+ rrd_t *rrd,
+ unsigned long ds_idx,
+ double interval,
+ double pre_int,
+ double post_int,
+ long diff_pdp_st,
+ rrd_value_t *pdp_new,
+ rrd_value_t *pdp_temp);
+
+static int update_all_cdp_prep(
+ rrd_t *rrd,
+ unsigned long *rra_step_cnt,
+ unsigned long rra_begin,
+ rrd_file_t *rrd_file,
+ unsigned long elapsed_pdp_st,
+ unsigned long proc_pdp_cnt,
+ rrd_value_t **last_seasonal_coef,
+ rrd_value_t **seasonal_coef,
+ rrd_value_t *pdp_temp,
+ unsigned long *skip_update,
+ int *schedule_smooth);
+
+static int do_schedule_smooth(
+ rrd_t *rrd,
+ unsigned long rra_idx,
+ unsigned long elapsed_pdp_st);
+
+static int update_cdp_prep(
+ rrd_t *rrd,
+ unsigned long elapsed_pdp_st,
+ unsigned long start_pdp_offset,
+ unsigned long *rra_step_cnt,
+ int rra_idx,
+ rrd_value_t *pdp_temp,
+ rrd_value_t *last_seasonal_coef,
+ rrd_value_t *seasonal_coef,
+ int current_cf);
+
+static void update_cdp(
+ unival *scratch,
+ int current_cf,
+ rrd_value_t pdp_temp_val,
+ unsigned long rra_step_cnt,
+ unsigned long elapsed_pdp_st,
+ unsigned long start_pdp_offset,
+ unsigned long pdp_cnt,
+ rrd_value_t xff,
+ int i,
+ int ii);
+
+static void initialize_cdp_val(
+ unival *scratch,
+ int current_cf,
+ rrd_value_t pdp_temp_val,
+ unsigned long start_pdp_offset,
+ unsigned long pdp_cnt);
+
+static void reset_cdp(
+ rrd_t *rrd,
+ unsigned long elapsed_pdp_st,
+ rrd_value_t *pdp_temp,
+ rrd_value_t *last_seasonal_coef,
+ rrd_value_t *seasonal_coef,
+ int rra_idx,
+ int ds_idx,
+ int cdp_idx,
+ enum cf_en current_cf);
+
+static rrd_value_t initialize_carry_over(
+ rrd_value_t pdp_temp_val,
+ int current_cf,
+ unsigned long elapsed_pdp_st,
+ unsigned long start_pdp_offset,
+ unsigned long pdp_cnt);
+
+static rrd_value_t calculate_cdp_val(
+ rrd_value_t cdp_val,
+ rrd_value_t pdp_temp_val,
+ unsigned long elapsed_pdp_st,
+ int current_cf,
+ int i,
+ int ii);
+
+static int update_aberrant_cdps(
+ rrd_t *rrd,
+ rrd_file_t *rrd_file,
+ unsigned long rra_begin,
+ unsigned long elapsed_pdp_st,
+ rrd_value_t *pdp_temp,
+ rrd_value_t **seasonal_coef);
+
+static int write_to_rras(
+ rrd_t *rrd,
+ rrd_file_t *rrd_file,
+ unsigned long *rra_step_cnt,
+ unsigned long rra_begin,
+ time_t current_time,
+ unsigned long *skip_update,
+ rrd_info_t ** pcdp_summary);
+
+static int write_RRA_row(
+ rrd_file_t *rrd_file,
+ rrd_t *rrd,
+ unsigned long rra_idx,
+ unsigned short CDP_scratch_idx,
+ rrd_info_t ** pcdp_summary,
+ time_t rra_time);
+
+static int smooth_all_rras(
+ rrd_t *rrd,
+ rrd_file_t *rrd_file,
+ unsigned long rra_begin);
+
+#ifndef HAVE_MMAP
+static int write_changes_to_disk(
+ rrd_t *rrd,
+ rrd_file_t *rrd_file,
+ int version);
+#endif
+