r3929 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Mon Mar 16 09:50:02 CET 2009
Author: phk
Date: 2009-03-16 09:50:01 +0100 (Mon, 16 Mar 2009)
New Revision: 3929
Added:
trunk/varnish-cache/bin/varnishd/cache_ban.h
Modified:
trunk/varnish-cache/bin/varnishd/cache_ban.c
Log:
Reluctantly expose the entrails of the ban processing, persistence
needs to be able to walk the list. Doing it with callbacks gets to
byzantine.
Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_ban.c 2009-03-16 08:42:35 UTC (rev 3928)
+++ trunk/varnish-cache/bin/varnishd/cache_ban.c 2009-03-16 08:50:01 UTC (rev 3929)
@@ -57,41 +57,11 @@
#include "cache.h"
#include "hash_slinger.h"
-struct ban_test;
+#include "cache_ban.h"
-/* A ban-testing function */
-typedef int ban_cond_f(const struct ban_test *bt, const struct object *o, const struct sess *sp);
+struct banhead ban_head = VTAILQ_HEAD_INITIALIZER(ban_head);
+struct lock ban_mtx;
-/* Each individual test to be performed on a ban */
-struct ban_test {
- unsigned magic;
-#define BAN_TEST_MAGIC 0x54feec67
- VTAILQ_ENTRY(ban_test) list;
- ban_cond_f *func;
- int flags;
-#define BAN_T_REGEXP (1 << 0)
-#define BAN_T_NOT (1 << 1)
- regex_t re;
- char *dst;
- char *src;
-};
-
-struct ban {
- unsigned magic;
-#define BAN_MAGIC 0x700b08ea
- VTAILQ_ENTRY(ban) list;
- unsigned refcount;
- int flags;
-#define BAN_F_GONE (1 << 0)
- VTAILQ_HEAD(,ban_test) tests;
- double t0;
- struct vsb *vsb;
- char *test;
-};
-
-static VTAILQ_HEAD(banhead,ban) ban_head = VTAILQ_HEAD_INITIALIZER(ban_head);
-static struct lock ban_mtx;
-
/*--------------------------------------------------------------------
* Manipulation of bans
*/
Copied: trunk/varnish-cache/bin/varnishd/cache_ban.h (from rev 3925, trunk/varnish-cache/bin/varnishd/cache_ban.c)
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_ban.h (rev 0)
+++ trunk/varnish-cache/bin/varnishd/cache_ban.h 2009-03-16 08:50:01 UTC (rev 3929)
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2009 Linpro AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ *
+ */
+
+struct ban_test;
+
+/* A ban-testing function */
+typedef int ban_cond_f(const struct ban_test *bt, const struct object *o, const struct sess *sp);
+
+/* Each individual test to be performed on a ban */
+struct ban_test {
+ unsigned magic;
+#define BAN_TEST_MAGIC 0x54feec67
+ VTAILQ_ENTRY(ban_test) list;
+ ban_cond_f *func;
+ int flags;
+#define BAN_T_REGEXP (1 << 0)
+#define BAN_T_NOT (1 << 1)
+ regex_t re;
+ char *dst;
+ char *src;
+};
+
+struct ban {
+ unsigned magic;
+#define BAN_MAGIC 0x700b08ea
+ VTAILQ_ENTRY(ban) list;
+ unsigned refcount;
+ int flags;
+#define BAN_F_GONE (1 << 0)
+ VTAILQ_HEAD(,ban_test) tests;
+ double t0;
+ struct vsb *vsb;
+ char *test;
+};
+
+VTAILQ_HEAD(banhead,ban);
+
+extern struct banhead ban_head;
+extern struct lock ban_mtx;
More information about the varnish-commit
mailing list