[master] aa7295e51 Move VRT_Vmod_{Init|Unload} To VPI

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


commit aa7295e51762f7f9ad42f71ab2ca536289a78ba0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon May 6 09:02:59 2019 +0000

    Move VRT_Vmod_{Init|Unload} To VPI
    
    Relevant to #2800

diff --git a/bin/varnishd/cache/cache_vrt_vmod.c b/bin/varnishd/cache/cache_vrt_vmod.c
index fd8031149..bfc9496c5 100644
--- a/bin/varnishd/cache/cache_vrt_vmod.c
+++ b/bin/varnishd/cache/cache_vrt_vmod.c
@@ -38,6 +38,7 @@
 #include <stdlib.h>
 
 #include "vcli_serve.h"
+#include "vcc_interface.h"
 #include "vmod_abi.h"
 
 /*--------------------------------------------------------------------
@@ -78,7 +79,7 @@ vmod_abi_mismatch(const struct vmod_data *d)
 }
 
 int
-VRT_Vmod_Init(VRT_CTX, struct vmod **hdl, unsigned nbr, void *ptr, int len,
+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;
@@ -162,7 +163,7 @@ VRT_Vmod_Init(VRT_CTX, struct vmod **hdl, unsigned nbr, void *ptr, int len,
 }
 
 void
-VRT_Vmod_Unload(VRT_CTX, struct vmod **hdl)
+VPI_Vmod_Unload(VRT_CTX, struct vmod **hdl)
 {
 	struct vmod *v;
 
diff --git a/include/vcc_interface.h b/include/vcc_interface.h
index cf1845a8d..347c20077 100644
--- a/include/vcc_interface.h
+++ b/include/vcc_interface.h
@@ -50,3 +50,8 @@ struct vpi_ref {
 };
 
 void VPI_count(VRT_CTX, unsigned);
+
+int 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);
+void VPI_Vmod_Unload(VRT_CTX, struct vmod **hdl);
+
diff --git a/include/vrt.h b/include/vrt.h
index f83218efa..f5789e9e0 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -52,6 +52,8 @@
  * binary/load-time compatible, increment MAJOR version
  *
  * unreleased (planned for 2019-09-15)
+ *	VRT_Vmod_{Init|Unload} moved to vcc_interface.h
+ *	VRT_count moved to vcc_interface.h
  *	VRT_VCL_Busy() and VRT_VCL_Unbusy() added.
  *	VRT_vcl_get moved to vcc_interface.h
  *	VRT_vcl_rel emoved to vcc_interface.h
@@ -511,11 +513,6 @@ void VRT_DelDirector(VCL_BACKEND *);
 /* Suckaddr related */
 int VRT_VSA_GetPtr(VCL_IP sua, const unsigned char ** dst);
 
-/* VMOD/Modules related */
-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_Unload(VRT_CTX, struct vmod **hdl);
-
 typedef int vmod_event_f(VRT_CTX, struct vmod_priv *, enum vcl_event_e);
 
 typedef void vmod_priv_free_f(void *);
diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c
index a455bbb8e..61380edf2 100644
--- a/lib/libvcc/vcc_vmod.c
+++ b/lib/libvcc/vcc_vmod.c
@@ -303,7 +303,7 @@ vcc_ParseImport(struct vcc *tl)
 
 	ifp = New_IniFin(tl);
 
-	VSB_printf(ifp->ini, "\tif (VRT_Vmod_Init(ctx,\n");
+	VSB_printf(ifp->ini, "\tif (VPI_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    &%s,\n", vmd->func_name);
@@ -326,7 +326,7 @@ vcc_ParseImport(struct vcc *tl)
 	/* XXX: zero the function pointer structure ?*/
 	VSB_printf(ifp->fin, "\t\tVRT_priv_fini(&vmod_priv_%.*s);", PF(mod));
 	VSB_printf(ifp->final,
-	    "\t\tVRT_Vmod_Unload(ctx, &VGC_vmod_%.*s);", PF(mod));
+	    "\t\tVPI_Vmod_Unload(ctx, &VGC_vmod_%.*s);", PF(mod));
 
 	vj = vjsn_parse(vmd->json, &p);
 	XXXAZ(p);


More information about the varnish-commit mailing list