Commit 73fd9d73 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Register the vmods unique (per-vcl) number

parent 399bc4c1
......@@ -53,6 +53,7 @@ struct vmod {
int ref;
char *nm;
unsigned nbr;
char *path;
char *backup;
void *hdl;
......@@ -77,8 +78,8 @@ vmod_abi_mismatch(const struct vmod_data *d)
}
int
VRT_Vmod_Init(VRT_CTX, struct vmod **hdl, void *ptr, int len, const char *nm,
const char *path, const char *file_id, const char *backup)
VRT_Vmod_Init(VRT_CTX, struct vmod **hdl, unsigned nbr, void *ptr, int len,
const char *nm, const char *path, const char *file_id, const char *backup)
{
struct vmod *v;
const struct vmod_data *d;
......@@ -138,6 +139,7 @@ VRT_Vmod_Init(VRT_CTX, struct vmod **hdl, void *ptr, int len, const char *nm,
return (1);
}
v->nbr = nbr;
v->funclen = d->func_len;
v->funcs = d->func;
v->abi = d->abi;
......
......@@ -58,6 +58,7 @@
* VRT_CollectStrands() added
* VRT_STRANDS_string() removed from vrt.h (never implemented)
* VRT_Healthy() changed prototype
* VRT_Vmod_Init signature changed
* 7.0 (2018-03-15)
* lots of stuff moved from cache.h to cache_varnishd.h
* (ie: from "$Abi vrt" to "$Abi strict")
......@@ -471,7 +472,7 @@ void VRT_DelDirector(VCL_BACKEND *);
int VRT_VSA_GetPtr(const struct suckaddr *sua, const unsigned char ** dst);
/* VMOD/Modules related */
int VRT_Vmod_Init(VRT_CTX, struct vmod **hdl, void *ptr, int len,
int VRT_Vmod_Init(VRT_CTX, struct vmod **hdl, unsigned nbr, void *ptr, int len,
const char *nm, const char *path, const char *file_id, const char *backup);
void VRT_Vmod_Fini(struct vmod **hdl);
......
......@@ -305,6 +305,7 @@ vcc_ParseImport(struct vcc *tl)
VSB_printf(ifp->ini, "\tif (VRT_Vmod_Init(ctx,\n");
VSB_printf(ifp->ini, "\t &VGC_vmod_%.*s,\n", PF(mod));
VSB_printf(ifp->ini, "\t %u,\n", tl->vmod_count++);
VSB_printf(ifp->ini, "\t &Vmod_%.*s_Func,\n", PF(mod));
VSB_printf(ifp->ini, "\t sizeof(Vmod_%.*s_Func),\n", PF(mod));
VSB_printf(ifp->ini, "\t \"%.*s\",\n", PF(mod));
......@@ -336,7 +337,6 @@ vcc_ParseImport(struct vcc *tl)
vcc_json_always(tl, msym);
Fh(tl, 0, "\n/* --- BEGIN VMOD %.*s --- */\n\n", PF(mod));
Fh(tl, 0, "#define VMOD_NUMBER_%.*s %u\n", PF(mod), tl->vmod_count++);
Fh(tl, 0, "static struct vmod *VGC_vmod_%.*s;\n", PF(mod));
Fh(tl, 0, "static struct vmod_priv vmod_priv_%.*s;\n", PF(mod));
Fh(tl, 0, "\n%s\n", vmd->proto);
......
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