[6.0] 67ca3d891 Assign VMODS unique numbers, and make the count part of the VGC metadata
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:07 UTC 2018
commit 67ca3d891b0229cbf7067380ee4f4e8df42a011c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Aug 23 07:19:09 2018 +0000
Assign VMODS unique numbers, and make the count part of the VGC metadata
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index ee49f55e4..4fc532138 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -666,6 +666,8 @@ struct VCL_conf {
const char **srcname;
const char **srcbody;
+ unsigned nvmod;
+
vcl_event_f *event_vcl;
""")
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index 69a2db9c8..a7dfc98d3 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -424,6 +424,7 @@ EmitStruct(const struct vcc *tl)
Fc(tl, 0, "\t.nsrc = VGC_NSRCS,\n");
Fc(tl, 0, "\t.srcname = srcname,\n");
Fc(tl, 0, "\t.srcbody = srcbody,\n");
+ Fc(tl, 0, "\t.nvmod = %u,\n", tl->vmod_count);
#define VCL_MET_MAC(l,u,t,b) \
Fc(tl, 0, "\t." #l "_func = VGC_function_vcl_" #l ",\n");
#include "tbl/vcl_returns.h"
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index 01f2d92c0..befc15a94 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -252,7 +252,7 @@ struct vcc {
const char *default_probe;
unsigned unique;
-
+ unsigned vmod_count;
};
struct method {
diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c
index f34b0f3b1..a9cef1d71 100644
--- a/lib/libvcc/vcc_vmod.c
+++ b/lib/libvcc/vcc_vmod.c
@@ -336,6 +336,7 @@ 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