Commit 92f1c6e5 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Flexelint polishing.

Always enforce the 2GB filesize limit on 32bit architectures.
Clean up a couple of messages


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2101 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 9156803c
...@@ -122,7 +122,7 @@ smf_calcsize(struct smf_sc *sc, const char *size, int newfile) ...@@ -122,7 +122,7 @@ smf_calcsize(struct smf_sc *sc, const char *size, int newfile)
uintmax_t l, fssize; uintmax_t l, fssize;
unsigned bs; unsigned bs;
char suff[2]; char suff[2];
int i, explicit; int i;
off_t o; off_t o;
struct stat st; struct stat st;
...@@ -142,7 +142,6 @@ smf_calcsize(struct smf_sc *sc, const char *size, int newfile) ...@@ -142,7 +142,6 @@ smf_calcsize(struct smf_sc *sc, const char *size, int newfile)
i = sscanf(size, "%ju%1s", &l, suff); /* can return -1, 0, 1 or 2 */ i = sscanf(size, "%ju%1s", &l, suff); /* can return -1, 0, 1 or 2 */
explicit = i;
if (i == 0) { if (i == 0) {
fprintf(stderr, fprintf(stderr,
"Error: (-sfile) size \"%s\" not understood\n", size); "Error: (-sfile) size \"%s\" not understood\n", size);
...@@ -217,18 +216,17 @@ smf_calcsize(struct smf_sc *sc, const char *size, int newfile) ...@@ -217,18 +216,17 @@ smf_calcsize(struct smf_sc *sc, const char *size, int newfile)
exit (2); exit (2);
} }
if (explicit < 3 && sizeof(void *) == 4 && l > INT32_MAX) { if (sizeof(void *) == 4 && l > INT32_MAX) { /*lint !e506 !e774 */
fprintf(stderr, fprintf(stderr,
"NB: Limiting size to 2GB on 32 bit architecture to" "NB: Storage size limited to 2GB on 32 bit architecture,\n"
" prevent running out of\naddress space." "NB: otherwise we could run out of address space.\n"
" Specifiy explicit size to override.\n"
); );
l = INT32_MAX; l = INT32_MAX;
l -= (l % bs); l -= (l % bs);
} }
printf("file %s size %ju bytes (%ju fs-blocks, %ju pages)\n", printf("storage_file: filename: %s size %ju MegaBytes.\n",
sc->filename, l, l / fsst.f_bsize, l / sc->pagesize); sc->filename, l / (1024 * 1024));
sc->filesize = l; sc->filesize = l;
} }
...@@ -644,6 +642,7 @@ smf_alloc(struct stevedore *st, size_t size) ...@@ -644,6 +642,7 @@ smf_alloc(struct stevedore *st, size_t size)
VSL_stats->sm_balloc += smf->size; VSL_stats->sm_balloc += smf->size;
VSL_stats->sm_bfree -= smf->size; VSL_stats->sm_bfree -= smf->size;
UNLOCK(&sc->mtx); UNLOCK(&sc->mtx);
CHECK_OBJ_NOTNULL(&smf->s, STORAGE_MAGIC); /*lint !e774 */
XXXAN(smf); XXXAN(smf);
assert(smf->size == size); assert(smf->size == size);
smf->s.space = size; smf->s.space = size;
...@@ -653,7 +652,6 @@ smf_alloc(struct stevedore *st, size_t size) ...@@ -653,7 +652,6 @@ smf_alloc(struct stevedore *st, size_t size)
smf->s.stevedore = st; smf->s.stevedore = st;
smf->s.fd = smf->sc->fd; smf->s.fd = smf->sc->fd;
smf->s.where = smf->offset; smf->s.where = smf->offset;
CHECK_OBJ_NOTNULL(&smf->s, STORAGE_MAGIC);
return (&smf->s); return (&smf->s);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment