legacy counters code removed

This commit is contained in:
z3APA3A committed 2014-04-14 02:14:34 +04:00
1 parent 5543b3052d
commit f4c6c9d962
16 files changed
+3 -483

No files matched your search

-30
View File
@@ -45,12 +45,7 @@ struct counter_header {
} cheader = {"3CF", (time_t)0};
struct counter_record {
#ifndef NOPSTDINT
uint64_t traf64;
#else
unsigned long traf;
unsigned long trafgb;
#endif
time_t cleared;
time_t updated;
} crecord;
@@ -469,11 +464,7 @@ void dumpcounters(struct trafcount *tlin, int counterd){
if(cfp){
for(tl = tlin; cfp && tl; tl = tl->next){
if(tl->type >= conf.countertype)
#ifndef NOPSTDINT
fprintf(cfp, "%05d %020"PRINTF_INT64_MODIFIER"u%s%s\n", tl->number, tl->traf64, tl->comment?" #" : "", tl->comment? tl->comment : "");
#else
fprintf(cfp, "%05d %010lu %010lu%s%s\n", tl->number, tl->trafgb, tl->traf, tl->comment?" #" : "", tl->comment? tl->comment : "");
#endif
}
fclose(cfp);
}
@@ -488,24 +479,14 @@ void dumpcounters(struct trafcount *tlin, int counterd){
lseek(counterd,
sizeof(struct counter_header) + (tl->number - 1) * sizeof(struct counter_record),
SEEK_SET);
#ifndef NOPSTDINT
crecord.traf64 = tl->traf64;
#else
crecord.traf = tl->traf;
crecord.trafgb = tl->trafgb;
#endif
crecord.cleared = tl->cleared;
crecord.updated = tl->updated;
write(counterd, &crecord, sizeof(struct counter_record));
}
if(tl->type!=NEVER && timechanged(tl->cleared, conf.time, tl->type)){
tl->cleared = conf.time;
#ifndef NOPSTDINT
tl->traf64 = 0;
#else
tl->traf = 0;
tl->trafgb = 0;
#endif
}
}
}
@@ -1551,14 +1532,8 @@ static int h_ace(int argc, unsigned char **argv){
sscanf((char *)argv[1], "%u", &tl->number);
sscanf((char *)argv[3], "%lu", &lim);
tl->type = getrotate(*argv[2]);
#ifndef NOPSTDINT
tl->traflim64 = ((uint64_t)lim)*(1024*1024);
if(!tl->traflim64) {
#else
tl->traflimgb = (lim/(1024*4));
tl->traflim = ((lim - (tl->traflimgb*(1024*4)))*(1024*1024));
if(!tl->traflim && !tl->traflimgb) {
#endif
fprintf(stderr, "Wrong traffic limit specified, line %d\n", linenum);
return(6);
}
@@ -1568,12 +1543,7 @@ static int h_ace(int argc, unsigned char **argv){
SEEK_SET);
memset(&crecord, 0, sizeof(struct counter_record));
read(conf.counterd, &crecord, sizeof(struct counter_record));
#ifndef NOPSTDINT
tl->traf64 = crecord.traf64;
#else
tl->traf = crecord.traf;
tl->trafgb = crecord.trafgb;
#endif
tl->cleared = crecord.cleared;
tl->updated = crecord.updated;
#ifdef _MAX__TIME64_T