Commit cd30d116 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move VDP context to cache_filter.h

parent 571a1e33
...@@ -460,8 +460,6 @@ struct busyobj { ...@@ -460,8 +460,6 @@ struct busyobj {
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
VTAILQ_HEAD(vdp_entry_s, vdp_entry);
struct req { struct req {
unsigned magic; unsigned magic;
#define REQ_MAGIC 0x2751aaa1 #define REQ_MAGIC 0x2751aaa1
...@@ -532,11 +530,7 @@ struct req { ...@@ -532,11 +530,7 @@ struct req {
struct objcore *stale_oc; struct objcore *stale_oc;
/* Deliver pipeline */ /* Deliver pipeline */
struct vdp_ctx { struct vdp_ctx *vdc;
struct vdp_entry_s vdp;
struct vdp_entry *nxt;
unsigned retval;
} vdp[1];
/* Delivery mode */ /* Delivery mode */
unsigned res_mode; unsigned res_mode;
......
...@@ -56,7 +56,7 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len) ...@@ -56,7 +56,7 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
struct vdp_ctx *vdc; struct vdp_ctx *vdc;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
vdc = req->vdp; vdc = req->vdc;
assert(act == VDP_NULL || act == VDP_FLUSH); assert(act == VDP_NULL || act == VDP_FLUSH);
if (vdc->retval) if (vdc->retval)
return (vdc->retval); return (vdc->retval);
...@@ -80,7 +80,7 @@ VDP_push(struct req *req, const struct vdp *vdp, void *priv, int bottom) ...@@ -80,7 +80,7 @@ VDP_push(struct req *req, const struct vdp *vdp, void *priv, int bottom)
struct vdp_ctx *vdc; struct vdp_ctx *vdc;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
vdc = req->vdp; vdc = req->vdc;
AN(vdp); AN(vdp);
AN(vdp->name); AN(vdp->name);
AN(vdp->func); AN(vdp->func);
...@@ -107,7 +107,7 @@ VDP_close(struct req *req) ...@@ -107,7 +107,7 @@ VDP_close(struct req *req)
struct vdp_ctx *vdc; struct vdp_ctx *vdc;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
vdc = req->vdp; vdc = req->vdc;
while (!VTAILQ_EMPTY(&vdc->vdp)) { while (!VTAILQ_EMPTY(&vdc->vdp)) {
vdpe = VTAILQ_FIRST(&vdc->vdp); vdpe = VTAILQ_FIRST(&vdc->vdp);
CHECK_OBJ_NOTNULL(vdpe, VDP_ENTRY_MAGIC); CHECK_OBJ_NOTNULL(vdpe, VDP_ENTRY_MAGIC);
......
...@@ -113,5 +113,15 @@ struct vdp_entry { ...@@ -113,5 +113,15 @@ struct vdp_entry {
VTAILQ_ENTRY(vdp_entry) list; 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); 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); void VDP_push(struct req *, const struct vdp *, void *priv, int bottom);
...@@ -327,7 +327,7 @@ vdp_gunzip(struct req *req, enum vdp_action act, void **priv, ...@@ -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 * If the size is non-zero AND we are the top
* VDP (ie: no ESI), we know what size the output will be. * 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; req->resp_len = u;
return (0); return (0);
...@@ -355,7 +355,7 @@ vdp_gunzip(struct req *req, enum vdp_action act, void **priv, ...@@ -355,7 +355,7 @@ vdp_gunzip(struct req *req, enum vdp_action act, void **priv,
return (-1); return (-1);
if (vg->m_len == vg->m_sz || vr != VGZ_OK) { if (vg->m_len == vg->m_sz || vr != VGZ_OK) {
if (VDP_bytes(req, VDP_FLUSH, vg->m_buf, vg->m_len)) if (VDP_bytes(req, VDP_FLUSH, vg->m_buf, vg->m_len))
return (req->vdp->retval); return (req->vdc->retval);
vg->m_len = 0; vg->m_len = 0;
VGZ_Obuf(vg, vg->m_buf, vg->m_sz); VGZ_Obuf(vg, vg->m_buf, vg->m_sz);
} }
......
...@@ -124,8 +124,13 @@ Req_New(const struct worker *wrk, struct sess *sp) ...@@ -124,8 +124,13 @@ Req_New(const struct worker *wrk, struct sess *sp)
p = (void*)PRNDUP(p); p = (void*)PRNDUP(p);
req->vfc = (void*)p; req->vfc = (void*)p;
p += sizeof (*req->vfc);
INIT_OBJ(req->vfc, VFP_CTX_MAGIC); 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); assert(p < e);
...@@ -137,11 +142,8 @@ Req_New(const struct worker *wrk, struct sess *sp) ...@@ -137,11 +142,8 @@ Req_New(const struct worker *wrk, struct sess *sp)
req->t_prev = NAN; req->t_prev = NAN;
req->t_req = NAN; req->t_req = NAN;
req->vdp->nxt = 0;
VTAILQ_INIT(&req->vdp->vdp);
VRTPRIV_init(req->privs); VRTPRIV_init(req->privs);
return (req); return (req);
} }
......
...@@ -790,7 +790,7 @@ cnt_recv(struct worker *wrk, struct req *req) ...@@ -790,7 +790,7 @@ cnt_recv(struct worker *wrk, struct req *req)
req->director_hint = VCL_DefaultDirector(req->vcl); req->director_hint = VCL_DefaultDirector(req->vcl);
AN(req->director_hint); AN(req->director_hint);
req->vdp->retval = 0; req->vdc->retval = 0;
req->d_ttl = -1; req->d_ttl = -1;
req->disable_esi = 0; req->disable_esi = 0;
req->hash_always_miss = 0; req->hash_always_miss = 0;
......
...@@ -46,7 +46,7 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv, ...@@ -46,7 +46,7 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv,
if (act == VDP_INIT || act == VDP_FINI) if (act == VDP_INIT || act == VDP_FINI)
return (0); 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) if (len > 0)
wl = V1L_Write(req->wrk, ptr, len); wl = V1L_Write(req->wrk, ptr, len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment