Commit 54045785 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a stevedore call to complete initialization ("ready") which is called

as late as possible, before we start the child.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4812 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent e8e82456
...@@ -238,6 +238,18 @@ STV_add(const struct stevedore *stv2, int ac, char * const *av) ...@@ -238,6 +238,18 @@ STV_add(const struct stevedore *stv2, int ac, char * const *av)
stv_next = VTAILQ_FIRST(&stevedores); stv_next = VTAILQ_FIRST(&stevedores);
} }
void
STV_ready(void)
{
struct stevedore *stv;
ASSERT_MGT();
VTAILQ_FOREACH(stv, &stevedores, list) {
if (stv->ready != NULL)
stv->ready(stv);
}
}
void void
STV_open(void) STV_open(void)
{ {
......
...@@ -36,6 +36,7 @@ struct object; ...@@ -36,6 +36,7 @@ struct object;
struct objcore; struct objcore;
typedef void storage_init_f(struct stevedore *, int ac, char * const *av); typedef void storage_init_f(struct stevedore *, int ac, char * const *av);
typedef void storage_ready_f(struct stevedore *);
typedef void storage_open_f(const struct stevedore *); typedef void storage_open_f(const struct stevedore *);
typedef struct storage *storage_alloc_f(struct stevedore *, size_t size, typedef struct storage *storage_alloc_f(struct stevedore *, size_t size,
struct objcore *); struct objcore *);
...@@ -50,6 +51,7 @@ struct stevedore { ...@@ -50,6 +51,7 @@ struct stevedore {
#define STEVEDORE_MAGIC 0x4baf43db #define STEVEDORE_MAGIC 0x4baf43db
const char *name; const char *name;
storage_init_f *init; /* called by mgt process */ storage_init_f *init; /* called by mgt process */
storage_ready_f *ready; /* called by mgt process */
storage_open_f *open; /* called by cache process */ storage_open_f *open; /* called by cache process */
storage_alloc_f *alloc; storage_alloc_f *alloc;
storage_trim_f *trim; storage_trim_f *trim;
...@@ -71,6 +73,7 @@ struct storage *STV_alloc(struct sess *sp, size_t size, struct objcore *oc); ...@@ -71,6 +73,7 @@ struct storage *STV_alloc(struct sess *sp, size_t size, struct objcore *oc);
void STV_trim(struct storage *st, size_t size); void STV_trim(struct storage *st, size_t size);
void STV_free(struct storage *st); void STV_free(struct storage *st);
void STV_add(const struct stevedore *stv, int ac, char * const *av); void STV_add(const struct stevedore *stv, int ac, char * const *av);
void STV_ready(void);
void STV_open(void); void STV_open(void);
void STV_close(void); void STV_close(void);
struct lru *STV_lru(const struct storage *st); struct lru *STV_lru(const struct storage *st);
......
...@@ -719,6 +719,8 @@ main(int argc, char * const *argv) ...@@ -719,6 +719,8 @@ main(int argc, char * const *argv)
mgt_cli_telnet(tmpbuf); mgt_cli_telnet(tmpbuf);
} }
STV_ready(); /* Complete initialization */
MGT_Run(); MGT_Run();
if (pfh != NULL) if (pfh != NULL)
......
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