INN commit: branches/2.6 (7 files)

INN Commit rra at isc.org
Fri Jan 15 22:34:56 UTC 2021


    Date: Friday, January 15, 2021 @ 14:34:56
  Author: iulius
Revision: 10513

inndf:  report buffindexed usage with 2 decimals

Output was truncated at the inferior number (e.g. 37.00%).

Modified:
  branches/2.6/expire/makehistory.c
  branches/2.6/innd/art.c
  branches/2.6/storage/buffindexed/buffindexed.c
  branches/2.6/storage/ovdb/ovdb.c
  branches/2.6/storage/overview.c
  branches/2.6/storage/tradindexed/tradindexed.c
  branches/2.6/tests/util/inndf.t

-----------------------------------+
 expire/makehistory.c              |    8 +++++---
 innd/art.c                        |    3 ++-
 storage/buffindexed/buffindexed.c |    5 +++--
 storage/ovdb/ovdb.c               |    5 +++--
 storage/overview.c                |    4 ++--
 storage/tradindexed/tradindexed.c |    5 +++--
 tests/util/inndf.t                |    2 +-
 7 files changed, 19 insertions(+), 13 deletions(-)

Modified: expire/makehistory.c
===================================================================
--- expire/makehistory.c	2021-01-15 22:30:30 UTC (rev 10512)
+++ expire/makehistory.c	2021-01-15 22:34:56 UTC (rev 10513)
@@ -153,6 +153,7 @@
     char temp[SMBUF];
     char *SortedTmpPath;
     int i, pid, fd;
+    float f;
     TOKEN token;
     QIOSTATE *qp;
     int count;
@@ -278,7 +279,7 @@
 	}
 	token = TextToToken(q);
 	if (OVadd(token, r, strlen(r), arrived, expires) == OVADDFAILED) {
-	    if (OVctl(OVSPACE, (void *)&i) && i == OV_NOSPACE) {
+	    if (OVctl(OVSPACE, (void *)&f) && (int)(f+0.01f) == OV_NOSPACE) {
                 warn("no space left for overview");
 		OVclose();
 		Fork ? _exit(1) : exit(1);
@@ -314,7 +315,8 @@
 {
     char temp[SMBUF];
     const char *p, *q, *r;
-    int i, fd;
+    int fd;
+    float f;
 
     /* If WriteStdout is set, just print the overview information to standard
        output and return. */
@@ -336,7 +338,7 @@
                 sysdie("writing overview failed");
 	    fputc('\n', Overchan);
 	} else if (OVadd(*token, overdata, overlen, arrived, expires) == OVADDFAILED) {
-	    if (OVctl(OVSPACE, (void *)&i) && i == OV_NOSPACE) {
+	    if (OVctl(OVSPACE, (void *)&f) && (int)(f+0.01f) == OV_NOSPACE) {
                 warn("no space left for overview");
 		OVclose();
 		exit(1);

Modified: innd/art.c
===================================================================
--- innd/art.c	2021-01-15 22:30:30 UTC (rev 10512)
+++ innd/art.c	2021-01-15 22:34:56 UTC (rev 10513)
@@ -1938,6 +1938,7 @@
 {
   char		*p, **groups, ControlWord[SMBUF], **hops, *controlgroup;
   int		i, j, *isp, hopcount, oerrno, canpost;
+  float         f;
   size_t        n;
   NEWSGROUP	*ngp, **ngptr;
   NEWSGROUP     *ngpjunk;
@@ -2531,7 +2532,7 @@
     if (innconf->enableoverview && !innconf->useoverchan) {
       if ((result = OVadd(token, data->Overview.data, data->Overview.left,
 	data->Arrived, data->Expires)) == OVADDFAILED) {
-	if (OVctl(OVSPACE, (void *)&i) && i == OV_NOSPACE)
+	if (OVctl(OVSPACE, (void *)&f) && (int)(f+0.01f) == OV_NOSPACE)
 	  IOError("creating overview", ENOSPC);
 	else
 	  IOError("creating overview", 0);

Modified: storage/buffindexed/buffindexed.c
===================================================================
--- storage/buffindexed/buffindexed.c	2021-01-15 22:30:30 UTC (rev 10512)
+++ storage/buffindexed/buffindexed.c	2021-01-15 22:34:56 UTC (rev 10513)
@@ -2210,6 +2210,7 @@
 
 bool buffindexed_ctl(OVCTLTYPE type, void *val) {
   int			total, used, *i, j;
+  float                 *f;
   OVBUFF		*ovbuff = ovbufftab;
   OVSORTTYPE		*sorttype;
   bool			*boolval;
@@ -2224,8 +2225,8 @@
       used += ovbuff->usedblk;
       ovlock(ovbuff, INN_LOCK_UNLOCK);
     }
-    i = (int *)val;
-    *i = (used * 100) / total;
+    f = (float *)val;
+    *f = ((float)used / total) * 100;
     return true;
   case OVSORT:
     sorttype = (OVSORTTYPE *)val;

Modified: storage/ovdb/ovdb.c
===================================================================
--- storage/ovdb/ovdb.c	2021-01-15 22:30:30 UTC (rev 10512)
+++ storage/ovdb/ovdb.c	2021-01-15 22:34:56 UTC (rev 10513)
@@ -2987,13 +2987,14 @@
 bool ovdb_ctl(OVCTLTYPE type, void *val)
 {
     int *i;
+    float *f;
     OVSORTTYPE *sorttype;
     bool *boolval;
 
     switch (type) {
     case OVSPACE:
-        i = (int *)val;
-        *i = -1;
+        f = (float *)val;
+        *f = -1.0f;
         return true;
     case OVSORT:
         sorttype = (OVSORTTYPE *)val;

Modified: storage/overview.c
===================================================================
--- storage/overview.c	2021-01-15 22:30:30 UTC (rev 10512)
+++ storage/overview.c	2021-01-15 22:34:56 UTC (rev 10513)
@@ -409,10 +409,10 @@
 float
 overview_free_space(struct overview *overview)
 {
-    int space;
+    float space;
 
     if (overview->method->ctl(OVSPACE, &space))
         return space;
     else
-        return -1;
+        return -1.0f;
 }

Modified: storage/tradindexed/tradindexed.c
===================================================================
--- storage/tradindexed/tradindexed.c	2021-01-15 22:30:30 UTC (rev 10512)
+++ storage/tradindexed/tradindexed.c	2021-01-15 22:34:56 UTC (rev 10513)
@@ -372,6 +372,7 @@
 tradindexed_ctl(OVCTLTYPE type, void *val)
 {
     int *i;
+    float *f;
     bool *b;
     OVSORTTYPE *sort;
 
@@ -382,8 +383,8 @@
 
     switch (type) {
     case OVSPACE:
-        i = (int *) val;
-        *i = -1;
+        f = (float *) val;
+        *f = -1.0f;
         return true;
     case OVSORT:
         sort = (OVSORTTYPE *) val;

Modified: tests/util/inndf.t
===================================================================
--- tests/util/inndf.t	2021-01-15 22:30:30 UTC (rev 10512)
+++ tests/util/inndf.t	2021-01-15 22:34:56 UTC (rev 10513)
@@ -129,7 +129,7 @@
     printcount "not ok"
 fi
 out=`$inndf -o`
-if [ "$out" = "3.00% overview space used" ] ; then
+if [ "$out" = "3.17% overview space used" ] ; then
     printcount "ok"
 else
     echo "$out"



More information about the inn-committers mailing list