Commit 11c6e33e authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make space for VDP's to have a priv pointer

parent 3247c51d
...@@ -616,6 +616,7 @@ struct req { ...@@ -616,6 +616,7 @@ struct req {
/* Deliver pipeline */ /* Deliver pipeline */
#define N_VDPS 5 #define N_VDPS 5
vdp_bytes *vdps[N_VDPS]; vdp_bytes *vdps[N_VDPS];
void *vdpp[N_VDPS];
int vdp_nxt; int vdp_nxt;
/* Range */ /* Range */
...@@ -765,7 +766,7 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len) ...@@ -765,7 +766,7 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
/* Call the present layer, while pointing to the next layer down */ /* Call the present layer, while pointing to the next layer down */
i = req->vdp_nxt--; i = req->vdp_nxt--;
assert(i >= 0 && i < N_VDPS); assert(i >= 0 && i < N_VDPS);
retval = req->vdps[i](req, act, ptr, len); retval = req->vdps[i](req, act, req->vdpp[i], ptr, len);
req->vdp_nxt++; req->vdp_nxt++;
return (retval); return (retval);
} }
...@@ -780,6 +781,9 @@ VDP_push(struct req *req, vdp_bytes *func) ...@@ -780,6 +781,9 @@ VDP_push(struct req *req, vdp_bytes *func)
assert(req->vdp_nxt >= 0); assert(req->vdp_nxt >= 0);
assert(req->vdp_nxt + 1 < N_VDPS); assert(req->vdp_nxt + 1 < N_VDPS);
req->vdps[++req->vdp_nxt] = func; req->vdps[++req->vdp_nxt] = func;
req->vdpp[req->vdp_nxt] = NULL;
AZ(req->vdps[req->vdp_nxt](req, VDP_INIT,
&req->vdpp[req->vdp_nxt], NULL, 0));
} }
static inline void static inline void
...@@ -791,6 +795,10 @@ VDP_pop(struct req *req, vdp_bytes *func) ...@@ -791,6 +795,10 @@ VDP_pop(struct req *req, vdp_bytes *func)
assert(req->vdp_nxt >= 1); assert(req->vdp_nxt >= 1);
assert(req->vdp_nxt < N_VDPS); assert(req->vdp_nxt < N_VDPS);
assert(req->vdps[req->vdp_nxt] == func); 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--; req->vdp_nxt--;
} }
......
...@@ -206,15 +206,17 @@ ved_decode_len(uint8_t **pp) ...@@ -206,15 +206,17 @@ ved_decode_len(uint8_t **pp)
*/ */
int __match_proto__(vdp_bytes) int __match_proto__(vdp_bytes)
VED_pretend_gzip(struct req *req, enum vdp_action act, const void *pv, VED_pretend_gzip(struct req *req, enum vdp_action act, void *priv,
ssize_t l) const void *pv, ssize_t l)
{ {
uint8_t buf1[5], buf2[5]; uint8_t buf1[5], buf2[5];
const uint8_t *p; const uint8_t *p;
uint16_t lx; uint16_t lx;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
(void)act; (void)priv;
if (act == VDP_INIT || act == VDP_FINI)
return (0);
p = pv; p = pv;
lx = 65535; lx = 65535;
...@@ -362,7 +364,7 @@ ESI_Deliver(struct req *req) ...@@ -362,7 +364,7 @@ ESI_Deliver(struct req *req)
* was not gzip'ed. * was not gzip'ed.
*/ */
(void)VED_pretend_gzip(req, VDP_NULL, (void)VED_pretend_gzip(req, VDP_NULL,
pp, l2); NULL, pp, l2);
} else if (isgzip) { } else if (isgzip) {
/* /*
* A gzip'ed VEC, but ungzip'ed ESI * A gzip'ed VEC, but ungzip'ed ESI
......
...@@ -72,9 +72,11 @@ enum vfp_status VFP_Error(struct vfp_ctx *, const char *fmt, ...) ...@@ -72,9 +72,11 @@ enum vfp_status VFP_Error(struct vfp_ctx *, const char *fmt, ...)
/* Deliver processors ------------------------------------------------*/ /* Deliver processors ------------------------------------------------*/
enum vdp_action { enum vdp_action {
VDP_INIT,
VDP_NULL, VDP_NULL,
VDP_FLUSH, VDP_FLUSH,
VDP_FINISH, VDP_FINISH,
VDP_FINI,
}; };
typedef int vdp_bytes(struct req *, enum vdp_action, const void *ptr, typedef int vdp_bytes(struct req *, enum vdp_action, void *priv,
ssize_t len); const void *ptr, ssize_t len);
...@@ -285,7 +285,8 @@ VGZ_WrwInit(struct vgz *vg) ...@@ -285,7 +285,8 @@ VGZ_WrwInit(struct vgz *vg)
*/ */
int __match_proto__(vdp_bytes) int __match_proto__(vdp_bytes)
VDP_gunzip(struct req *req, enum vdp_action act, const void *ptr, ssize_t len) VDP_gunzip(struct req *req, enum vdp_action act, void *priv,
const void *ptr, ssize_t len)
{ {
enum vgzret_e vr; enum vgzret_e vr;
ssize_t dl; ssize_t dl;
...@@ -296,6 +297,9 @@ VDP_gunzip(struct req *req, enum vdp_action act, const void *ptr, ssize_t len) ...@@ -296,6 +297,9 @@ VDP_gunzip(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
wrk = req->wrk; wrk = req->wrk;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
(void)priv;
if (act == VDP_INIT || act == VDP_FINI)
return (0);
vg = req->vgz; vg = req->vgz;
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
AN(vg->m_buf); AN(vg->m_buf);
......
...@@ -36,11 +36,15 @@ ...@@ -36,11 +36,15 @@
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
static int __match_proto__(vdp_bytes) static int __match_proto__(vdp_bytes)
v1d_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len) v1d_bytes(struct req *req, enum vdp_action act, void *priv,
const void *ptr, ssize_t len)
{ {
ssize_t wl = 0; ssize_t wl = 0;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
(void)priv;
if (act == VDP_INIT || act == VDP_FINI)
return (0);
assert(req->vdp_nxt == -1); /* always at the bottom of the pile */ assert(req->vdp_nxt == -1); /* always at the bottom of the pile */
...@@ -57,14 +61,17 @@ v1d_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len) ...@@ -57,14 +61,17 @@ v1d_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
static int __match_proto__(vdp_bytes) static int __match_proto__(vdp_bytes)
v1d_range_bytes(struct req *req, enum vdp_action act, const void *ptr, v1d_range_bytes(struct req *req, enum vdp_action act, void *priv,
ssize_t len) const void *ptr, ssize_t len)
{ {
int retval = 0; int retval = 0;
ssize_t l; ssize_t l;
const char *p = ptr; const char *p = ptr;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
(void)priv;
if (act == VDP_INIT || act == VDP_FINI)
return (0);
l = req->range_low - req->range_off; l = req->range_low - req->range_off;
if (l > 0) { if (l > 0) {
if (l > len) if (l > 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