From: cecilihf Date: Fri, 20 Jul 2007 09:06:42 +0000 (+0000) Subject: Move all use of the stevedore list to stevedore.c X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=901c0363a66e0d1ff400181d8dadcddfb8a4ebfd;p=varnish Move all use of the stevedore list to stevedore.c git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1730 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 4c085c74..8f180007 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -216,13 +216,6 @@ struct storage { #include "stevedore.h" -/* - * XXX: in the longer term, we want to support multiple stevedores, - * XXX: selected by some kind of heuristics based on size, lifetime - * XXX: etc etc. For now we support only one. - */ -extern struct stevedore_head *stevedore_h; - /* -------------------------------------------------------------------*/ struct object { diff --git a/varnish-cache/bin/varnishd/cache_main.c b/varnish-cache/bin/varnishd/cache_main.c index 24a185a1..4f47b8e1 100644 --- a/varnish-cache/bin/varnishd/cache_main.c +++ b/varnish-cache/bin/varnishd/cache_main.c @@ -38,7 +38,6 @@ #include "shmlog.h" #include "cache.h" -struct stevedore_head *stevedore_h; /*-------------------------------------------------------------------- * XXX: Think more about which order we start things @@ -47,8 +46,6 @@ struct stevedore_head *stevedore_h; void child_main(void) { - struct stevedore *st; - setbuf(stdout, NULL); setbuf(stderr, NULL); printf("Child starts\n"); @@ -67,12 +64,8 @@ child_main(void) HSH_Init(); BAN_Init(); - stevedore_h = &heritage.stevedore_h; - TAILQ_FOREACH(st, stevedore_h, stevedore_list) { - if (st->open != NULL) - st->open(st); - } - + STV_open(); + printf("Ready\n"); VSL_stats->start_time = (time_t)TIM_real(); diff --git a/varnish-cache/bin/varnishd/stevedore.c b/varnish-cache/bin/varnishd/stevedore.c index 1ef53f42..79878764 100644 --- a/varnish-cache/bin/varnishd/stevedore.c +++ b/varnish-cache/bin/varnishd/stevedore.c @@ -44,6 +44,7 @@ STV_alloc(size_t size) { struct storage *st; struct stevedore *stv, *stv_first; + struct stevedore_head *stevedore_h = &heritage.stevedore_h; /* Simple round robin selecting of a stevedore. */ @@ -101,7 +102,6 @@ cmp_storage(struct stevedore *s, const char *p, const char *q) return (0); } - void STV_add(const char *spec) { @@ -131,3 +131,16 @@ STV_add(const char *spec) if (stp->init != NULL) stp->init(stp, q); } + +void +STV_open(void) +{ + struct stevedore_head *stevedore_h; + struct stevedore *st; + + stevedore_h = &heritage.stevedore_h; + TAILQ_FOREACH(st, stevedore_h, stevedore_list) { + if (st->open != NULL) + st->open(st); + } +} diff --git a/varnish-cache/bin/varnishd/stevedore.h b/varnish-cache/bin/varnishd/stevedore.h index 10b7f17a..119036a4 100644 --- a/varnish-cache/bin/varnishd/stevedore.h +++ b/varnish-cache/bin/varnishd/stevedore.h @@ -59,3 +59,4 @@ struct storage *STV_alloc(size_t size); void STV_trim(struct storage *st, size_t size); void STV_free(struct storage *st); void STV_add(const char *spec); +void STV_open(void);