[master] f9c9db4a0 Move struct vmod_data to VPI namespace

Poul-Henning Kamp phk at FreeBSD.org
Mon May 6 09:14:08 UTC 2019


commit f9c9db4a0f18d740aa5f008074717affe4c6e0ef
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon May 6 09:13:29 2019 +0000

    Move struct vmod_data to VPI namespace

diff --git a/bin/varnishd/cache/cache_vrt_vmod.c b/bin/varnishd/cache/cache_vrt_vmod.c
index bfc9496c5..7f5df6066 100644
--- a/bin/varnishd/cache/cache_vrt_vmod.c
+++ b/bin/varnishd/cache/cache_vrt_vmod.c
@@ -68,7 +68,7 @@ struct vmod {
 static VTAILQ_HEAD(,vmod)	vmods = VTAILQ_HEAD_INITIALIZER(vmods);
 
 static unsigned
-vmod_abi_mismatch(const struct vmod_data *d)
+vmod_abi_mismatch(const struct vpi_vmod_data *d)
 {
 
 	if (d->vrt_major == 0 && d->vrt_minor == 0)
@@ -83,7 +83,7 @@ VPI_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;
+	const struct vpi_vmod_data *d;
 	char buf[256];
 	void *dlhdl;
 
diff --git a/include/vcc_interface.h b/include/vcc_interface.h
index 347c20077..a9224f3bc 100644
--- a/include/vcc_interface.h
+++ b/include/vcc_interface.h
@@ -37,6 +37,25 @@ VCL_VCL VPI_vcl_get(VRT_CTX, const char *);
 void VPI_vcl_rel(VRT_CTX, VCL_VCL);
 void VPI_vcl_select(VRT_CTX, VCL_VCL);
 
+/***********************************************************************
+ * This is the interface structure to a compiled VMOD
+ */
+
+struct vpi_vmod_data {
+	/* The version/id fields must be first, they protect the rest */
+	unsigned			vrt_major;
+	unsigned			vrt_minor;
+	const char			*file_id;
+
+	const char			*name;
+	const char			*func_name;
+	const void			*func;
+	int				func_len;
+	const char			*proto;
+	const char			*json;
+	const char			*abi;
+};
+
 /***********************************************************************
  * VPI_count() refers to this structure for coordinates into the VCL source.
  */
diff --git a/include/vrt.h b/include/vrt.h
index f5789e9e0..934443037 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -52,6 +52,7 @@
  * binary/load-time compatible, increment MAJOR version
  *
  * unreleased (planned for 2019-09-15)
+ *	struct vmod_data moved to vcc_interface.h
  *	VRT_Vmod_{Init|Unload} moved to vcc_interface.h
  *	VRT_count moved to vcc_interface.h
  *	VRT_VCL_Busy() and VRT_VCL_Unbusy() added.
@@ -270,25 +271,6 @@ struct vrt_ctx {
 
 #define VRT_CTX		const struct vrt_ctx *ctx
 
-/***********************************************************************
- * This is the interface structure to a compiled VMOD
- */
-
-struct vmod_data {
-	/* The version/id fields must be first, they protect the rest */
-	unsigned			vrt_major;
-	unsigned			vrt_minor;
-	const char			*file_id;
-
-	const char			*name;
-	const char			*func_name;
-	const void			*func;
-	int				func_len;
-	const char			*proto;
-	const char			*json;
-	const char			*abi;
-};
-
 /***********************************************************************
  * Enum for events sent to compiled VCL and from there to Vmods
  */
diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c
index 61380edf2..d11615ac2 100644
--- a/lib/libvcc/vcc_vmod.c
+++ b/lib/libvcc/vcc_vmod.c
@@ -38,6 +38,7 @@
 #include "vfil.h"
 #include "vjsn.h"
 #include "vmod_abi.h"
+#include "vcc_interface.h"
 #include "vsb.h"
 
 static int
@@ -162,7 +163,7 @@ vcc_ParseImport(struct vcc *tl)
 	struct token *mod, *t1;
 	struct inifin *ifp;
 	struct symbol *msym;
-	const struct vmod_data *vmd;
+	const struct vpi_vmod_data *vmd;
 	struct vjsn *vj;
 	int again = 0;
 
diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index 1b40b10b8..2d5c2d9cb 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -1036,8 +1036,8 @@ class vcc(object):
         fo.write('\n')
         for i in (714, 759, 765):
             fo.write("/*lint -esym(%d, %s) */\n" % (i, vmd))
-        fo.write("\nextern const struct vmod_data %s;\n" % vmd)
-        fo.write("\nconst struct vmod_data %s = {\n" % vmd)
+        fo.write("\nextern const struct vpi_vmod_data %s;\n" % vmd)
+        fo.write("\nconst struct vpi_vmod_data %s = {\n" % vmd)
         if self.strict_abi:
             fo.write("\t.vrt_major =\t0,\n")
             fo.write("\t.vrt_minor =\t0,\n")
@@ -1067,7 +1067,7 @@ class vcc(object):
 
         fo.write('#include "config.h"\n')
         fo.write('#include <stdio.h>\n')
-        for i in ["vdef", "vrt", self.pfx, "vmod_abi"]:
+        for i in ["vdef", "vrt", self.pfx, "vmod_abi", "vcc_interface"]:
             fo.write('#include "%s.h"\n' % i)
         fo.write("\n")
 


More information about the varnish-commit mailing list