[master] 8775521 Change allocobj related prototypes

Poul-Henning Kamp phk at FreeBSD.org
Tue Dec 15 23:20:04 CET 2015


commit 877552140e5a2c05983ec8cdd14e2f52a6468b23
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Dec 15 22:19:49 2015 +0000

    Change allocobj related prototypes

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 918d620..195c5f8 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -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,
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 38c897d..cc93d97 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -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));
 }
 
diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c
index 92be12c..30089d1 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -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;
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index a539817..5127f55 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -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
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 1029dd2..b924c4a 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -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);
 		}
 	}
 
diff --git a/bin/varnishd/storage/storage.h b/bin/varnishd/storage/storage.h
index 0d0d429..297b583 100644
--- a/bin/varnishd/storage/storage.h
+++ b/bin/varnishd/storage/storage.h
@@ -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,
diff --git a/bin/varnishd/storage/storage_persistent.c b/bin/varnishd/storage/storage_persistent.c
index 5b9910f..2ec51d3 100644
--- a/bin/varnishd/storage/storage_persistent.c
+++ b/bin/varnishd/storage/storage_persistent.c
@@ -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 */
diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c
index 11d55dc..63a1117 100644
--- a/bin/varnishd/storage/storage_simple.c
+++ b/bin/varnishd/storage/storage_simple.c
@@ -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)



More information about the varnish-commit mailing list