[master] cd30d11 Move VDP context to cache_filter.h
Poul-Henning Kamp
phk at FreeBSD.org
Mon Oct 30 11:08:08 UTC 2017
commit cd30d1163b33d907fcab5f8744315d0cbde4ef51
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Oct 27 07:44:57 2017 +0000
Move VDP context to cache_filter.h
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index b64e320..0e5810b 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -460,8 +460,6 @@ struct busyobj {
/*--------------------------------------------------------------------*/
-VTAILQ_HEAD(vdp_entry_s, vdp_entry);
-
struct req {
unsigned magic;
#define REQ_MAGIC 0x2751aaa1
@@ -532,11 +530,7 @@ struct req {
struct objcore *stale_oc;
/* Deliver pipeline */
- struct vdp_ctx {
- struct vdp_entry_s vdp;
- struct vdp_entry *nxt;
- unsigned retval;
- } vdp[1];
+ struct vdp_ctx *vdc;
/* Delivery mode */
unsigned res_mode;
diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c
index 2def938..3a5d6ba 100644
--- a/bin/varnishd/cache/cache_deliver_proc.c
+++ b/bin/varnishd/cache/cache_deliver_proc.c
@@ -56,7 +56,7 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
struct vdp_ctx *vdc;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- vdc = req->vdp;
+ vdc = req->vdc;
assert(act == VDP_NULL || act == VDP_FLUSH);
if (vdc->retval)
return (vdc->retval);
@@ -80,7 +80,7 @@ VDP_push(struct req *req, const struct vdp *vdp, void *priv, int bottom)
struct vdp_ctx *vdc;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- vdc = req->vdp;
+ vdc = req->vdc;
AN(vdp);
AN(vdp->name);
AN(vdp->func);
@@ -107,7 +107,7 @@ VDP_close(struct req *req)
struct vdp_ctx *vdc;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- vdc = req->vdp;
+ vdc = req->vdc;
while (!VTAILQ_EMPTY(&vdc->vdp)) {
vdpe = VTAILQ_FIRST(&vdc->vdp);
CHECK_OBJ_NOTNULL(vdpe, VDP_ENTRY_MAGIC);
diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h
index 84dfc05..f6a1ffa 100644
--- a/bin/varnishd/cache/cache_filter.h
+++ b/bin/varnishd/cache/cache_filter.h
@@ -113,5 +113,15 @@ struct vdp_entry {
VTAILQ_ENTRY(vdp_entry) list;
};
+VTAILQ_HEAD(vdp_entry_s, vdp_entry);
+
+struct vdp_ctx {
+ unsigned magic;
+#define VDP_CTX_MAGIC 0xee501df7
+ struct vdp_entry_s vdp;
+ struct vdp_entry *nxt;
+ unsigned retval;
+};
+
int VDP_bytes(struct req *, enum vdp_action act, const void *ptr, ssize_t len);
void VDP_push(struct req *, const struct vdp *, void *priv, int bottom);
diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index 2781a87..258db64 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -327,7 +327,7 @@ vdp_gunzip(struct req *req, enum vdp_action act, void **priv,
* If the size is non-zero AND we are the top
* VDP (ie: no ESI), we know what size the output will be.
*/
- if (u != 0 && VTAILQ_FIRST(&req->vdp->vdp)->vdp == &VDP_gunzip)
+ if (u != 0 && VTAILQ_FIRST(&req->vdc->vdp)->vdp == &VDP_gunzip)
req->resp_len = u;
return (0);
@@ -355,7 +355,7 @@ vdp_gunzip(struct req *req, enum vdp_action act, void **priv,
return (-1);
if (vg->m_len == vg->m_sz || vr != VGZ_OK) {
if (VDP_bytes(req, VDP_FLUSH, vg->m_buf, vg->m_len))
- return (req->vdp->retval);
+ return (req->vdc->retval);
vg->m_len = 0;
VGZ_Obuf(vg, vg->m_buf, vg->m_sz);
}
diff --git a/bin/varnishd/cache/cache_req.c b/bin/varnishd/cache/cache_req.c
index 484d6c5..2f1014f 100644
--- a/bin/varnishd/cache/cache_req.c
+++ b/bin/varnishd/cache/cache_req.c
@@ -124,8 +124,13 @@ Req_New(const struct worker *wrk, struct sess *sp)
p = (void*)PRNDUP(p);
req->vfc = (void*)p;
- p += sizeof (*req->vfc);
INIT_OBJ(req->vfc, VFP_CTX_MAGIC);
+ p = (void*)PRNDUP(p + sizeof(*req->vfc));
+
+ req->vdc = (void*)p;
+ INIT_OBJ(req->vdc, VDP_CTX_MAGIC);
+ VTAILQ_INIT(&req->vdc->vdp);
+ p = (void*)PRNDUP(p + sizeof(*req->vdc));
assert(p < e);
@@ -137,11 +142,8 @@ Req_New(const struct worker *wrk, struct sess *sp)
req->t_prev = NAN;
req->t_req = NAN;
- req->vdp->nxt = 0;
- VTAILQ_INIT(&req->vdp->vdp);
VRTPRIV_init(req->privs);
-
return (req);
}
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index c3b691d..ec0d715 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -790,7 +790,7 @@ cnt_recv(struct worker *wrk, struct req *req)
req->director_hint = VCL_DefaultDirector(req->vcl);
AN(req->director_hint);
- req->vdp->retval = 0;
+ req->vdc->retval = 0;
req->d_ttl = -1;
req->disable_esi = 0;
req->hash_always_miss = 0;
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 80e398c..9bf5bf8 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -46,7 +46,7 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv,
if (act == VDP_INIT || act == VDP_FINI)
return (0);
- AZ(req->vdp->nxt); /* always at the bottom of the pile */
+ AZ(req->vdc->nxt); /* always at the bottom of the pile */
if (len > 0)
wl = V1L_Write(req->wrk, ptr, len);
More information about the varnish-commit
mailing list