*/
struct ws {
+ const char *id; /* identity */
char *s; /* (S)tart of buffer */
char *f; /* (F)ree pointer */
char *r; /* (R)eserved length */
/* cache_ws.c */
-void WS_Init(struct ws *ws, void *space, unsigned len);
+void WS_Init(struct ws *ws, const char *id, void *space, unsigned len);
unsigned WS_Reserve(struct ws *ws, unsigned bytes);
void WS_Release(struct ws *ws, unsigned bytes);
void WS_ReleaseP(struct ws *ws, char *ptr);
if (bereq == NULL)
return (NULL);
bereq->magic = BEREQ_MAGIC;
- WS_Init(bereq->ws, bereq + 1, len);
+ WS_Init(bereq->ws, "bereq", bereq + 1, len);
}
http_Setup(bereq->http, bereq->ws);
return (bereq);
/* Set up obj's workspace */
st = sp->obj->objstore;
- WS_Init(sp->obj->ws_o, st->ptr + st->len, st->space - st->len);
+ WS_Init(sp->obj->ws_o, "obj", st->ptr + st->len, st->space - st->len);
st->len = st->space;
WS_Assert(sp->obj->ws_o);
http_Setup(sp->obj->http, sp->obj->ws_o);
sp->sockaddrlen = len;
}
- WS_Init(sp->ws, (void *)(sm + 1), sm->workspace);
+ WS_Init(sp->ws, "sess", (void *)(sm + 1), sm->workspace);
sp->http = &sm->http[0];
sp->http0 = &sm->http[1];
/* Set up obj's workspace */
st = o->objstore;
- WS_Init(o->ws_o, st->ptr + st->len, st->space - st->len);
+ WS_Init(o->ws_o, "obj", st->ptr + st->len, st->space - st->len);
st->len = st->space;
WS_Assert(o->ws_o);
http_Setup(o->http, o->ws_o);
/* allocate space for header */
- WS_Init(h->ws, malloc(1024), 1024);
+ WS_Init(h->ws, "error", malloc(1024), 1024);
/* generate header */
http_ClrHeader(h);
{
assert(ws != NULL);
- WS_DEBUG((SLT_Debug, 0, "WS(%p = (%p %u %u %u)",
- ws, ws->s, pdiff(ws->s, ws->f),
+ WS_DEBUG((SLT_Debug, 0, "WS(%p = (%s, %p %u %u %u)",
+ ws, ws->id, ws->s, pdiff(ws->s, ws->f),
ws->r == NULL ? 0 : pdiff(ws->f, ws->r),
pdiff(ws->s, ws->e)));
assert(ws->s != NULL);
}
void
-WS_Init(struct ws *ws, void *space, unsigned len)
+WS_Init(struct ws *ws, const char *id, void *space, unsigned len)
{
- WS_DEBUG((SLT_Debug, 0, "WS_Init(%p, %p, %u)", ws, space, len));
+ WS_DEBUG((SLT_Debug, 0, "WS_Init(%p, \"%s\", %p, %u)", ws, id, space, len));
assert(space != NULL);
memset(ws, 0, sizeof *ws);
ws->s = space;
ws->e = ws->s + len;
ws->f = ws->s;
+ ws->id = id;
WS_Assert(ws);
}