#include "rrd_client.h"
#include "rrd_restore.h" /* write_file */
#include "rrd_create.h" /* parseDS */
+#include "fnv.h"
#include <locale.h>
// prototypes
static int write_rrd(const char *outfilename, rrd_t *out);
-static int add_rras(rrd_t *out, rra_mod_op_t *rra_mod_ops, int rra_mod_ops_cnt);
+static int add_rras(rrd_t *out, rra_mod_op_t *rra_mod_ops, int rra_mod_ops_cnt, unsigned long hash);
/* a convenience realloc/memcpy combo */
static void * copy_over_realloc(void *dest, int dest_index,
out_rra++;
}
- rc = add_rras(&out, rra_mod_ops, rra_mod_ops_cnt);
+ unsigned long hashed_name = FnvHash(outfilename);
+
+ rc = add_rras(&out, rra_mod_ops, rra_mod_ops_cnt, hashed_name);
if (rc != 0) goto done;
return rc;
}
-static int add_rras(rrd_t *out, rra_mod_op_t *rra_mod_ops, int rra_mod_ops_cnt)
+static int add_rras(rrd_t *out, rra_mod_op_t *rra_mod_ops, int rra_mod_ops_cnt, unsigned long hash)
{
int rc = -1;
rra_def_t rra_def;
// the hash doesn't really matter...
- parseRRA(rra_mod_ops[r].def, &rra_def, out, 0x123123823123);
+ parseRRA(rra_mod_ops[r].def, &rra_def, out, hash);
if (rrd_test_error()) {
// failed!!!