expireover: could not open OV database

Katsuhiro Kondou kondou at nec.co.jp
Mon Mar 19 03:24:24 UTC 2001


In article <20010318172348.A96142 at shell.cifnet.com>,
	Basil Kruglov <basil at cifnet.com> wrote;

} What should be used to clean-up overview buffs in the future?

Try attached which slightly modifies reset-cnfs.c.
-- 
Katsuhiro Kondou

--- reset-cnfs.c	Tue Jan 19 12:16:19 1999
+++ cleanbuff.c	Tue Sep 12 00:22:15 2000
@@ -7,15 +7,17 @@
 
 #include <stdio.h>
 
+#define BLOCKSIZE	8192
+
 int main(int argc, char *argv[])
 {
     int fd;
     int i, j;
-    char buf[512];
+    char buf[BLOCKSIZE];
     struct stat st;
     int numwr;
 
-    bzero(buf, sizeof(buf));
+    memset(buf, '\0', sizeof(buf));
     for (i = 1; i < argc; i++) {
 	if ((fd = open(argv[i], O_RDWR, 0664)) < 0)
 	    fprintf(stderr, "Could not open file %s: %s\n", argv[i], strerror(errno));
@@ -23,11 +25,12 @@
 	    if (fstat(fd, &st) < 0) {
 		fprintf(stderr, "Could not stat file %s: %s\n", argv[i], strerror(errno));
 	    } else {
-		/* each bit in the bitfield is 512 bytes of data.  Each byte
-		 * has 8 bits, so calculate as 512 * 8 bytes of data, plus
-		 * fuzz. buf has 512 bytes in it, therefore containing data for
-		 * (512 * 8) * 512 bytes of data. */
-		numwr = (st.st_size / (512*8) / sizeof(buf)) + 50;
+		/* each bit in the bitfield is BLOCKSIZE bytes of data.  Each
+		   byte has 8 bits, so calculate as BLOCKSIZE * 8 bytes of data,
+		   plus fuzz. buf has BLOCKSIZE bytes in it, therefore
+		   containing data for (BLOCKSIZE * 8) * BLOCKSIZE bytes of
+		   data. */
+		numwr = (st.st_size / (BLOCKSIZE*8) / sizeof(buf)) + 50;
 		printf("File %s: %u %u\n", argv[i], st.st_size, numwr);
 		for (j = 0; j < numwr; j++) {
 		    if (!(j % 100))


More information about the inn-workers mailing list