[master] 1b4695e Rename VRT_init_vbe() to VRT_new_backend()
Poul-Henning Kamp
phk at FreeBSD.org
Wed Jun 17 14:44:52 CEST 2015
commit 1b4695eb9b2f8680be0fdd68652a6cf08d88cba0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jun 17 12:03:32 2015 +0000
Rename VRT_init_vbe() to VRT_new_backend()
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 2720710..c029e44 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -297,16 +297,14 @@ vbe_dir_http1pipe(const struct director *d, struct req *req, struct busyobj *bo)
/*--------------------------------------------------------------------*/
-void
-VRT_init_vbe(VRT_CTX, struct director **dp, const struct vrt_backend *vrt)
+struct director *
+VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
{
struct director *d;
struct backend *be;
ASSERT_CLI();
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- AN(dp);
- AZ(*dp);
CHECK_OBJ_NOTNULL(vrt, VRT_BACKEND_MAGIC);
AN(ctx->vcl);
@@ -328,7 +326,7 @@ VRT_init_vbe(VRT_CTX, struct director **dp, const struct vrt_backend *vrt)
if (vrt->probe != NULL)
VBP_Insert(be, vrt->probe, vrt->hosthdr);
- *dp = d;
+ return (d);
}
void
diff --git a/bin/varnishd/cache/cache_backend.h b/bin/varnishd/cache/cache_backend.h
index 6c9f82b..b586d22 100644
--- a/bin/varnishd/cache/cache_backend.h
+++ b/bin/varnishd/cache/cache_backend.h
@@ -62,6 +62,7 @@ struct backend {
int refcount;
struct lock mtx;
+ const struct vcl *vcl;
const char *vcl_name;
char *display_name;
const char *ipv4_addr;
diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c
index 16cc55c..b9c5591 100644
--- a/bin/varnishd/cache/cache_backend_cfg.c
+++ b/bin/varnishd/cache/cache_backend_cfg.c
@@ -82,7 +82,9 @@ VBE_AddBackend(const struct vrt_ctx *ctx, const struct vrt_backend *vb)
char buf[128];
struct vcl *vcl;
+ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
vcl = ctx->vcl;
+ AN(vcl);
AN(vb->vcl_name);
assert(vb->ipv4_suckaddr != NULL || vb->ipv6_suckaddr != NULL);
@@ -94,6 +96,7 @@ VBE_AddBackend(const struct vrt_ctx *ctx, const struct vrt_backend *vb)
bprintf(buf, "%s.%s", VCL_Name(vcl), vb->vcl_name);
REPLACE(b->display_name, buf);
+ b->vcl = vcl;
b->vcl_name = vb->vcl_name;
b->ipv4_addr = vb->ipv4_addr;
b->ipv6_addr = vb->ipv6_addr;
diff --git a/include/vrt.h b/include/vrt.h
index bd816e0..5afcf33 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -242,7 +242,7 @@ void VRT_Rollback(VRT_CTX, const struct http *);
void VRT_synth_page(VRT_CTX, const char *, ...);
/* Backend related */
-void VRT_init_vbe(VRT_CTX, struct director **, const struct vrt_backend *);
+struct director *VRT_new_backend(VRT_CTX, const struct vrt_backend *);
#ifdef VCL_RET_MAX
void VRT_event_vbe(VRT_CTX, enum vcl_event_e, const struct director *,
const struct vrt_backend *);
diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c
index 59fb851..c1d96ac 100644
--- a/lib/libvcc/vcc_backend.c
+++ b/lib/libvcc/vcc_backend.c
@@ -410,7 +410,7 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
ifp = New_IniFin(tl);
VSB_printf(ifp->ini,
- "\tVRT_init_vbe(ctx, &%s,\n\t &vgc_dir_priv_%s);",
+ "\t%s =\n\t VRT_new_backend(ctx, &vgc_dir_priv_%s);",
vgcname, vgcname);
VSB_printf(ifp->fin,
"\t\tVRT_fini_vbe(ctx, &%s,\n\t\t &vgc_dir_priv_%s);",
More information about the varnish-commit
mailing list