[master] 5dd5f9d Miniobj-ify the compiled backend and probe structs

Poul-Henning Kamp phk at FreeBSD.org
Mon Jan 19 17:29:27 CET 2015


commit 5dd5f9ddf4e23fe80edc2b83e4b353bdda2ac04b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 19 16:19:38 2015 +0000

    Miniobj-ify the compiled backend and probe structs

diff --git a/include/vrt.h b/include/vrt.h
index c30696a..3e3589e 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -140,20 +140,24 @@ extern const void * const vrt_magic_string_end;
 extern const void * const vrt_magic_string_unset;
 
 struct vrt_backend_probe {
-	const char	*url;
-	const char	*request;
-	double		timeout;
-	double		interval;
-	unsigned	exp_status;
-	unsigned	window;
-	unsigned	threshold;
-	unsigned	initial;
+	unsigned			magic;
+#define VRT_BACKEND_PROBE_MAGIC		0x84998490
+	const char			*url;
+	const char			*request;
+	double				timeout;
+	double				interval;
+	unsigned			exp_status;
+	unsigned			window;
+	unsigned			threshold;
+	unsigned			initial;
 };
 
 /*
  * A backend is a host+port somewhere on the network
  */
 struct vrt_backend {
+	unsigned			magic;
+#define VRT_BACKEND_MAGIC		0x4799ce6b
 	const char			*vcl_name;
 	const char			*ipv4_addr;
 	const char			*ipv6_addr;
diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c
index f6026ef..800f3af 100644
--- a/lib/libvcc/vcc_backend.c
+++ b/lib/libvcc/vcc_backend.c
@@ -126,6 +126,7 @@ vcc_ParseProbeSpec(struct vcc *tl)
 	status = 0;
 	Fh(tl, 0, "static const struct vrt_backend_probe vgc_probe__%d = {\n",
 	    tl->nprobe++);
+	Fh(tl, 0, "\t.magic = VRT_BACKEND_PROBE_MAGIC,\n");
 	while (tl->t->tok != '}') {
 
 		vcc_IsField(tl, &t_field, fs);
@@ -305,6 +306,7 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be)
 	Fb(tl, 0, "\nstatic const struct vrt_backend vgc_dir_priv_%s = {\n",
 	    vgcname);
 
+	Fb(tl, 0, "\t.magic = VRT_BACKEND_MAGIC,\n");
 	Fb(tl, 0, "\t.vcl_name = \"%.*s", PF(t_be));
 	Fb(tl, 0, "\",\n");
 



More information about the varnish-commit mailing list