]> err.no Git - varnish/commitdiff
Move the catalogs of storage and hash modules closer to home.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 22 Feb 2009 16:36:37 +0000 (16:36 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 22 Feb 2009 16:36:37 +0000 (16:36 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3803 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_hash.c
varnish-cache/bin/varnishd/common.h
varnish-cache/bin/varnishd/hash_slinger.h
varnish-cache/bin/varnishd/mgt.h
varnish-cache/bin/varnishd/stevedore.c
varnish-cache/bin/varnishd/stevedore.h
varnish-cache/bin/varnishd/varnishd.c

index 2ac8f6672dcbace8ff1f265747544629d558a5e5..afd3e2b3934aa74f829f4ce5216d7ba3fc1525ea 100644 (file)
@@ -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 }
+};
index 8b00863a8b35a263db30ce9d2447d087b069870e..7c496ca3ced1594677ddb611493dacb3c5c068da 100644 (file)
@@ -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;
+};
index 602e3a302b6f51dfa581c731b88affc8951eae3d..e37297fc39fd1a7bb0fb9a6d53eefd415cd457f1 100644 (file)
@@ -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[];
index 1f601aaa40e1181ee4c36edd6856fd72d4a00153..245cc01fe371d02ae08a2c59b6fec89ea6d59138 100644 (file)
@@ -76,4 +76,3 @@ extern char *mgt_cc_cmd;
                fprintf(stderr, fmt "\n", __VA_ARGS__); \
                syslog(pri, fmt, __VA_ARGS__);          \
        } while (0)
-
index fa89cf1c370c6ac8dd8d3c37c4ac1d1c56704625..4cf46d0669768f9dccf0e95e59b3c467531adbdb 100644 (file)
@@ -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 }
+};
index 212c87960848a23fadd4d85221ef6e4b6077fe89..c1c192d33de5edb00223ab1b20b5ab154398cabb 100644 (file)
@@ -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[];
index 8d241147be4d1f42348309b0df733efb3a056f98..a0170611374c84c122e16ef4a69617542fd8e6bd 100644 (file)
@@ -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)
 {