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

Rename VCL_EVENT_* to match the CLI commands

parent 017278ba
...@@ -217,9 +217,9 @@ VCL_Load(const char *fn, const char *name, struct cli *cli) ...@@ -217,9 +217,9 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
ctx.cli = cli; ctx.cli = cli;
ctx.vcl = vcl->conf; ctx.vcl = vcl->conf;
if (vcl->conf->event_vcl(&ctx, VCL_EVENT_INIT)) { if (vcl->conf->event_vcl(&ctx, VCL_EVENT_LOAD)) {
VCLI_Out(cli, "VCL \"%s\" Failed to initialize", name); VCLI_Out(cli, "VCL \"%s\" Failed to initialize", name);
AZ(vcl->conf->event_vcl(&ctx, VCL_EVENT_FINI)); AZ(vcl->conf->event_vcl(&ctx, VCL_EVENT_DISCARD));
(void)dlclose(vcl->dlh); (void)dlclose(vcl->dlh);
FREE_OBJ(vcl); FREE_OBJ(vcl);
return (1); return (1);
...@@ -229,7 +229,7 @@ VCL_Load(const char *fn, const char *name, struct cli *cli) ...@@ -229,7 +229,7 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
VCLI_Out(cli, "VCL \"%s\" vcl_init{} failed", name); VCLI_Out(cli, "VCL \"%s\" vcl_init{} failed", name);
ctx.method = VCL_MET_FINI; ctx.method = VCL_MET_FINI;
(void)vcl->conf->fini_func(&ctx); (void)vcl->conf->fini_func(&ctx);
AZ(vcl->conf->event_vcl(&ctx, VCL_EVENT_FINI)); AZ(vcl->conf->event_vcl(&ctx, VCL_EVENT_DISCARD));
(void)dlclose(vcl->dlh); (void)dlclose(vcl->dlh);
FREE_OBJ(vcl); FREE_OBJ(vcl);
return (1); return (1);
...@@ -268,7 +268,7 @@ VCL_Nuke(struct vcls *vcl) ...@@ -268,7 +268,7 @@ VCL_Nuke(struct vcls *vcl)
ctx.vcl = vcl->conf; ctx.vcl = vcl->conf;
(void)vcl->conf->fini_func(&ctx); (void)vcl->conf->fini_func(&ctx);
assert(hand == VCL_RET_OK); assert(hand == VCL_RET_OK);
AZ(vcl->conf->event_vcl(&ctx, VCL_EVENT_FINI)); AZ(vcl->conf->event_vcl(&ctx, VCL_EVENT_DISCARD));
free(vcl->conf->loaded_name); free(vcl->conf->loaded_name);
(void)dlclose(vcl->dlh); (void)dlclose(vcl->dlh);
FREE_OBJ(vcl); FREE_OBJ(vcl);
...@@ -360,7 +360,7 @@ ccf_config_use(struct cli *cli, const char * const *av, void *priv) ...@@ -360,7 +360,7 @@ ccf_config_use(struct cli *cli, const char * const *av, void *priv)
INIT_OBJ(&ctx, VRT_CTX_MAGIC); INIT_OBJ(&ctx, VRT_CTX_MAGIC);
ctx.handling = &hand; ctx.handling = &hand;
ctx.cli = cli; ctx.cli = cli;
if (vcl->conf->event_vcl(&ctx, VCL_EVENT_ACTIVATE)) { if (vcl->conf->event_vcl(&ctx, VCL_EVENT_USE)) {
VCLI_Out(cli, "VCL \"%s\" Failed to activate", av[2]); VCLI_Out(cli, "VCL \"%s\" Failed to activate", av[2]);
VCLI_SetResult(cli, CLIS_CANT); VCLI_SetResult(cli, CLIS_CANT);
return; return;
......
...@@ -946,9 +946,9 @@ struct cli; ...@@ -946,9 +946,9 @@ struct cli;
struct worker; struct worker;
enum vcl_event_e { enum vcl_event_e {
VCL_EVENT_INIT, VCL_EVENT_LOAD,
VCL_EVENT_ACTIVATE, VCL_EVENT_USE,
VCL_EVENT_FINI, VCL_EVENT_DISCARD,
}; };
typedef int vcl_event_f(VRT_CTX, enum vcl_event_e); typedef int vcl_event_f(VRT_CTX, enum vcl_event_e);
......
...@@ -434,7 +434,7 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be) ...@@ -434,7 +434,7 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be)
"\tVRT_fini_vbe(ctx, &VGCDIR(%s), &vgc_dir_priv_%s);", "\tVRT_fini_vbe(ctx, &VGCDIR(%s), &vgc_dir_priv_%s);",
vgcname, vgcname); vgcname, vgcname);
VSB_printf(ifp->event, VSB_printf(ifp->event,
"\tif (ev == VCL_EVENT_ACTIVATE)\n" "\tif (ev == VCL_EVENT_USE)\n"
"\t\tVRT_use_vbe(ctx, VGCDIR(%s), &vgc_dir_priv_%s);", "\t\tVRT_use_vbe(ctx, VGCDIR(%s), &vgc_dir_priv_%s);",
vgcname, vgcname); vgcname, vgcname);
tl->ndirector++; tl->ndirector++;
......
...@@ -344,9 +344,9 @@ EmitInitFini(const struct vcc *tl) ...@@ -344,9 +344,9 @@ EmitInitFini(const struct vcc *tl)
Fc(tl, 0, "\nstatic int\n"); Fc(tl, 0, "\nstatic int\n");
Fc(tl, 0, "VGC_Event(VRT_CTX, enum vcl_event_e ev)\n"); Fc(tl, 0, "VGC_Event(VRT_CTX, enum vcl_event_e ev)\n");
Fc(tl, 0, "{\n"); Fc(tl, 0, "{\n");
Fc(tl, 0, "\tif (ev == VCL_EVENT_INIT)\n"); Fc(tl, 0, "\tif (ev == VCL_EVENT_LOAD)\n");
Fc(tl, 0, "\t\treturn(VGC_Init(ctx));\n"); Fc(tl, 0, "\t\treturn(VGC_Init(ctx));\n");
Fc(tl, 0, "\tif (ev == VCL_EVENT_FINI)\n"); Fc(tl, 0, "\tif (ev == VCL_EVENT_DISCARD)\n");
Fc(tl, 0, "\t\treturn(VGC_Fini(ctx));\n"); Fc(tl, 0, "\t\treturn(VGC_Fini(ctx));\n");
Fc(tl, 0, "\t\n"); Fc(tl, 0, "\t\n");
VTAILQ_FOREACH(p, &tl->inifin, list) { VTAILQ_FOREACH(p, &tl->inifin, list) {
......
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