[master] 4376215 Morph VDI_Healthy() into VRT_Healthy() and move the rest of the VDI_ functions out of $ABI VRT.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Sep 26 20:49:07 UTC 2017
commit 4376215b4c3c492d532b6782178a62c57a3aed43
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Sep 26 20:47:24 2017 +0000
Morph VDI_Healthy() into VRT_Healthy() and move the rest of the
VDI_ functions out of $ABI VRT.
diff --git a/bin/varnishd/cache/cache_director.c b/bin/varnishd/cache/cache_director.c
index 0f65369..3b2df2c 100644
--- a/bin/varnishd/cache/cache_director.c
+++ b/bin/varnishd/cache/cache_director.c
@@ -39,6 +39,8 @@
#include "cache_director.h"
+#include "vrt.h"
+
/* Resolve director --------------------------------------------------*/
static const struct director *
@@ -172,13 +174,16 @@ VDI_Http1Pipe(struct req *req, struct busyobj *bo)
*/
int
-VDI_Healthy(const struct director *d, const struct busyobj *bo)
+VRT_Healthy(VRT_CTX, VCL_BACKEND be)
{
- CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
- if (d->healthy == NULL)
+ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+ if (be == NULL)
+ return (0);
+ CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC);
+ if (be->healthy == NULL)
return (1);
- return (d->healthy(d, bo, NULL));
+ return (be->healthy(be, ctx->bo, NULL));
}
/* Dump panic info -----------------------------------------------------
diff --git a/bin/varnishd/cache/cache_director.h b/bin/varnishd/cache/cache_director.h
index a02e086..8f60d6a 100644
--- a/bin/varnishd/cache/cache_director.h
+++ b/bin/varnishd/cache/cache_director.h
@@ -37,18 +37,10 @@
*
*/
-/*--------------------------------------------------------------------
- * A director is a piece of code which selects one of possibly multiple
- * backends to use.
- */
-
-
typedef unsigned vdi_healthy_f(const struct director *, const struct busyobj *,
double *changed);
-
typedef const struct director *vdi_resolve_f(const struct director *,
struct worker *, struct busyobj *);
-
typedef int vdi_gethdrs_f(const struct director *, struct worker *,
struct busyobj *);
typedef int vdi_getbody_f(const struct director *, struct worker *,
@@ -79,16 +71,3 @@ struct director {
void *priv;
const void *priv2;
};
-
-/* cache_director.c */
-
-int VDI_GetHdr(struct worker *, struct busyobj *);
-int VDI_GetBody(struct worker *, struct busyobj *);
-const struct suckaddr *VDI_GetIP(struct worker *, struct busyobj *);
-
-void VDI_Finish(struct worker *wrk, struct busyobj *bo);
-
-enum sess_close VDI_Http1Pipe(struct req *, struct busyobj *);
-
-int VDI_Healthy(const struct director *, const struct busyobj *);
-void VDI_Panic(const struct director *, struct vsb *, const char *nm);
diff --git a/bin/varnishd/cache/cache_priv.h b/bin/varnishd/cache/cache_priv.h
index 5faec37..2dcf32d 100644
--- a/bin/varnishd/cache/cache_priv.h
+++ b/bin/varnishd/cache/cache_priv.h
@@ -49,6 +49,14 @@ void VBT_Init(void);
/* cache_backend_poll.c */
void VBP_Init(void);
+/* cache_director.c */
+int VDI_GetHdr(struct worker *, struct busyobj *);
+int VDI_GetBody(struct worker *, struct busyobj *);
+const struct suckaddr *VDI_GetIP(struct worker *, struct busyobj *);
+void VDI_Finish(struct worker *wrk, struct busyobj *bo);
+enum sess_close VDI_Http1Pipe(struct req *, struct busyobj *);
+void VDI_Panic(const struct director *, struct vsb *, const char *nm);
+
/* cache_exp.c */
double EXP_Ttl(const struct req *, const struct objcore *);
void EXP_Insert(struct worker *wrk, struct objcore *oc);
diff --git a/include/vrt.h b/include/vrt.h
index fc08b68..27fd57b 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -48,7 +48,9 @@
* binary/load-time compatible, increment MAJOR version
*
*
- * 6.1 (unreleased):
+ * 6.2 (scheduled for: 2018-03-15)
+ * VRT_Healthy() added
+ * 6.1 (2017-09-15 aka 5.2)
* http_CollectHdrSep added
* VRT_purge modified (may fail a transaction, signature changed)
* 6.0 (2017-03-15):
@@ -77,7 +79,7 @@
#define VRT_MAJOR_VERSION 6U
-#define VRT_MINOR_VERSION 1U
+#define VRT_MINOR_VERSION 2U
/***********************************************************************/
@@ -355,6 +357,11 @@ void VRT_synth_page(VRT_CTX, const char *, ...);
/* Backend related */
struct director *VRT_new_backend(VRT_CTX, const struct vrt_backend *);
void VRT_delete_backend(VRT_CTX, struct director **);
+int VRT_backend_healthy(VRT_CTX, struct director *);
+
+
+/* cache_director.c */
+int VRT_Healthy(VRT_CTX, VCL_BACKEND);
/* Suckaddr related */
int VRT_VSA_GetPtr(const struct suckaddr *sua, const unsigned char ** dst);
diff --git a/lib/libvmod_std/vmod_std.c b/lib/libvmod_std/vmod_std.c
index 28cfe2f..915b7f2 100644
--- a/lib/libvmod_std/vmod_std.c
+++ b/lib/libvmod_std/vmod_std.c
@@ -198,10 +198,8 @@ VCL_BOOL __match_proto__(td_std_healthy)
vmod_healthy(VRT_CTX, VCL_BACKEND be)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- if (be == NULL)
- return (0);
- CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC);
- return (VDI_Healthy(be, ctx->bo));
+ CHECK_OBJ_ORNULL(be, DIRECTOR_MAGIC);
+ return (VRT_Healthy(ctx, be));
}
VCL_INT __match_proto__(td_std_port)
More information about the varnish-commit
mailing list