[master] 793cbad Rename the internal "vev" API to a proper "VEV" prefix.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Nov 13 21:50:07 UTC 2017
commit 793cbad0c6f4d247c06bd592cc71768a6f6f06cf
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Nov 13 21:48:49 2017 +0000
Rename the internal "vev" API to a proper "VEV" prefix.
diff --git a/bin/varnishd/flint.lnt b/bin/varnishd/flint.lnt
index 3643b1b..7619b33 100644
--- a/bin/varnishd/flint.lnt
+++ b/bin/varnishd/flint.lnt
@@ -7,9 +7,6 @@
-printf(2, VSB_printf)
-esym(755, vct_*)
--esym(759, vev_*)
--esym(765, vev_*)
--esym(714, vev_*)
-esym(759, vpf_*)
-esym(765, vpf_*)
-esym(714, vpf_*)
diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index 92a6f6d..7949d2a 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -54,7 +54,7 @@ struct parspec;
struct vcc;
struct vclprog;
-extern struct vev_base *mgt_evb;
+extern struct vev_root *mgt_evb;
extern unsigned d_flag;
extern int exit_status;
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 6121ed2..7c9f3c0 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -221,7 +221,7 @@ static int __match_proto__(vev_cb_f)
child_listener(const struct vev *e, int what)
{
- if ((what & ~EV_RD) || VLU_Fd(child_std_vlu, child_output)) {
+ if ((what & ~VEV__RD) || VLU_Fd(child_std_vlu, child_output)) {
ev_listen = NULL;
if (e != NULL)
mgt_reap_child();
@@ -365,22 +365,22 @@ mgt_launch_child(struct cli *cli)
AN(child_std_vlu);
AZ(ev_listen);
- e = vev_new();
+ e = VEV_Alloc();
XXXAN(e);
e->fd = child_output;
- e->fd_flags = EV_RD;
+ e->fd_flags = VEV__RD;
e->name = "Child listener";
e->callback = child_listener;
- AZ(vev_add(mgt_evb, e));
+ AZ(VEV_Start(mgt_evb, e));
ev_listen = e;
AZ(ev_poker);
if (mgt_param.ping_interval > 0) {
- e = vev_new();
+ e = VEV_Alloc();
XXXAN(e);
e->timeout = mgt_param.ping_interval;
e->callback = child_poker;
e->name = "child poker";
- AZ(vev_add(mgt_evb, e));
+ AZ(VEV_Start(mgt_evb, e));
ev_poker = e;
}
@@ -439,14 +439,14 @@ mgt_reap_child(void)
/* Stop the poker */
if (ev_poker != NULL) {
- vev_del(mgt_evb, ev_poker);
+ VEV_Stop(mgt_evb, ev_poker);
free(ev_poker);
}
ev_poker = NULL;
/* Stop the listener */
if (ev_listen != NULL) {
- vev_del(mgt_evb, ev_listen);
+ VEV_Stop(mgt_evb, ev_listen);
free(ev_listen);
ev_listen = NULL;
}
@@ -522,7 +522,7 @@ mgt_reap_child(void)
child_state = CH_DIED;
/* Pick up any stuff lingering on stdout/stderr */
- (void)child_listener(NULL, EV_RD);
+ (void)child_listener(NULL, VEV__RD);
closefd(&child_output);
VLU_Destroy(&child_std_vlu);
diff --git a/bin/varnishd/mgt/mgt_cli.c b/bin/varnishd/mgt/mgt_cli.c
index a25cc92..37fe5ed 100644
--- a/bin/varnishd/mgt/mgt_cli.c
+++ b/bin/varnishd/mgt/mgt_cli.c
@@ -422,14 +422,14 @@ mgt_cli_setup(int fdi, int fdo, int auth, const char *ident,
AZ(VSB_finish(cli->sb));
(void)VCLI_WriteResult(fdo, cli->result, VSB_data(cli->sb));
- ev = vev_new();
+ ev = VEV_Alloc();
AN(ev);
ev->name = cli->ident;
ev->fd = fdi;
- ev->fd_flags = EV_RD;
+ ev->fd_flags = VEV__RD;
ev->callback = mgt_cli_callback2;
ev->priv = cli;
- AZ(vev_add(mgt_evb, ev));
+ AZ(VEV_Start(mgt_evb, ev));
}
/*--------------------------------------------------------------------*/
@@ -554,13 +554,13 @@ mct_callback(void *priv, const struct suckaddr *sa)
VTCP_myname(sock, abuf, sizeof abuf, pbuf, sizeof pbuf);
VSB_printf(vsb, "%s %s\n", abuf, pbuf);
tn = telnet_new(sock);
- tn->ev = vev_new();
+ tn->ev = VEV_Alloc();
AN(tn->ev);
tn->ev->fd = sock;
tn->ev->fd_flags = POLLIN;
tn->ev->callback = telnet_accept;
tn->ev->priv = tn;
- AZ(vev_add(mgt_evb, tn->ev));
+ AZ(VEV_Start(mgt_evb, tn->ev));
}
return (0);
}
@@ -663,14 +663,14 @@ Marg_poker(const struct vev *e, int what)
MCH_TrackHighFd(s);
- M_conn = vev_new();
+ M_conn = VEV_Alloc();
AN(M_conn);
M_conn->callback = Marg_connect;
M_conn->name = "-M connector";
- M_conn->fd_flags = EV_WR;
+ M_conn->fd_flags = VEV__WR;
M_conn->fd = s;
M_fd = s;
- AZ(vev_add(mgt_evb, M_conn));
+ AZ(VEV_Start(mgt_evb, M_conn));
return (0);
}
@@ -702,12 +702,12 @@ mgt_cli_master(const char *M_arg)
if (VTAILQ_EMPTY(&m_addr_list))
ARGV_ERR("Could not resolve -M argument to address\n");
AZ(M_poker);
- M_poker = vev_new();
+ M_poker = VEV_Alloc();
AN(M_poker);
M_poker->timeout = M_poll;
M_poker->callback = Marg_poker;
M_poker->name = "-M poker";
- AZ(vev_add(mgt_evb, M_poker));
+ AZ(VEV_Start(mgt_evb, M_poker));
}
static int
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 39f1059..c4f9d94 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -61,7 +61,7 @@
struct heritage heritage;
unsigned d_flag = 0;
-struct vev_base *mgt_evb;
+struct vev_root *mgt_evb;
int exit_status = 0;
struct vsb *vident;
struct VSC_mgt *VSC_C_mgt;
@@ -563,7 +563,7 @@ main(int argc, char * const *argv)
/* Various initializations */
VTAILQ_INIT(&heritage.socks);
- mgt_evb = vev_new_base();
+ mgt_evb = VEV_New();
AN(mgt_evb);
/* Initialize transport protocols */
@@ -845,10 +845,10 @@ main(int argc, char * const *argv)
fprintf(stderr, "BEGIN of -I file processing\n");
mgt_cli_setup(I_fd, 2, 1, "-I file", mgt_I_close, stderr);
while (I_fd >= 0) {
- o = vev_schedule_one(mgt_evb);
+ o = VEV_Once(mgt_evb);
if (o != 1)
MGT_Complain(C_ERR,
- "vev_schedule_one() = %d", o);
+ "VEV_Once() = %d", o);
}
}
@@ -871,30 +871,30 @@ main(int argc, char * const *argv)
if (F_flag)
VFIL_null_fd(STDIN_FILENO);
- e = vev_new();
+ e = VEV_Alloc();
AN(e);
e->callback = mgt_uptime;
e->timeout = 1.0;
e->name = "mgt_uptime";
- AZ(vev_add(mgt_evb, e));
+ AZ(VEV_Start(mgt_evb, e));
- e = vev_new();
+ e = VEV_Alloc();
AN(e);
e->sig = SIGTERM;
e->callback = mgt_sigint;
e->name = "mgt_sigterm";
- AZ(vev_add(mgt_evb, e));
+ AZ(VEV_Start(mgt_evb, e));
- e = vev_new();
+ e = VEV_Alloc();
AN(e);
e->sig = SIGINT;
e->callback = mgt_sigint;
e->name = "mgt_sigint";
- AZ(vev_add(mgt_evb, e));
+ AZ(VEV_Start(mgt_evb, e));
- o = vev_schedule(mgt_evb);
+ o = VEV_Loop(mgt_evb);
if (o != 0)
- MGT_Complain(C_ERR, "vev_schedule() = %d", o);
+ MGT_Complain(C_ERR, "VEV_Loop() = %d", o);
MGT_Complain(C_INFO, "manager dies");
(void)VPF_Remove(pfh1);
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 8a879ab..d2428b3 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -917,13 +917,13 @@ void
mgt_vcl_init(void)
{
- e_poker = vev_new();
+ e_poker = VEV_Alloc();
AN(e_poker);
e_poker->timeout = 3; // random, prime
e_poker->callback = mgt_vcl_poker;
e_poker->name = "vcl poker";
- AZ(vev_add(mgt_evb, e_poker));
+ AZ(VEV_Start(mgt_evb, e_poker));
AZ(atexit(mgt_vcl_atexit));
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 96ebaec..0d4982d 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -81,7 +81,7 @@ unsigned vtc_maxdur = 60;
static unsigned vtc_bufsiz = 1024 * 1024;
static VTAILQ_HEAD(, vtc_tst) tst_head = VTAILQ_HEAD_INITIALIZER(tst_head);
-static struct vev_base *vb;
+static struct vev_root *vb;
static int njob = 0;
static int npar = 1; /* Number of parallel tests */
static int vtc_continue; /* Continue on error */
@@ -167,7 +167,7 @@ tst_cb(const struct vev *ve, int what)
jp->killed = 1;
AZ(kill(-jp->child, SIGKILL)); /* XXX: Timeout */
} else {
- assert(what & (EV_RD | EV_HUP));
+ assert(what & (VEV__RD | VEV__HUP));
}
*buf = '\0';
@@ -241,7 +241,7 @@ tst_cb(const struct vev *ve, int what)
ecode ? "skipped" : "passed", t);
}
if (jp->evt != NULL)
- vev_del(vb, jp->evt);
+ VEV_Stop(vb, jp->evt);
FREE_OBJ(jp);
return (1);
@@ -309,21 +309,21 @@ start_test(void)
}
closefd(&p[1]);
- jp->ev = vev_new();
+ jp->ev = VEV_Alloc();
AN(jp->ev);
- jp->ev->fd_flags = EV_RD | EV_HUP | EV_ERR;
+ jp->ev->fd_flags = VEV__RD | VEV__HUP | VEV__ERR;
jp->ev->fd = p[0];
jp->ev->priv = jp;
jp->ev->callback = tst_cb;
- AZ(vev_add(vb, jp->ev));
+ AZ(VEV_Start(vb, jp->ev));
- jp->evt = vev_new();
+ jp->evt = VEV_Alloc();
AN(jp->evt);
jp->evt->fd = -1;
jp->evt->timeout = vtc_maxdur;
jp->evt->priv = jp;
jp->evt->callback = tst_cb;
- AZ(vev_add(vb, jp->evt));
+ AZ(VEV_Start(vb, jp->evt));
}
/**********************************************************************
@@ -666,7 +666,7 @@ main(int argc, char * const *argv)
if (iflg)
i_mode();
- vb = vev_new_base();
+ vb = VEV_New();
i = 0;
while (!VTAILQ_EMPTY(&tst_head) || i) {
@@ -679,7 +679,7 @@ main(int argc, char * const *argv)
i = 1;
continue;
}
- i = vev_schedule_one(vb);
+ i = VEV_Once(vb);
}
if (vtc_continue)
fprintf(stderr,
diff --git a/include/vev.h b/include/vev.h
index 47fd050..0c92f4b 100644
--- a/include/vev.h
+++ b/include/vev.h
@@ -29,7 +29,7 @@
*/
struct vev;
-struct vev_base;
+struct vev_root;
typedef int vev_cb_f(const struct vev *, int what);
@@ -42,11 +42,11 @@ struct vev {
int fd;
unsigned fd_flags;
unsigned fd_events;
-#define EV_RD POLLIN
-#define EV_WR POLLOUT
-#define EV_ERR POLLERR
-#define EV_HUP POLLHUP
-#define EV_SIG -1
+#define VEV__RD POLLIN
+#define VEV__WR POLLOUT
+#define VEV__ERR POLLERR
+#define VEV__HUP POLLHUP
+#define VEV__SIG -1
int sig;
unsigned sig_flags;
double timeout;
@@ -57,16 +57,16 @@ struct vev {
double __when;
unsigned __binheap_idx;
unsigned __privflags;
- struct vev_base *__vevb;
+ struct vev_root *__vevb;
};
-struct vev_base *vev_new_base(void);
-void vev_destroy_base(struct vev_base *evb);
+struct vev_root *VEV_New(void);
+void VEV_Destroy(struct vev_root *evb);
-struct vev *vev_new(void);
+struct vev *VEV_Alloc(void);
-int vev_add(struct vev_base *evb, struct vev *e);
-void vev_del(struct vev_base *evb, struct vev *e);
+int VEV_Start(struct vev_root *evb, struct vev *e);
+void VEV_Stop(struct vev_root *evb, struct vev *e);
-int vev_schedule_one(struct vev_base *evb);
-int vev_schedule(struct vev_base *evb);
+int VEV_Once(struct vev_root *evb);
+int VEV_Loop(struct vev_root *evb);
diff --git a/lib/libvarnish/vev.c b/lib/libvarnish/vev.c
index 88f7057..b8f3078 100644
--- a/lib/libvarnish/vev.c
+++ b/lib/libvarnish/vev.c
@@ -54,7 +54,7 @@
#endif
struct vevsig {
- struct vev_base *vevb;
+ struct vev_root *vevb;
struct vev *vev;
struct sigaction sigact;
unsigned char happened;
@@ -63,7 +63,7 @@ struct vevsig {
static struct vevsig *vev_sigs;
static int vev_nsig;
-struct vev_base {
+struct vev_root {
unsigned magic;
#define VEV_BASE_MAGIC 0x477bcf3d
struct pollfd *pfd;
@@ -95,7 +95,7 @@ struct vev_base {
static void __match_proto__(binheap_update_t)
vev_bh_update(void *priv, void *a, unsigned u)
{
- struct vev_base *evb;
+ struct vev_root *evb;
struct vev *e;
CAST_OBJ_NOTNULL(evb, priv, VEV_BASE_MAGIC);
@@ -106,14 +106,14 @@ vev_bh_update(void *priv, void *a, unsigned u)
evb->pev[u] = e;
evb->pfd[u].fd = e->fd;
evb->pfd[u].events =
- e->fd_flags & (EV_RD|EV_WR|EV_ERR|EV_HUP);
+ e->fd_flags & (VEV__RD|VEV__WR|VEV__ERR|VEV__HUP);
}
}
static int __match_proto__(binheap_cmp_t)
vev_bh_cmp(void *priv, const void *a, const void *b)
{
- struct vev_base *evb;
+ struct vev_root *evb;
const struct vev *ea, *eb;
CAST_OBJ_NOTNULL(evb, priv, VEV_BASE_MAGIC);
@@ -125,7 +125,7 @@ vev_bh_cmp(void *priv, const void *a, const void *b)
/*--------------------------------------------------------------------*/
static int
-vev_get_pfd(struct vev_base *evb)
+vev_get_pfd(struct vev_root *evb)
{
unsigned u;
@@ -187,10 +187,10 @@ vev_sighandler(int sig)
/*--------------------------------------------------------------------*/
-struct vev_base *
-vev_new_base(void)
+struct vev_root *
+VEV_New(void)
{
- struct vev_base *evb;
+ struct vev_root *evb;
evb = calloc(1, sizeof *evb);
if (evb == NULL)
@@ -215,7 +215,7 @@ vev_new_base(void)
/*--------------------------------------------------------------------*/
void
-vev_destroy_base(struct vev_base *evb)
+VEV_Destroy(struct vev_root *evb)
{
CHECK_OBJ_NOTNULL(evb, VEV_BASE_MAGIC);
assert(evb->thread == pthread_self());
@@ -226,7 +226,7 @@ vev_destroy_base(struct vev_base *evb)
/*--------------------------------------------------------------------*/
struct vev *
-vev_new(void)
+VEV_Alloc(void)
{
struct vev *e;
@@ -240,7 +240,7 @@ vev_new(void)
/*--------------------------------------------------------------------*/
int
-vev_add(struct vev_base *evb, struct vev *e)
+VEV_Start(struct vev_root *evb, struct vev *e)
{
struct vevsig *es;
@@ -298,7 +298,7 @@ vev_add(struct vev_base *evb, struct vev *e)
/*--------------------------------------------------------------------*/
void
-vev_del(struct vev_base *evb, struct vev *e)
+VEV_Stop(struct vev_root *evb, struct vev *e)
{
struct vevsig *es;
@@ -334,14 +334,14 @@ vev_del(struct vev_base *evb, struct vev *e)
/*--------------------------------------------------------------------*/
int
-vev_schedule(struct vev_base *evb)
+VEV_Loop(struct vev_root *evb)
{
int i;
CHECK_OBJ_NOTNULL(evb, VEV_BASE_MAGIC);
assert(evb->thread == pthread_self());
do
- i = vev_schedule_one(evb);
+ i = VEV_Once(evb);
while (i == 1);
return (i);
}
@@ -349,14 +349,14 @@ vev_schedule(struct vev_base *evb)
/*--------------------------------------------------------------------*/
static int
-vev_sched_timeout(struct vev_base *evb, struct vev *e, double t)
+vev_sched_timeout(struct vev_root *evb, struct vev *e, double t)
{
int i;
i = e->callback(e, 0);
if (i) {
- vev_del(evb, e);
+ VEV_Stop(evb, e);
free(e);
} else {
e->__when = t + e->timeout;
@@ -367,7 +367,7 @@ vev_sched_timeout(struct vev_base *evb, struct vev *e, double t)
}
static int
-vev_sched_signal(struct vev_base *evb)
+vev_sched_signal(struct vev_root *evb)
{
int i, j;
struct vevsig *es;
@@ -381,9 +381,9 @@ vev_sched_signal(struct vev_base *evb)
es->happened = 0;
e = es->vev;
assert(e != NULL);
- i = e->callback(e, EV_SIG);
+ i = e->callback(e, VEV__SIG);
if (i) {
- vev_del(evb, e);
+ VEV_Stop(evb, e);
free(e);
}
}
@@ -391,7 +391,7 @@ vev_sched_signal(struct vev_base *evb)
}
int
-vev_schedule_one(struct vev_base *evb)
+VEV_Once(struct vev_root *evb)
{
double t;
struct vev *e;
@@ -451,7 +451,7 @@ vev_schedule_one(struct vev_base *evb)
e->fd_events = 0;
i--;
if (k) {
- vev_del(evb, e);
+ VEV_Stop(evb, e);
free(e);
}
}
More information about the varnish-commit
mailing list