Commit 016e9ef3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move the catalogs of storage and hash modules closer to home.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3803 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 90567447
......@@ -549,3 +549,11 @@ HSH_Init(void)
if (hash->start != NULL)
hash->start();
}
const struct choice hsh_choice[] = {
{ "classic", &hcl_slinger },
{ "simple", &hsl_slinger },
{ "simple_list", &hsl_slinger }, /* backwards compat */
{ "critbit", &hcb_slinger },
{ NULL, NULL }
};
......@@ -52,3 +52,9 @@ void mgt_child_inherit(int fd, const char *what);
fprintf(stderr, "Error: " __VA_ARGS__); \
exit(2); \
} while (0);
/* A tiny helper for choosing hash/storage modules */
struct choice {
const char *name;
void *ptr;
};
......@@ -103,3 +103,8 @@ extern unsigned save_hash;
void HSH_DeleteObjHead(const struct worker *w, struct objhead *oh);
void HSH_Deref(const struct worker *w, struct object **o);
#endif /* VARNISH_CACHE_CHILD */
extern struct hash_slinger hsl_slinger;
extern struct hash_slinger hcl_slinger;
extern struct hash_slinger hcb_slinger;
extern const struct choice hsh_choice[];
......@@ -76,4 +76,3 @@ extern char *mgt_cc_cmd;
fprintf(stderr, fmt "\n", __VA_ARGS__); \
syslog(pri, fmt, __VA_ARGS__); \
} while (0)
......@@ -124,3 +124,12 @@ STV_open(void)
stv->open(stv);
}
}
const struct choice STV_choice[] = {
{ "file", &smf_stevedore },
{ "malloc", &sma_stevedore },
#ifdef HAVE_LIBUMEM
{ "umem", &smu_stevedore },
#endif
{ NULL, NULL }
};
......@@ -68,3 +68,11 @@ uintmax_t STV_FileSize(int fd, const char *size, unsigned *granularity, const ch
/* Synthetic Storage */
void SMS_Init(void);
extern struct stevedore sma_stevedore;
extern struct stevedore smf_stevedore;
#ifdef HAVE_LIBUMEM
extern struct stevedore smu_stevedore;
#endif
extern const struct choice STV_choice[];
......@@ -82,11 +82,6 @@ unsigned d_flag = 0;
/*--------------------------------------------------------------------*/
struct choice {
const char *name;
void *ptr;
};
static void *
pick(const struct choice *cp, const char *which, const char *kind)
{
......@@ -113,20 +108,6 @@ arg_ul(const char *p)
}
/*--------------------------------------------------------------------*/
extern struct stevedore sma_stevedore;
extern struct stevedore smf_stevedore;
#ifdef HAVE_LIBUMEM
extern struct stevedore smu_stevedore;
#endif
static const struct choice stv_choice[] = {
{ "file", &smf_stevedore },
{ "malloc", &sma_stevedore },
#ifdef HAVE_LIBUMEM
{ "umem", &smu_stevedore },
#endif
{ NULL, NULL }
};
static void
setup_storage(const char *spec)
......@@ -147,7 +128,7 @@ setup_storage(const char *spec)
for (ac = 0; av[ac + 2] != NULL; ac++)
continue;
priv = pick(stv_choice, av[1], "storage");
priv = pick(STV_choice, av[1], "storage");
AN(priv);
STV_add(priv, ac, av + 2);
......@@ -157,18 +138,6 @@ setup_storage(const char *spec)
/*--------------------------------------------------------------------*/
extern struct hash_slinger hsl_slinger;
extern struct hash_slinger hcl_slinger;
extern struct hash_slinger hcb_slinger;
static const struct choice hsh_choice[] = {
{ "classic", &hcl_slinger },
{ "simple", &hsl_slinger },
{ "simple_list", &hsl_slinger }, /* backwards compat */
{ "critbit", &hcb_slinger },
{ NULL, NULL }
};
static void
setup_hash(const char *h_arg)
{
......
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