r3803 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Sun Feb 22 17:36:37 CET 2009
Author: phk
Date: 2009-02-22 17:36:37 +0100 (Sun, 22 Feb 2009)
New Revision: 3803
Modified:
trunk/varnish-cache/bin/varnishd/cache_hash.c
trunk/varnish-cache/bin/varnishd/common.h
trunk/varnish-cache/bin/varnishd/hash_slinger.h
trunk/varnish-cache/bin/varnishd/mgt.h
trunk/varnish-cache/bin/varnishd/stevedore.c
trunk/varnish-cache/bin/varnishd/stevedore.h
trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Move the catalogs of storage and hash modules closer to home.
Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c 2009-02-20 19:06:07 UTC (rev 3802)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2009-02-22 16:36:37 UTC (rev 3803)
@@ -549,3 +549,11 @@
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 }
+};
Modified: trunk/varnish-cache/bin/varnishd/common.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/common.h 2009-02-20 19:06:07 UTC (rev 3802)
+++ trunk/varnish-cache/bin/varnishd/common.h 2009-02-22 16:36:37 UTC (rev 3803)
@@ -52,3 +52,9 @@
fprintf(stderr, "Error: " __VA_ARGS__); \
exit(2); \
} while (0);
+
+/* A tiny helper for choosing hash/storage modules */
+struct choice {
+ const char *name;
+ void *ptr;
+};
Modified: trunk/varnish-cache/bin/varnishd/hash_slinger.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_slinger.h 2009-02-20 19:06:07 UTC (rev 3802)
+++ trunk/varnish-cache/bin/varnishd/hash_slinger.h 2009-02-22 16:36:37 UTC (rev 3803)
@@ -103,3 +103,8 @@
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[];
Modified: trunk/varnish-cache/bin/varnishd/mgt.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt.h 2009-02-20 19:06:07 UTC (rev 3802)
+++ trunk/varnish-cache/bin/varnishd/mgt.h 2009-02-22 16:36:37 UTC (rev 3803)
@@ -76,4 +76,3 @@
fprintf(stderr, fmt "\n", __VA_ARGS__); \
syslog(pri, fmt, __VA_ARGS__); \
} while (0)
-
Modified: trunk/varnish-cache/bin/varnishd/stevedore.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.c 2009-02-20 19:06:07 UTC (rev 3802)
+++ trunk/varnish-cache/bin/varnishd/stevedore.c 2009-02-22 16:36:37 UTC (rev 3803)
@@ -124,3 +124,12 @@
stv->open(stv);
}
}
+
+const struct choice STV_choice[] = {
+ { "file", &smf_stevedore },
+ { "malloc", &sma_stevedore },
+#ifdef HAVE_LIBUMEM
+ { "umem", &smu_stevedore },
+#endif
+ { NULL, NULL }
+};
Modified: trunk/varnish-cache/bin/varnishd/stevedore.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.h 2009-02-20 19:06:07 UTC (rev 3802)
+++ trunk/varnish-cache/bin/varnishd/stevedore.h 2009-02-22 16:36:37 UTC (rev 3803)
@@ -68,3 +68,11 @@
/* 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[];
Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c 2009-02-20 19:06:07 UTC (rev 3802)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c 2009-02-22 16:36:37 UTC (rev 3803)
@@ -82,11 +82,6 @@
/*--------------------------------------------------------------------*/
-struct choice {
- const char *name;
- void *ptr;
-};
-
static void *
pick(const struct choice *cp, const char *which, const char *kind)
{
@@ -113,21 +108,7 @@
}
/*--------------------------------------------------------------------*/
-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 @@
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 @@
/*--------------------------------------------------------------------*/
-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)
{
More information about the varnish-commit
mailing list