[master] c9d3b3f Change from "struct director *" to VCL_BACKEND (=constify)
Poul-Henning Kamp
phk at FreeBSD.org
Fri Apr 27 14:04:25 UTC 2018
commit c9d3b3ff5ff3fc400fe72f1e7d66693f88e1b04f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Apr 27 07:25:12 2018 +0000
Change from "struct director *" to VCL_BACKEND (=constify)
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 1e17934..1fc37aa 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -448,12 +448,13 @@ VRT_backend_vsm_need(VRT_CTX)
return (VRT_VSC_Overhead(VSC_vbe_size));
}
-struct director * v_matchproto_()
+VCL_BACKEND v_matchproto_()
VRT_new_backend_clustered(VRT_CTX, struct vsmw_cluster *vc,
const struct vrt_backend *vrt)
{
struct backend *be;
struct director *d;
+ VCL_BACKEND bb;
struct vcl *vcl;
const struct vrt_backend_probe *vbp;
int retval;
@@ -493,7 +494,8 @@ VRT_new_backend_clustered(VRT_CTX, struct vsmw_cluster *vc,
retval = VRT_AddDirector(ctx, d, "%s", vrt->vcl_name);
if (retval) {
- VRT_delete_backend(ctx, &d);
+ bb = d;
+ VRT_delete_backend(ctx, &bb);
return (NULL);
}
@@ -516,7 +518,7 @@ VRT_new_backend_clustered(VRT_CTX, struct vsmw_cluster *vc,
return (d);
}
-struct director * v_matchproto_()
+VCL_BACKEND v_matchproto_()
VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
{
return (VRT_new_backend_clustered(ctx, NULL, vrt));
@@ -528,9 +530,9 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
*/
void
-VRT_delete_backend(VRT_CTX, struct director **dp)
+VRT_delete_backend(VRT_CTX, VCL_BACKEND *dp)
{
- struct director *d;
+ VCL_BACKEND d;
struct backend *be;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index bec82c1..e43a782 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -385,7 +385,7 @@ enum vry_finish_flag { KEEP, DISCARD };
void VRY_Finish(struct req *req, enum vry_finish_flag);
/* cache_vcl.c */
-struct director *VCL_DefaultDirector(const struct vcl *);
+VCL_BACKEND VCL_DefaultDirector(const struct vcl *);
const struct vrt_backend_probe *VCL_DefaultProbe(const struct vcl *);
void VCL_Init(void);
void VCL_Panic(struct vsb *, const struct vcl *);
diff --git a/bin/varnishd/cache/cache_vcl_vrt.c b/bin/varnishd/cache/cache_vcl_vrt.c
index 77cf521..d276aa7 100644
--- a/bin/varnishd/cache/cache_vcl_vrt.c
+++ b/bin/varnishd/cache/cache_vcl_vrt.c
@@ -210,7 +210,7 @@ VRT_DelDirector(struct director *d)
/*--------------------------------------------------------------------*/
-struct director *
+VCL_BACKEND
VCL_DefaultDirector(const struct vcl *vcl)
{
diff --git a/include/vrt.h b/include/vrt.h
index 2e776c3..37a0937 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -406,12 +406,12 @@ VCL_VOID VRT_Rollback(VRT_CTX, VCL_HTTP);
VCL_VOID VRT_synth_page(VRT_CTX, const char *, ...);
/* Backend related */
-struct director *VRT_new_backend(VRT_CTX, const struct vrt_backend *);
-struct director *VRT_new_backend_clustered(VRT_CTX,
+VCL_BACKEND VRT_new_backend(VRT_CTX, const struct vrt_backend *);
+VCL_BACKEND VRT_new_backend_clustered(VRT_CTX,
struct vsmw_cluster *, const struct vrt_backend *);
size_t VRT_backend_vsm_need(VRT_CTX);
-void VRT_delete_backend(VRT_CTX, struct director **);
-int VRT_backend_healthy(VRT_CTX, struct director *);
+void VRT_delete_backend(VRT_CTX, VCL_BACKEND *);
+int VRT_backend_healthy(VRT_CTX, VCL_BACKEND);
/* VSM related */
struct vsmw_cluster *VRT_VSM_Cluster_New(VRT_CTX, size_t);
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index b7d81d4..1d45837 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -656,7 +656,7 @@ struct VCL_conf {
#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */
unsigned syntax;
- struct director **default_director;
+ VCL_BACKEND *default_director;
const struct vrt_backend_probe *default_probe;
unsigned nref;
const struct vrt_ref *ref;
diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c
index 3f21cdb..4243b9d 100644
--- a/lib/libvcc/vcc_backend.c
+++ b/lib/libvcc/vcc_backend.c
@@ -547,7 +547,7 @@ vcc_ParseBackend(struct vcc *tl)
sym->noref = 1;
}
}
- Fh(tl, 0, "\nstatic struct director *%s;\n", dn);
+ Fh(tl, 0, "\nstatic VCL_BACKEND %s;\n", dn);
vcc_ParseHostDef(tl, t_be, dn);
if (tl->err) {
VSB_printf(tl->sb,
diff --git a/lib/libvmod_debug/vmod_debug_dyn.c b/lib/libvmod_debug/vmod_debug_dyn.c
index 5fa8833..aa78bfb 100644
--- a/lib/libvmod_debug/vmod_debug_dyn.c
+++ b/lib/libvmod_debug/vmod_debug_dyn.c
@@ -48,7 +48,7 @@ struct xyzzy_debug_dyn {
#define VMOD_DEBUG_DYN_MAGIC 0x9b77ccbd
pthread_mutex_t mtx;
char *vcl_name;
- struct director *dir;
+ VCL_BACKEND dir;
};
struct xyzzy_debug_dyn_uds {
@@ -56,7 +56,7 @@ struct xyzzy_debug_dyn_uds {
#define VMOD_DEBUG_UDS_MAGIC 0x6c7370e6
pthread_mutex_t mtx;
char *vcl_name;
- struct director *dir;
+ VCL_BACKEND dir;
};
static void
@@ -65,7 +65,7 @@ dyn_dir_init(VRT_CTX, struct xyzzy_debug_dyn *dyn,
{
struct addrinfo hints, *res = NULL;
struct suckaddr *sa;
- struct director *dir, *dir2;
+ VCL_BACKEND dir, dir2;
struct vrt_backend vrt;
CHECK_OBJ_NOTNULL(dyn, VMOD_DEBUG_DYN_MAGIC);
@@ -183,7 +183,7 @@ xyzzy_dyn_refresh(VRT_CTX, struct xyzzy_debug_dyn *dyn,
static int
dyn_uds_init(VRT_CTX, struct xyzzy_debug_dyn_uds *uds, VCL_STRING path)
{
- struct director *dir, *dir2;
+ VCL_BACKEND dir, dir2;
struct vrt_backend vrt;
struct stat st;
More information about the varnish-commit
mailing list