projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* progress in moving all the fileaccess over to a wrapper system that can do fd based...
[rrdtool.git]
/
src
/
rrd_dump.c
diff --git
a/src/rrd_dump.c
b/src/rrd_dump.c
index
c8cc7ee
..
5d76896
100644
(file)
--- a/
src/rrd_dump.c
+++ b/
src/rrd_dump.c
@@
-77,13
+77,14
@@
rrd_dump_r(const char *filename, char *outname)
time_t now;
char somestring[255];
rrd_value_t my_cdp;
time_t now;
char somestring[255];
rrd_value_t my_cdp;
-
long
rra_base, rra_start, rra_next;
-
FILE *in
_file;
+
off_t
rra_base, rra_start, rra_next;
+
rrd_file_t *rrd
_file;
FILE *out_file;
rrd_t rrd;
rrd_value_t value;
struct tm tm;
FILE *out_file;
rrd_t rrd;
rrd_value_t value;
struct tm tm;
- if(rrd_open(filename, &in_file,&rrd, RRD_READONLY)==-1){
+ rrd_file = rrd_open(filename, &rrd, RRD_READONLY);
+ if (rrd_file == NULL) {
rrd_free(&rrd);
return(-1);
}
rrd_free(&rrd);
return(-1);
}
@@
-151,7
+152,7
@@
rrd_dump_r(const char *filename, char *outname)
fputs("<!-- Round Robin Archives -->", out_file);
fputs("<!-- Round Robin Archives -->", out_file);
- rra_base
=ftell(in_file);
+ rra_base
= rrd_file->header_len;
rra_next = rra_base;
for(i=0;i<rrd.stat_head->rra_cnt;i++){
rra_next = rra_base;
for(i=0;i<rrd.stat_head->rra_cnt;i++){
@@
-314,7
+315,7
@@
rrd_dump_r(const char *filename, char *outname)
fprintf(out_file, "\t\t</cdp_prep>\n");
fprintf(out_file, "\t\t<database>\n");
fprintf(out_file, "\t\t</cdp_prep>\n");
fprintf(out_file, "\t\t<database>\n");
-
fseek(in
_file,(rra_start
+
rrd_seek(rrd
_file,(rra_start
+(rrd.rra_ptr[i].cur_row+1)
* rrd.stat_head->ds_cnt
* sizeof(rrd_value_t)),SEEK_SET);
+(rrd.rra_ptr[i].cur_row+1)
* rrd.stat_head->ds_cnt
* sizeof(rrd_value_t)),SEEK_SET);
@@
-323,7
+324,7
@@
rrd_dump_r(const char *filename, char *outname)
for(ix=0;ix<rrd.rra_def[i].row_cnt;ix++){
ii++;
if (ii>=rrd.rra_def[i].row_cnt) {
for(ix=0;ix<rrd.rra_def[i].row_cnt;ix++){
ii++;
if (ii>=rrd.rra_def[i].row_cnt) {
-
fseek(in
_file,rra_start,SEEK_SET);
+
rrd_seek(rrd
_file,rra_start,SEEK_SET);
ii=0; /* wrap if max row cnt is reached */
}
now = (rrd.live_head->last_up
ii=0; /* wrap if max row cnt is reached */
}
now = (rrd.live_head->last_up
@@
-339,8
+340,8
@@
rrd_dump_r(const char *filename, char *outname)
# error "Need strftime"
#endif
fprintf(out_file, "\t\t\t<!-- %s / %d --> <row>",somestring,(int)now);
# error "Need strftime"
#endif
fprintf(out_file, "\t\t\t<!-- %s / %d --> <row>",somestring,(int)now);
- for(iii=0;iii<rrd.stat_head->ds_cnt;iii++){
- fread(&my_cdp,sizeof(rrd_value_t),1,in_file);
+ for(iii=0;iii<rrd.stat_head->ds_cnt;iii++){
+ rrd_read(rrd_file, &my_cdp,sizeof(rrd_value_t)*1);
if (isnan(my_cdp)){
fprintf(out_file, "<v> NaN </v>");
} else {
if (isnan(my_cdp)){
fprintf(out_file, "<v> NaN </v>");
} else {
@@
-350,11
+351,11
@@
rrd_dump_r(const char *filename, char *outname)
fprintf(out_file, "</row>\n");
}
fprintf(out_file, "\t\t</database>\n\t</rra>\n");
fprintf(out_file, "</row>\n");
}
fprintf(out_file, "\t\t</database>\n\t</rra>\n");
-
+
}
fprintf(out_file, "</rrd>\n");
rrd_free(&rrd);
}
fprintf(out_file, "</rrd>\n");
rrd_free(&rrd);
-
fclose(in_file
);
+
close(rrd_file->fd
);
if (out_file != stdout)
{
fclose(out_file);
if (out_file != stdout)
{
fclose(out_file);
@@
-362,6
+363,3
@@
rrd_dump_r(const char *filename, char *outname)
return(0);
}
return(0);
}
-
-
-