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