r2101 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Oct 16 11:11:46 CEST 2007


Author: phk
Date: 2007-10-16 11:11:45 +0200 (Tue, 16 Oct 2007)
New Revision: 2101

Modified:
   trunk/varnish-cache/bin/varnishd/storage_file.c
Log:
Flexelint polishing.
Always enforce the 2GB filesize limit on 32bit architectures.
Clean up a couple of messages


Modified: trunk/varnish-cache/bin/varnishd/storage_file.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_file.c	2007-10-16 09:03:18 UTC (rev 2100)
+++ trunk/varnish-cache/bin/varnishd/storage_file.c	2007-10-16 09:11:45 UTC (rev 2101)
@@ -122,7 +122,7 @@
 	uintmax_t l, fssize;
 	unsigned bs;
 	char suff[2];
-	int i, explicit;
+	int i;
 	off_t o;
 	struct stat st;
 
@@ -142,7 +142,6 @@
 
 	i = sscanf(size, "%ju%1s", &l, suff); /* can return -1, 0, 1 or 2 */
 
-	explicit = i;
 	if (i == 0) {
 		fprintf(stderr,
 		    "Error: (-sfile) size \"%s\" not understood\n", size);
@@ -217,18 +216,17 @@
 		exit (2);
 	}
 
-	if (explicit < 3 && sizeof(void *) == 4 && l > INT32_MAX) {
+	if (sizeof(void *) == 4 && l > INT32_MAX) { /*lint !e506 !e774 */
 		fprintf(stderr,
-		    "NB: Limiting size to 2GB on 32 bit architecture to"
-		    " prevent running out of\naddress space."
-		    "  Specifiy explicit size to override.\n"
+		    "NB: Storage size limited to 2GB on 32 bit architecture,\n"
+		    "NB: otherwise we could run out of address space.\n"
 		);
 		l = INT32_MAX;
 		l -= (l % bs);
 	}
 
-	printf("file %s size %ju bytes (%ju fs-blocks, %ju pages)\n",
-	    sc->filename, l, l / fsst.f_bsize, l / sc->pagesize);
+	printf("storage_file: filename: %s size %ju MegaBytes.\n",
+	    sc->filename, l / (1024 * 1024));
 
 	sc->filesize = l;
 }
@@ -644,6 +642,7 @@
 	VSL_stats->sm_balloc += smf->size;
 	VSL_stats->sm_bfree -= smf->size;
 	UNLOCK(&sc->mtx);
+	CHECK_OBJ_NOTNULL(&smf->s, STORAGE_MAGIC);	/*lint !e774 */
 	XXXAN(smf);
 	assert(smf->size == size);
 	smf->s.space = size;
@@ -653,7 +652,6 @@
 	smf->s.stevedore = st;
 	smf->s.fd = smf->sc->fd;
 	smf->s.where = smf->offset;
-	CHECK_OBJ_NOTNULL(&smf->s, STORAGE_MAGIC);
 	return (&smf->s);
 }
 




More information about the varnish-commit mailing list