[master] 72648a7 Hide struct vfp_ctx properly in cache_filter.h
Poul-Henning Kamp
phk at FreeBSD.org
Thu Oct 26 13:30:16 UTC 2017
commit 72648a74f8cdc7833582414cfc15ebb2fc0dfe5b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Oct 26 13:29:10 2017 +0000
Hide struct vfp_ctx properly in cache_filter.h
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index dc0a12c..ff66738 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -167,25 +167,6 @@ struct http {
};
/*--------------------------------------------------------------------
- * VFP filter state
- */
-
-VTAILQ_HEAD(vfp_entry_s, vfp_entry);
-
-struct vfp_ctx {
- unsigned magic;
-#define VFP_CTX_MAGIC 0x61d9d3e5
- int failed;
- struct http *req;
- struct http *resp;
- struct worker *wrk;
- struct objcore *oc;
-
- struct vfp_entry_s vfp;
- struct vfp_entry *vfp_nxt;
-};
-
-/*--------------------------------------------------------------------
* HTTP Protocol connection structure
*
* This is the protocol independent object for a HTTP connection, used
@@ -437,7 +418,7 @@ struct busyobj {
struct sess *sp;
struct worker *wrk;
- struct vfp_ctx vfc[1];
+ struct vfp_ctx *vfc;
struct ws ws[1];
uintptr_t ws_bo;
@@ -538,7 +519,7 @@ struct req {
double t_req; /* Headers complete */
struct http_conn htc[1];
- struct vfp_ctx vfc[1];
+ struct vfp_ctx *vfc;
const char *client_identity;
/* HTTP request */
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index b18f867..3533c66 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -35,7 +35,7 @@
#include <stdlib.h>
#include "cache_varnishd.h"
-
+#include "cache_filter.h"
#include "cache_objhead.h"
static struct mempool *vbopool;
@@ -121,6 +121,11 @@ VBO_GetBusyObj(struct worker *wrk, const struct req *req)
p = (void*)PRNDUP(p);
assert(p < bo->end);
+ bo->vfc = (void*)p;
+ p += sizeof (*bo->vfc);
+ p = (void*)PRNDUP(p);
+ INIT_OBJ(bo->vfc, VFP_CTX_MAGIC);
+
WS_Init(bo->ws, "bo", p, bo->end - p);
bo->do_stream = 1;
diff --git a/bin/varnishd/cache/cache_esi_parse.c b/bin/varnishd/cache/cache_esi_parse.c
index 048672b..f02a6df 100644
--- a/bin/varnishd/cache/cache_esi_parse.c
+++ b/bin/varnishd/cache/cache_esi_parse.c
@@ -31,6 +31,7 @@
#include "config.h"
#include "cache_varnishd.h"
+#include "cache_filter.h"
#include "cache_vgz.h"
#include "cache_esi.h"
diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h
index 20c770d..84dfc05 100644
--- a/bin/varnishd/cache/cache_filter.h
+++ b/bin/varnishd/cache/cache_filter.h
@@ -65,6 +65,25 @@ struct vfp_entry {
uint64_t bytes_out;
};
+/*--------------------------------------------------------------------
+ * VFP filter state
+ */
+
+VTAILQ_HEAD(vfp_entry_s, vfp_entry);
+
+struct vfp_ctx {
+ unsigned magic;
+#define VFP_CTX_MAGIC 0x61d9d3e5
+ int failed;
+ struct http *req;
+ struct http *resp;
+ struct worker *wrk;
+ struct objcore *oc;
+
+ struct vfp_entry_s vfp;
+ struct vfp_entry *vfp_nxt;
+};
+
enum vfp_status VFP_Suck(struct vfp_ctx *, void *p, ssize_t *lp);
enum vfp_status VFP_Error(struct vfp_ctx *, const char *fmt, ...)
__v_printflike(2, 3);
diff --git a/bin/varnishd/cache/cache_req.c b/bin/varnishd/cache/cache_req.c
index c1e8979..43581e7 100644
--- a/bin/varnishd/cache/cache_req.c
+++ b/bin/varnishd/cache/cache_req.c
@@ -33,6 +33,7 @@
#include "config.h"
#include "cache_varnishd.h"
+#include "cache_filter.h"
#include <stdio.h>
#include <stdlib.h>
@@ -122,6 +123,10 @@ Req_New(const struct worker *wrk, struct sess *sp)
p += sz;
p = (void*)PRNDUP(p);
+ req->vfc = (void*)p;
+ p += sizeof (*req->vfc);
+ INIT_OBJ(req->vfc, VFP_CTX_MAGIC);
+
assert(p < e);
WS_Init(req->ws, "req", p, e - p);
@@ -136,6 +141,7 @@ Req_New(const struct worker *wrk, struct sess *sp)
VTAILQ_INIT(&req->vdpe);
VRTPRIV_init(req->privs);
+
return (req);
}
diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c
index e823c18..9efb938 100644
--- a/bin/varnishd/http1/cache_http1_fetch.c
+++ b/bin/varnishd/http1/cache_http1_fetch.c
@@ -30,6 +30,7 @@
#include "config.h"
#include "cache/cache_varnishd.h"
+#include "cache/cache_filter.h"
#include <errno.h>
#include <stdio.h>
More information about the varnish-commit
mailing list