Commit 5dd5f9dd authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Miniobj-ify the compiled backend and probe structs

parent 93b6da19
...@@ -140,6 +140,8 @@ extern const void * const vrt_magic_string_end; ...@@ -140,6 +140,8 @@ extern const void * const vrt_magic_string_end;
extern const void * const vrt_magic_string_unset; extern const void * const vrt_magic_string_unset;
struct vrt_backend_probe { struct vrt_backend_probe {
unsigned magic;
#define VRT_BACKEND_PROBE_MAGIC 0x84998490
const char *url; const char *url;
const char *request; const char *request;
double timeout; double timeout;
...@@ -154,6 +156,8 @@ struct vrt_backend_probe { ...@@ -154,6 +156,8 @@ struct vrt_backend_probe {
* A backend is a host+port somewhere on the network * A backend is a host+port somewhere on the network
*/ */
struct vrt_backend { struct vrt_backend {
unsigned magic;
#define VRT_BACKEND_MAGIC 0x4799ce6b
const char *vcl_name; const char *vcl_name;
const char *ipv4_addr; const char *ipv4_addr;
const char *ipv6_addr; const char *ipv6_addr;
......
...@@ -126,6 +126,7 @@ vcc_ParseProbeSpec(struct vcc *tl) ...@@ -126,6 +126,7 @@ vcc_ParseProbeSpec(struct vcc *tl)
status = 0; status = 0;
Fh(tl, 0, "static const struct vrt_backend_probe vgc_probe__%d = {\n", Fh(tl, 0, "static const struct vrt_backend_probe vgc_probe__%d = {\n",
tl->nprobe++); tl->nprobe++);
Fh(tl, 0, "\t.magic = VRT_BACKEND_PROBE_MAGIC,\n");
while (tl->t->tok != '}') { while (tl->t->tok != '}') {
vcc_IsField(tl, &t_field, fs); vcc_IsField(tl, &t_field, fs);
...@@ -305,6 +306,7 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be) ...@@ -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", Fb(tl, 0, "\nstatic const struct vrt_backend vgc_dir_priv_%s = {\n",
vgcname); vgcname);
Fb(tl, 0, "\t.magic = VRT_BACKEND_MAGIC,\n");
Fb(tl, 0, "\t.vcl_name = \"%.*s", PF(t_be)); Fb(tl, 0, "\t.vcl_name = \"%.*s", PF(t_be));
Fb(tl, 0, "\",\n"); Fb(tl, 0, "\",\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment