Commit 967af895 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Pass struct req into VCL methods

parent 3cea8945
......@@ -191,7 +191,7 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
REPLACE(vcl->name, name);
VCLI_Out(cli, "Loaded \"%s\" as \"%s\"", fn , name);
VTAILQ_INSERT_TAIL(&vcl_head, vcl, list);
(void)vcl->conf->init_func(NULL);
(void)vcl->conf->init_func(NULL, NULL);
Lck_Lock(&vcl_mtx);
if (vcl_active == NULL)
vcl_active = vcl;
......@@ -215,7 +215,7 @@ VCL_Nuke(struct vcls *vcl)
assert(vcl->conf->discard);
assert(vcl->conf->busy == 0);
VTAILQ_REMOVE(&vcl_head, vcl, list);
(void)vcl->conf->fini_func(NULL);
(void)vcl->conf->fini_func(NULL, NULL);
vcl->conf->fini_vcl(NULL);
free(vcl->name);
(void)dlclose(vcl->dlh);
......@@ -344,7 +344,7 @@ VCL_##func##_method(struct req *req) \
req->handling = 0; \
req->cur_method = VCL_MET_ ## upper; \
VSLb(req->vsl, SLT_VCL_call, "%s", #func); \
(void)req->vcl->func##_func(req->sp); \
(void)req->vcl->func##_func(req->sp, req); \
VSLb(req->vsl, SLT_VCL_return, "%s", \
VCL_Return_Name(req->handling)); \
req->cur_method = 0; \
......
......@@ -716,11 +716,12 @@ file_header(fo)
fo.write("""
struct sess;
struct req;
struct cli;
typedef int vcl_init_f(struct cli *);
typedef void vcl_fini_f(struct cli *);
typedef int vcl_func_f(struct sess *sp);
typedef int vcl_func_f(struct sess *sp, struct req *req);
""")
......
......@@ -670,7 +670,7 @@ vcc_CompileSource(const struct vcc *tl0, struct vsb *sb, struct source *sp)
/* Emit method functions */
for (i = 0; i < VCL_MET_MAX; i++) {
Fc(tl, 1, "\nstatic int\n");
Fc(tl, 1, "VGC_function_%s (struct sess *sp)\n",
Fc(tl, 1, "VGC_function_%s(struct sess *sp, struct req *req)\n",
method_tab[i].name);
AZ(VSB_finish(tl->fm[i]));
Fc(tl, 1, "{\n");
......
......@@ -224,10 +224,13 @@ vcc_Function(struct vcc *tl)
return;
}
tl->curproc = vcc_AddProc(tl, tl->t);
Fh(tl, 0, "static int VGC_function_%.*s (struct sess *sp);\n",
Fh(tl, 0, "static int VGC_function_%.*s "
"(struct sess *, struct req *);\n",
PF(tl->t));
Fc(tl, 1, "\nstatic int\n");
Fc(tl, 1, "VGC_function_%.*s (struct sess *sp)\n", PF(tl->t));
Fc(tl, 1, "VGC_function_%.*s"
"(struct sess *sp, struct req *req)\n",
PF(tl->t));
}
vcc_NextToken(tl);
tl->indent += INDENT;
......
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