From: petter Date: Tue, 22 Jul 2008 09:42:06 +0000 (+0000) Subject: Added granularity as a subargument to the options for file storage: X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cee4b4f30b1b5213556e96d462faea3a82cf613e;p=varnish Added granularity as a subargument to the options for file storage: -s file,,, Fixes #244 git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2988 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/storage_file.c b/varnish-cache/bin/varnishd/storage_file.c index 889f65f5..acadb8cc 100644 --- a/varnish-cache/bin/varnishd/storage_file.c +++ b/varnish-cache/bin/varnishd/storage_file.c @@ -244,18 +244,26 @@ smf_init(struct stevedore *parent, int ac, char * const *av) struct stat st; struct smf_sc *sc; unsigned u; + uintmax_t page_size; AZ(av[ac]); fn = default_filename; size = default_size; + page_size = getpagesize(); - if (ac > 2) + if (ac > 3) ARGV_ERR("(-sfile) too many arguments\n"); if (ac > 0 && *av[0] != '\0') fn = av[0]; if (ac > 1 && *av[1] != '\0') size = av[1]; + if (ac > 2 && *av[2] != '\0') { + + q = str2bytes(av[2], &page_size, 0); + if (q != NULL) + ARGV_ERR("(-sfile) granularity \"%s\": %s\n", av[2], q); + } AN(fn); AN(size); @@ -266,7 +274,7 @@ smf_init(struct stevedore *parent, int ac, char * const *av) for (u = 0; u < NBUCKET; u++) VTAILQ_INIT(&sc->free[u]); VTAILQ_INIT(&sc->used); - sc->pagesize = getpagesize(); + sc->pagesize = page_size; parent->priv = sc; diff --git a/varnish-cache/bin/varnishd/varnishd.c b/varnish-cache/bin/varnishd/varnishd.c index 8bcb35cc..bb23d99d 100644 --- a/varnish-cache/bin/varnishd/varnishd.c +++ b/varnish-cache/bin/varnishd/varnishd.c @@ -204,6 +204,7 @@ usage(void) fprintf(stderr, FMT, "", " -s file [default: use /tmp]"); fprintf(stderr, FMT, "", " -s file,"); fprintf(stderr, FMT, "", " -s file,,"); + fprintf(stderr, FMT, "", " -s file,,,"); fprintf(stderr, FMT, "-t", "Default TTL"); fprintf(stderr, FMT, "-T address:port", "Telnet listen address and port");