Commit f9c9db4a authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move struct vmod_data to VPI namespace

parent aa7295e5
...@@ -68,7 +68,7 @@ struct vmod { ...@@ -68,7 +68,7 @@ struct vmod {
static VTAILQ_HEAD(,vmod) vmods = VTAILQ_HEAD_INITIALIZER(vmods); static VTAILQ_HEAD(,vmod) vmods = VTAILQ_HEAD_INITIALIZER(vmods);
static unsigned 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) 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, ...@@ -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) const char *nm, const char *path, const char *file_id, const char *backup)
{ {
struct vmod *v; struct vmod *v;
const struct vmod_data *d; const struct vpi_vmod_data *d;
char buf[256]; char buf[256];
void *dlhdl; void *dlhdl;
......
...@@ -37,6 +37,25 @@ VCL_VCL VPI_vcl_get(VRT_CTX, const char *); ...@@ -37,6 +37,25 @@ VCL_VCL VPI_vcl_get(VRT_CTX, const char *);
void VPI_vcl_rel(VRT_CTX, VCL_VCL); void VPI_vcl_rel(VRT_CTX, VCL_VCL);
void VPI_vcl_select(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. * VPI_count() refers to this structure for coordinates into the VCL source.
*/ */
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
* binary/load-time compatible, increment MAJOR version * binary/load-time compatible, increment MAJOR version
* *
* unreleased (planned for 2019-09-15) * unreleased (planned for 2019-09-15)
* struct vmod_data moved to vcc_interface.h
* VRT_Vmod_{Init|Unload} moved to vcc_interface.h * VRT_Vmod_{Init|Unload} moved to vcc_interface.h
* VRT_count moved to vcc_interface.h * VRT_count moved to vcc_interface.h
* VRT_VCL_Busy() and VRT_VCL_Unbusy() added. * VRT_VCL_Busy() and VRT_VCL_Unbusy() added.
...@@ -270,25 +271,6 @@ struct vrt_ctx { ...@@ -270,25 +271,6 @@ struct vrt_ctx {
#define VRT_CTX const struct vrt_ctx *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 * Enum for events sent to compiled VCL and from there to Vmods
*/ */
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "vfil.h" #include "vfil.h"
#include "vjsn.h" #include "vjsn.h"
#include "vmod_abi.h" #include "vmod_abi.h"
#include "vcc_interface.h"
#include "vsb.h" #include "vsb.h"
static int static int
...@@ -162,7 +163,7 @@ vcc_ParseImport(struct vcc *tl) ...@@ -162,7 +163,7 @@ vcc_ParseImport(struct vcc *tl)
struct token *mod, *t1; struct token *mod, *t1;
struct inifin *ifp; struct inifin *ifp;
struct symbol *msym; struct symbol *msym;
const struct vmod_data *vmd; const struct vpi_vmod_data *vmd;
struct vjsn *vj; struct vjsn *vj;
int again = 0; int again = 0;
......
...@@ -1036,8 +1036,8 @@ class vcc(object): ...@@ -1036,8 +1036,8 @@ class vcc(object):
fo.write('\n') fo.write('\n')
for i in (714, 759, 765): for i in (714, 759, 765):
fo.write("/*lint -esym(%d, %s) */\n" % (i, vmd)) fo.write("/*lint -esym(%d, %s) */\n" % (i, vmd))
fo.write("\nextern const struct vmod_data %s;\n" % vmd) fo.write("\nextern const struct vpi_vmod_data %s;\n" % vmd)
fo.write("\nconst struct vmod_data %s = {\n" % vmd) fo.write("\nconst struct vpi_vmod_data %s = {\n" % vmd)
if self.strict_abi: if self.strict_abi:
fo.write("\t.vrt_major =\t0,\n") fo.write("\t.vrt_major =\t0,\n")
fo.write("\t.vrt_minor =\t0,\n") fo.write("\t.vrt_minor =\t0,\n")
...@@ -1067,7 +1067,7 @@ class vcc(object): ...@@ -1067,7 +1067,7 @@ class vcc(object):
fo.write('#include "config.h"\n') fo.write('#include "config.h"\n')
fo.write('#include <stdio.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('#include "%s.h"\n' % i)
fo.write("\n") fo.write("\n")
......
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