projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
get rid of DASHED, only use dashes syntax. less redundancy -- thomas.gutzler gmail.com
[rrdtool.git]
/
src
/
rrd_restore.c
diff --git
a/src/rrd_restore.c
b/src/rrd_restore.c
index
368f7bc
..
d3a2c8a
100644
(file)
--- a/
src/rrd_restore.c
+++ b/
src/rrd_restore.c
@@
-1,5
+1,5
@@
/*****************************************************************************
/*****************************************************************************
- * RRDtool 1.2.
23
Copyright by Tobi Oetiker, 1997-2007
+ * RRDtool 1.2.
99907080300
Copyright by Tobi Oetiker, 1997-2007
*****************************************************************************
* rrd_restore.c creates new rrd from data dumped by rrd_dump.c
*****************************************************************************/
*****************************************************************************
* rrd_restore.c creates new rrd from data dumped by rrd_dump.c
*****************************************************************************/
@@
-223,14
+223,12
@@
int xml2rrd(
rrd->stat_head = NULL;
return -1;
}
rrd->stat_head = NULL;
return -1;
}
- /* make sure we output the right version */
- strcpy(rrd->stat_head->version, RRD_VERSION);
-
- /* if (atoi(rrd -> stat_head -> version) < 2)
- {
- rrd_set_error("Can only restore version >= 2 (Not %s). Dump your old rrd using a current rrdtool dump.", rrd -> stat_head -> version );
- return -1;
- } */
+ /* make sure we output the right version only go over 3 if input is over 3 too */
+ if (input_version > 3) {
+ strcpy(rrd->stat_head->version, RRD_VERSION);
+ } else {
+ strcpy(rrd->stat_head->version, RRD_VERSION3);
+ }
rrd->stat_head->float_cookie = FLOAT_COOKIE;
rrd->stat_head->ds_cnt = 0;
rrd->stat_head->float_cookie = FLOAT_COOKIE;
rrd->stat_head->ds_cnt = 0;
@@
-366,6
+364,7
@@
int xml2rrd(
} else {
switch (cf_conv(rrd->rra_def[rra_index].cf_nam)) {
case CF_HWPREDICT:
} else {
switch (cf_conv(rrd->rra_def[rra_index].cf_nam)) {
case CF_HWPREDICT:
+ case CF_MHWPREDICT:
read_tag(&ptr2, "hw_alpha", "%lf",
&(rrd->rra_def[rra_index].par[RRA_hw_alpha].
u_val));
read_tag(&ptr2, "hw_alpha", "%lf",
&(rrd->rra_def[rra_index].par[RRA_hw_alpha].
u_val));
@@
-384,6
+383,11
@@
int xml2rrd(
read_tag(&ptr2, "seasonal_smooth_idx", "%lu",
&(rrd->rra_def[rra_index].
par[RRA_seasonal_smooth_idx].u_cnt));
read_tag(&ptr2, "seasonal_smooth_idx", "%lu",
&(rrd->rra_def[rra_index].
par[RRA_seasonal_smooth_idx].u_cnt));
+ if (atoi(rrd->stat_head->version) >= 4) {
+ read_tag(&ptr2, "smoothing_window", "%lf",
+ &(rrd->rra_def[rra_index].
+ par[RRA_seasonal_smoothing_window].u_val));
+ }
read_tag(&ptr2, "dependent_rra_idx", "%lu",
&(rrd->rra_def[rra_index].
par[RRA_dependent_rra_idx].u_cnt));
read_tag(&ptr2, "dependent_rra_idx", "%lu",
&(rrd->rra_def[rra_index].
par[RRA_dependent_rra_idx].u_cnt));
@@
-456,6
+460,7
@@
int xml2rrd(
i].scratch[CDP_secondary_val].u_val));
switch (cf_conv(rrd->rra_def[rra_index].cf_nam)) {
case CF_HWPREDICT:
i].scratch[CDP_secondary_val].u_val));
switch (cf_conv(rrd->rra_def[rra_index].cf_nam)) {
case CF_HWPREDICT:
+ case CF_MHWPREDICT:
read_tag(&ptr2, "intercept", "%lf",
&(rrd->
cdp_prep[rrd->stat_head->ds_cnt *
read_tag(&ptr2, "intercept", "%lf",
&(rrd->
cdp_prep[rrd->stat_head->ds_cnt *
@@
-706,20
+711,19
@@
int rrd_restore(
char *buf;
char rc = 0;
char force_overwrite = 0;
char *buf;
char rc = 0;
char force_overwrite = 0;
+ struct option long_options[] = {
+ {"range-check", no_argument, 0, 'r'},
+ {"force-overwrite", no_argument, 0, 'f'},
+ {0, 0, 0, 0}
+ };
/* init rrd clean */
optind = 0;
opterr = 0; /* initialize getopt */
while (1) {
/* init rrd clean */
optind = 0;
opterr = 0; /* initialize getopt */
while (1) {
- static struct option long_options[] = {
- {"range-check", no_argument, 0, 'r'},
- {"force-overwrite", no_argument, 0, 'f'},
- {0, 0, 0, 0}
- };
int option_index = 0;
int opt;
int option_index = 0;
int opt;
-
opt = getopt_long(argc, argv, "rf", long_options, &option_index);
if (opt == EOF)
opt = getopt_long(argc, argv, "rf", long_options, &option_index);
if (opt == EOF)