[6.0] 240a3d1aa Register the vmods unique (per-vcl) number
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:07 UTC 2018
commit 240a3d1aa1d61b511f38c2ecb724805b77ffe773
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Aug 23 08:08:17 2018 +0000
Register the vmods unique (per-vcl) number
Conflicts:
include/vrt.h
This appears to break the VRT interface, but there are symbols we are
willing to break even on a stable branch because they are needed by
VCC-generated code and off limits to inline C and VMODs.
Refs #2800
diff --git a/bin/varnishd/cache/cache_vrt_vmod.c b/bin/varnishd/cache/cache_vrt_vmod.c
index ffd039ebc..25a119da4 100644
--- a/bin/varnishd/cache/cache_vrt_vmod.c
+++ b/bin/varnishd/cache/cache_vrt_vmod.c
@@ -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;
diff --git a/include/vrt.h b/include/vrt.h
index 936aa207f..2fc7c60cc 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -423,7 +423,7 @@ int VRT_Healthy(VRT_CTX, 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);
diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c
index a9cef1d71..fd6a7acc6 100644
--- a/lib/libvcc/vcc_vmod.c
+++ b/lib/libvcc/vcc_vmod.c
@@ -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);
More information about the varnish-commit
mailing list