[master] 8bcaeac Start a separate source file for VDP infrastructure

Poul-Henning Kamp phk at FreeBSD.org
Wed Oct 22 00:14:26 CEST 2014


commit 8bcaeac68ecbeb1b624c6496e589f4f959e2c774
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Oct 21 21:44:13 2014 +0000

    Start a separate source file for VDP infrastructure

diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am
index 6e97946..922459e 100644
--- a/bin/varnishd/Makefile.am
+++ b/bin/varnishd/Makefile.am
@@ -16,6 +16,7 @@ varnishd_SOURCES = \
 	cache/cache_ban.c \
 	cache/cache_busyobj.c \
 	cache/cache_cli.c \
+	cache/cache_deliver_proc.c \
 	cache/cache_director.c \
 	cache/cache_esi_deliver.c \
 	cache/cache_esi_fetch.c \
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 4031ada..47a9e0a 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -747,53 +747,6 @@ int VRB_Cache(struct req *req, ssize_t maxsize);
 int VRB_Iterate(struct req *req, req_body_iter_f *func, void *priv);
 void VRB_Free(struct req *req);
 
-static inline int
-VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
-{
-	int i, retval;
-
-	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
-
-	assert(act > VDP_NULL || len > 0);
-	/* Call the present layer, while pointing to the next layer down */
-	i = req->vdp_nxt--;
-	assert(i >= 0 && i < N_VDPS);
-	retval = req->vdps[i](req, act, &req->vdpp[i], ptr, len);
-	req->vdp_nxt++;
-	return (retval);
-}
-
-static inline void
-VDP_push(struct req *req, vdp_bytes *func, void *priv)
-{
-	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
-	AN(func);
-
-	/* Push another layer */
-	assert(req->vdp_nxt >= 0);
-	assert(req->vdp_nxt + 1 < N_VDPS);
-	req->vdps[++req->vdp_nxt] = func;
-	req->vdpp[req->vdp_nxt] = priv;
-	AZ(req->vdps[req->vdp_nxt](req, VDP_INIT,
-	   &req->vdpp[req->vdp_nxt], NULL, 0));
-}
-
-static inline void
-VDP_pop(struct req *req, vdp_bytes *func)
-{
-	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
-
-	/* Pop top layer */
-	assert(req->vdp_nxt >= 1);
-	assert(req->vdp_nxt < N_VDPS);
-	assert(req->vdps[req->vdp_nxt] == func);
-	AZ(req->vdps[req->vdp_nxt](req, VDP_FINI,
-	   &req->vdpp[req->vdp_nxt], NULL, 0));
-	AZ(req->vdpp[req->vdp_nxt]);
-	req->vdps[req->vdp_nxt] = NULL;
-	req->vdp_nxt--;
-}
-
 /* cache_req_fsm.c [CNT] */
 enum req_fsm_nxt CNT_Request(struct worker *, struct req *);
 void CNT_AcctLogCharge(struct dstat *, struct req *);
diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c
new file mode 100644
index 0000000..f231da0
--- /dev/null
+++ b/bin/varnishd/cache/cache_deliver_proc.c
@@ -0,0 +1,80 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2014 Varnish Software 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.
+ */
+
+#include "config.h"
+
+#include "cache.h"
+//#include "cache_filter.h"
+
+int
+VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
+{
+	int i, retval;
+
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+
+	assert(act > VDP_NULL || len > 0);
+	/* Call the present layer, while pointing to the next layer down */
+	i = req->vdp_nxt--;
+	assert(i >= 0 && i < N_VDPS);
+	retval = req->vdps[i](req, act, &req->vdpp[i], ptr, len);
+	req->vdp_nxt++;
+	return (retval);
+}
+
+void
+VDP_push(struct req *req, vdp_bytes *func, void *priv)
+{
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+	AN(func);
+
+	/* Push another layer */
+	assert(req->vdp_nxt >= 0);
+	assert(req->vdp_nxt + 1 < N_VDPS);
+	req->vdps[++req->vdp_nxt] = func;
+	req->vdpp[req->vdp_nxt] = priv;
+	AZ(req->vdps[req->vdp_nxt](req, VDP_INIT,
+	   &req->vdpp[req->vdp_nxt], NULL, 0));
+}
+
+void
+VDP_pop(struct req *req, vdp_bytes *func)
+{
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+
+	/* Pop top layer */
+	assert(req->vdp_nxt >= 1);
+	assert(req->vdp_nxt < N_VDPS);
+	assert(req->vdps[req->vdp_nxt] == func);
+	AZ(req->vdps[req->vdp_nxt](req, VDP_FINI,
+	   &req->vdpp[req->vdp_nxt], NULL, 0));
+	AZ(req->vdpp[req->vdp_nxt]);
+	req->vdps[req->vdp_nxt] = NULL;
+	req->vdp_nxt--;
+}
diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h
index b2e1ddd..1ee0952 100644
--- a/bin/varnishd/cache/cache_filter.h
+++ b/bin/varnishd/cache/cache_filter.h
@@ -80,3 +80,7 @@ enum vdp_action {
 };
 typedef int vdp_bytes(struct req *, enum vdp_action, void **priv,
     const void *ptr, ssize_t len);
+
+int VDP_bytes(struct req *, enum vdp_action act, const void *ptr, ssize_t len);
+void VDP_push(struct req *, vdp_bytes *func, void *priv);
+void VDP_pop(struct req *, vdp_bytes *func);



More information about the varnish-commit mailing list