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

Change allocobj related prototypes

parent 616c1ee5
......@@ -1040,7 +1040,7 @@ void RFC2616_Weaken_Etag(struct http *hp);
void RFC2616_Vary_AE(struct http *hp);
/* stevedore.c */
int STV_NewObject(struct objcore *, struct worker *,
int STV_NewObject(struct worker *, struct objcore *,
const char *hint, unsigned len);
struct storage *STV_alloc(const struct stevedore *, size_t size);
void STV_trim(const struct stevedore *, struct storage *, size_t size,
......
......@@ -62,7 +62,7 @@ vbf_allocobj(struct busyobj *bo, unsigned l)
bo->storage_hint = NULL;
if (STV_NewObject(bo->fetch_objcore, bo->wrk, storage_hint, l))
if (STV_NewObject(bo->wrk, bo->fetch_objcore, storage_hint, l))
return (1);
if (storage_hint != NULL && !strcmp(storage_hint, TRANSIENT_STORAGE))
......@@ -77,7 +77,7 @@ vbf_allocobj(struct busyobj *bo, unsigned l)
oc->exp.ttl = cache_param->shortlived;
oc->exp.grace = 0.0;
oc->exp.keep = 0.0;
return (STV_NewObject(bo->fetch_objcore, bo->wrk,
return (STV_NewObject(bo->wrk, bo->fetch_objcore,
TRANSIENT_STORAGE, l));
}
......
......@@ -218,7 +218,7 @@ VRB_Cache(struct req *req, ssize_t maxsize)
req->body_oc = HSH_Private(req->wrk);
AN(req->body_oc);
XXXAN(STV_NewObject(req->body_oc, req->wrk, TRANSIENT_STORAGE, 8));
XXXAN(STV_NewObject(req->wrk, req->body_oc, TRANSIENT_STORAGE, 8));
vfc->http = req->http;
vfc->oc = req->body_oc;
......
......@@ -287,7 +287,7 @@ cnt_synth(struct worker *wrk, struct req *req)
req->objcore = HSH_Private(wrk);
CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
if (STV_NewObject(req->objcore, wrk, TRANSIENT_STORAGE, 1024)) {
if (STV_NewObject(wrk, req->objcore, TRANSIENT_STORAGE, 1024)) {
szl = VSB_len(synth_body);
assert(szl >= 0);
} else
......
......@@ -138,7 +138,7 @@ STV_alloc(const struct stevedore *stv, size_t size)
*/
int
STV_NewObject(struct objcore *oc, struct worker *wrk,
STV_NewObject(struct worker *wrk, struct objcore *oc,
const char *hint, unsigned wsl)
{
struct stevedore *stv, *stv0;
......@@ -150,12 +150,12 @@ STV_NewObject(struct objcore *oc, struct worker *wrk,
stv = stv0 = stv_pick_stevedore(wrk->vsl, &hint);
AN(stv->allocobj);
j = stv->allocobj(stv, oc, wsl);
j = stv->allocobj(wrk, stv, oc, wsl, 0);
if (j == 0 && hint == NULL) {
do {
stv = stv_pick_stevedore(wrk->vsl, &hint);
AN(stv->allocobj);
j = stv->allocobj(stv, oc, wsl);
j = stv->allocobj(wrk, stv, oc, wsl, 0);
} while (j == 0 && stv != stv0);
}
if (j == 0) {
......@@ -163,7 +163,7 @@ STV_NewObject(struct objcore *oc, struct worker *wrk,
for (i = 0; j == 0 && i < cache_param->nuke_limit; i++) {
if (EXP_NukeOne(wrk, stv->lru) == -1)
break;
j = stv->allocobj(stv, oc, wsl);
j = stv->allocobj(wrk, stv, oc, wsl, 0);
}
}
......
......@@ -63,8 +63,8 @@ typedef void storage_open_f(const struct stevedore *);
typedef struct storage *storage_alloc_f(const struct stevedore *, size_t size);
typedef void storage_trim_f(struct storage *, size_t size, int move_ok);
typedef void storage_free_f(struct storage *);
typedef int storage_allocobj_f(const struct stevedore *, struct objcore *,
unsigned ltot);
typedef int storage_allocobj_f(struct worker *, const struct stevedore *,
struct objcore *, unsigned ltot, int really);
typedef void storage_close_f(const struct stevedore *);
typedef void storage_signal_close_f(const struct stevedore *);
typedef int storage_baninfo_f(const struct stevedore *, enum baninfo event,
......
......@@ -503,8 +503,9 @@ smp_allocx(const struct stevedore *st, size_t min_size, size_t max_size,
* Allocate an object
*/
static int
smp_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned wsl)
static int __match_proto__(storage_allocobj_f)
smp_allocobj(struct worker *wrk, const struct stevedore *stv,
struct objcore *oc, unsigned wsl, int really)
{
struct object *o;
struct storage *st;
......@@ -514,7 +515,9 @@ smp_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned wsl)
unsigned objidx;
unsigned ltot;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
(void)really;
CAST_OBJ_NOTNULL(sc, stv->priv, SMP_SC_MAGIC);
/* Don't entertain already dead objects */
......
......@@ -74,15 +74,17 @@ SML_MkObject(const struct stevedore *stv, struct objcore *oc, void *ptr)
* implement persistent storage can rely on.
*/
int
SML_allocobj(const struct stevedore *stv, struct objcore *oc,
unsigned wsl)
int __match_proto__(storage_allocobj_f)
SML_allocobj(struct worker *wrk, const struct stevedore *stv,
struct objcore *oc, unsigned wsl, int really)
{
struct object *o;
struct storage *st;
unsigned ltot;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
(void)really;
ltot = sizeof(struct object) + PRNDUP(wsl);
st = stv->alloc(stv, ltot);
if (st == NULL)
......
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