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

Eliminate VDP_FINISH, it's unmanageable and we have VDP_FINI

parent a6b63457
......@@ -39,6 +39,7 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
struct vdp_entry *vdp;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
assert(act == VDP_NULL || act == VDP_FLUSH);
vdp = req->vdp_nxt;
CHECK_OBJ_NOTNULL(vdp, VDP_ENTRY_MAGIC);
req->vdp_nxt = VTAILQ_NEXT(vdp, list);
......
......@@ -88,11 +88,10 @@ enum vfp_status VFP_GetStorage(struct vfp_ctx *, ssize_t *sz, uint8_t **ptr);
/* Deliver processors ------------------------------------------------*/
enum vdp_action {
VDP_INIT,
VDP_FINI,
VDP_NULL,
VDP_FLUSH,
VDP_FINISH,
VDP_INIT, /* Happens on VDP_push() */
VDP_FINI, /* Happens on VDP_pop() */
VDP_NULL, /* Input buffer valid after call */
VDP_FLUSH, /* Input buffer will be invalidated */
};
typedef int vdp_bytes(struct req *, enum vdp_action, void **priv,
......
......@@ -277,11 +277,11 @@ VDP_gunzip(struct req *req, enum vdp_action act, void **priv,
const void *dp;
struct worker *wrk;
struct vgz *vg;
int retval;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
wrk = req->wrk;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
if (act == VDP_INIT) {
vg = VGZ_NewUngzip(req->vsl, "U D -");
AN(vg);
......@@ -291,33 +291,28 @@ VDP_gunzip(struct req *req, enum vdp_action act, void **priv,
*priv = vg;
return (0);
}
CAST_OBJ_NOTNULL(vg, *priv, VGZ_MAGIC);
AN(vg->m_buf);
if (act == VDP_FINI) {
AZ(len);
AZ(vg->m_len);
(void)VGZ_Destroy(&vg);
*priv = NULL;
return (0);
}
AN(vg->m_buf);
if (len == 0) {
AN(act > VDP_NULL);
retval = VDP_bytes(req, act, vg->m_buf, vg->m_len);
vg->m_len = 0;
VGZ_Obuf(vg, vg->m_buf, vg->m_sz);
return (retval);
}
if (len == 0)
return (0);
VGZ_Ibuf(vg, ptr, len);
do {
if (vg->m_len == vg->m_sz)
vr = VGZ_STUCK;
else {
vr = VGZ_Gunzip(vg, &dp, &dl);
vg->m_len += dl;
}
if (vr < VGZ_OK)
return (-1);
if (vg->m_len == vg->m_sz || vr == VGZ_STUCK) {
if (vg->m_len == vg->m_sz || vr != VGZ_OK) {
if (VDP_bytes(req, VDP_FLUSH, vg->m_buf, vg->m_len))
return (-1);
vg->m_len = 0;
......
......@@ -222,7 +222,6 @@ v1d_WriteDirObj(struct req *req)
WRONG("Wrong OIS value");
}
} while (ois == OIS_DATA || ois == OIS_STREAM);
(void)VDP_bytes(req, VDP_FINISH, NULL, 0);
ObjIterEnd(req->objcore, &oi);
return (ois);
}
......
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