[master] 9c86e0b Namespace cleanup of the VSM related varnishapi functions
Poul-Henning Kamp
phk at varnish-cache.org
Tue May 31 13:15:04 CEST 2011
commit 9c86e0b0666bb90712071617557df4ae8b7c5a45
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue May 31 10:13:36 2011 +0000
Namespace cleanup of the VSM related varnishapi functions
diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 69cb666..9f071a2 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -103,7 +103,7 @@ struct vrt_backend;
struct cli_proto;
struct ban;
struct SHA256Context;
-struct vsc_lck;
+struct VSC_C_lck;
struct waitinglist;
struct vef_priv;
@@ -787,7 +787,7 @@ const struct sess * THR_GetSession(void);
void Lck__Lock(struct lock *lck, const char *p, const char *f, int l);
void Lck__Unlock(struct lock *lck, const char *p, const char *f, int l);
int Lck__Trylock(struct lock *lck, const char *p, const char *f, int l);
-void Lck__New(struct lock *lck, struct vsc_lck *, const char *);
+void Lck__New(struct lock *lck, struct VSC_C_lck *, const char *);
void Lck__Assert(const struct lock *lck, int held);
/* public interface: */
@@ -801,7 +801,7 @@ void Lck_CondWait(pthread_cond_t *cond, struct lock *lck);
#define Lck_Trylock(a) Lck__Trylock(a, __func__, __FILE__, __LINE__)
#define Lck_AssertHeld(a) Lck__Assert(a, 1)
-#define LOCK(nam) extern struct vsc_lck *lck_##nam;
+#define LOCK(nam) extern struct VSC_C_lck *lck_##nam;
#include "locks.h"
#undef LOCK
@@ -846,9 +846,9 @@ void *VSM_Alloc(unsigned size, const char *class, const char *type,
const char *ident);
void VSM_Free(const void *ptr);
#ifdef VSL_ENDMARKER
-void VSL(enum vsl_tag tag, int id, const char *fmt, ...);
-void WSLR(struct worker *w, enum vsl_tag tag, int id, txt t);
-void WSL(struct worker *w, enum vsl_tag tag, int id, const char *fmt, ...);
+void VSL(enum VSL_tag_e tag, int id, const char *fmt, ...);
+void WSLR(struct worker *w, enum VSL_tag_e tag, int id, txt t);
+void WSL(struct worker *w, enum VSL_tag_e tag, int id, const char *fmt, ...);
void WSL_Flush(struct worker *w, int overflow);
#define DSL(flag, tag, id, ...) \
diff --git a/bin/varnishd/cache_acceptor.c b/bin/varnishd/cache_acceptor.c
index 264cfc0..275c7e8 100644
--- a/bin/varnishd/cache_acceptor.c
+++ b/bin/varnishd/cache_acceptor.c
@@ -270,19 +270,19 @@ vca_acct(void *arg)
TIM_sleep(pace);
i = poll(pfd, heritage.nsocks, 1000);
now = TIM_real();
- VSC_main->uptime = (uint64_t)(now - t0);
+ VSC_C_main->uptime = (uint64_t)(now - t0);
u = 0;
VTAILQ_FOREACH(ls, &heritage.socks, list) {
if (ls->sock < 0)
continue;
if (pfd[u++].revents == 0)
continue;
- VSC_main->client_conn++;
+ VSC_C_main->client_conn++;
l = sizeof addr_s;
addr = (void*)&addr_s;
i = accept(ls->sock, addr, &l);
if (i < 0) {
- VSC_main->accept_fail++;
+ VSC_C_main->accept_fail++;
switch (errno) {
case EAGAIN:
case ECONNABORTED:
@@ -305,7 +305,7 @@ vca_acct(void *arg)
sp = SES_New();
if (sp == NULL) {
AZ(close(i));
- VSC_main->client_drop++;
+ VSC_C_main->client_drop++;
pace += params->acceptor_sleep_incr;
continue;
}
@@ -320,7 +320,7 @@ vca_acct(void *arg)
sp->step = STP_FIRST;
if (WRK_QueueSession(sp)) {
- VSC_main->client_drop++;
+ VSC_C_main->client_drop++;
pace += params->acceptor_sleep_incr;
} else {
pace *= params->acceptor_sleep_decay;
@@ -348,7 +348,7 @@ vca_handover(struct sess *sp, int status)
case 1:
sp->step = STP_START;
if (WRK_QueueSession(sp))
- VSC_main->client_drop_late++;
+ VSC_C_main->client_drop_late++;
break;
default:
INCOMPL();
diff --git a/bin/varnishd/cache_backend.c b/bin/varnishd/cache_backend.c
index 8f2ebb8..a523501 100644
--- a/bin/varnishd/cache_backend.c
+++ b/bin/varnishd/cache_backend.c
@@ -89,7 +89,7 @@ VBE_ReleaseConn(struct vbc *vc)
vc->addrlen = 0;
vc->recycled = 0;
Lck_Lock(&VBE_mtx);
- VSC_main->n_vbc--;
+ VSC_C_main->n_vbc--;
Lck_Unlock(&VBE_mtx);
FREE_OBJ(vc);
}
@@ -226,7 +226,7 @@ vbe_NewConn(void)
XXXAN(vc);
vc->fd = -1;
Lck_Lock(&VBE_mtx);
- VSC_main->n_vbc++;
+ VSC_C_main->n_vbc++;
Lck_Unlock(&VBE_mtx);
return (vc);
}
@@ -346,14 +346,14 @@ vbe_GetVbe(const struct sess *sp, struct vdi_simple *vs)
break;
if (vbe_CheckFd(vc->fd)) {
/* XXX locking of stats */
- VSC_main->backend_reuse += 1;
+ VSC_C_main->backend_reuse += 1;
WSP(sp, SLT_Backend, "%d %s %s",
vc->fd, sp->director->vcl_name, bp->vcl_name);
vc->vdis = vs;
vc->recycled = 1;
return (vc);
}
- VSC_main->backend_toolate++;
+ VSC_C_main->backend_toolate++;
WSL(sp->wrk, SLT_BackendClose, vc->fd, "%s", bp->vcl_name);
/* Checkpoint log to flush all info related to this connection
@@ -367,13 +367,13 @@ vbe_GetVbe(const struct sess *sp, struct vdi_simple *vs)
}
if (!vbe_Healthy(vs, sp)) {
- VSC_main->backend_unhealthy++;
+ VSC_C_main->backend_unhealthy++;
return (NULL);
}
if (vs->vrt->max_connections > 0 &&
bp->n_conn >= vs->vrt->max_connections) {
- VSC_main->backend_busy++;
+ VSC_C_main->backend_busy++;
return (NULL);
}
@@ -383,11 +383,11 @@ vbe_GetVbe(const struct sess *sp, struct vdi_simple *vs)
bes_conn_try(sp, vc, vs);
if (vc->fd < 0) {
VBE_ReleaseConn(vc);
- VSC_main->backend_fail++;
+ VSC_C_main->backend_fail++;
return (NULL);
}
vc->backend = bp;
- VSC_main->backend_conn++;
+ VSC_C_main->backend_conn++;
WSP(sp, SLT_Backend, "%d %s %s",
vc->fd, sp->director->vcl_name, bp->vcl_name);
vc->vdis = vs;
diff --git a/bin/varnishd/cache_backend.h b/bin/varnishd/cache_backend.h
index 37796d4..69082d0 100644
--- a/bin/varnishd/cache_backend.h
+++ b/bin/varnishd/cache_backend.h
@@ -131,7 +131,7 @@ struct backend {
unsigned healthy;
VTAILQ_HEAD(, trouble) troublelist;
- struct vsc_vbe *vsc;
+ struct VSC_C_vbe *vsc;
};
/* cache_backend.c */
diff --git a/bin/varnishd/cache_backend_cfg.c b/bin/varnishd/cache_backend_cfg.c
index 2e54fd5..44f5cd8 100644
--- a/bin/varnishd/cache_backend_cfg.c
+++ b/bin/varnishd/cache_backend_cfg.c
@@ -69,7 +69,7 @@ VBE_Nuke(struct backend *b)
free(b->port);
VSM_Free(b->vsc);
FREE_OBJ(b);
- VSC_main->n_backend--;
+ VSC_C_main->n_backend--;
}
/*--------------------------------------------------------------------
@@ -234,7 +234,7 @@ VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb)
b->healthy = 1;
VTAILQ_INSERT_TAIL(&backends, b, list);
- VSC_main->n_backend++;
+ VSC_C_main->n_backend++;
return (b);
}
diff --git a/bin/varnishd/cache_ban.c b/bin/varnishd/cache_ban.c
index bde3b5b..a75314c 100644
--- a/bin/varnishd/cache_ban.c
+++ b/bin/varnishd/cache_ban.c
@@ -156,8 +156,8 @@ ban_CheckLast(void)
Lck_AssertHeld(&ban_mtx);
b = VTAILQ_LAST(&ban_head, banhead_s);
if (b != VTAILQ_FIRST(&ban_head) && b->refcount == 0) {
- VSC_main->n_ban--;
- VSC_main->n_ban_retire++;
+ VSC_C_main->n_ban--;
+ VSC_C_main->n_ban_retire++;
VTAILQ_REMOVE(&ban_head, b, list);
} else {
b = NULL;
@@ -398,8 +398,8 @@ BAN_Insert(struct ban *b)
Lck_Lock(&ban_mtx);
VTAILQ_INSERT_HEAD(&ban_head, b, list);
ban_start = b;
- VSC_main->n_ban++;
- VSC_main->n_ban_add++;
+ VSC_C_main->n_ban++;
+ VSC_C_main->n_ban_add++;
be = VTAILQ_LAST(&ban_head, banhead_s);
if (params->ban_dups && be != b)
@@ -428,7 +428,7 @@ BAN_Insert(struct ban *b)
}
Lck_Lock(&ban_mtx);
be->refcount--;
- VSC_main->n_ban_dups += pcount;
+ VSC_C_main->n_ban_dups += pcount;
Lck_Unlock(&ban_mtx);
}
@@ -533,8 +533,8 @@ BAN_Reload(const uint8_t *ban, unsigned len)
gone |= BAN_F_GONE;
}
- VSC_main->n_ban++;
- VSC_main->n_ban_add++;
+ VSC_C_main->n_ban++;
+ VSC_C_main->n_ban_add++;
b2 = BAN_New();
AN(b2);
@@ -707,8 +707,8 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
VTAILQ_INSERT_TAIL(&b0->objcore, oc, ban_list);
b0->refcount++;
}
- VSC_main->n_ban_obj_test++;
- VSC_main->n_ban_re_test += tests;
+ VSC_C_main->n_ban_obj_test++;
+ VSC_C_main->n_ban_re_test += tests;
Lck_Unlock(&ban_mtx);
if (b == oc->ban) { /* not banned */
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 9a3749f..59e22d4 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -526,7 +526,7 @@ cnt_fetch(struct sess *sp)
* Do a single retry in that case.
*/
if (i == 1) {
- VSC_main->backend_retry++;
+ VSC_C_main->backend_retry++;
i = FetchHdr(sp);
}
diff --git a/bin/varnishd/cache_cli.c b/bin/varnishd/cache_cli.c
index 3d6ddd2..7905c17 100644
--- a/bin/varnishd/cache_cli.c
+++ b/bin/varnishd/cache_cli.c
@@ -138,7 +138,7 @@ cli_debug_sizeof(struct cli *cli, const char * const *av, void *priv)
SZOF(struct objhead);
SZOF(struct sess);
SZOF(struct vbc);
- SZOF(struct vsc_main);
+ SZOF(struct VSC_C_main);
SZOF(struct lock);
}
diff --git a/bin/varnishd/cache_dir.c b/bin/varnishd/cache_dir.c
index f27f4f7..4aa7a8f 100644
--- a/bin/varnishd/cache_dir.c
+++ b/bin/varnishd/cache_dir.c
@@ -83,7 +83,7 @@ VDI_RecycleFd(struct sess *sp)
*/
WSL_Flush(sp->wrk, 0);
Lck_Lock(&bp->mtx);
- VSC_main->backend_recycle++;
+ VSC_C_main->backend_recycle++;
VTAILQ_INSERT_HEAD(&bp->connlist, sp->vbc, list);
sp->vbc = NULL;
VBE_DropRefLocked(bp);
diff --git a/bin/varnishd/cache_dir_dns.c b/bin/varnishd/cache_dir_dns.c
index b457d05..244dd2b 100644
--- a/bin/varnishd/cache_dir_dns.c
+++ b/bin/varnishd/cache_dir_dns.c
@@ -232,7 +232,7 @@ vdi_dns_cache_list_add(const struct sess *sp,
struct vdi_dns_hostgroup *new)
{
if (vs->ncachelist >= VDI_DNS_MAX_CACHE) {
- VSC_main->dir_dns_cache_full++;
+ VSC_C_main->dir_dns_cache_full++;
vdi_dns_pop_cache(vs, NULL);
}
CHECK_OBJ_NOTNULL(new, VDI_DNSDIR_MAGIC);
@@ -275,10 +275,10 @@ vdi_dns_cache_add(const struct sess *sp,
REPLACE(new->hostname, hostname);
error = getaddrinfo(hostname, "80", &hint, &res0);
- VSC_main->dir_dns_lookups++;
+ VSC_C_main->dir_dns_lookups++;
if (error) {
vdi_dns_cache_list_add(sp, vs, new);
- VSC_main->dir_dns_failed++;
+ VSC_C_main->dir_dns_failed++;
return (0);
}
@@ -332,7 +332,7 @@ vdi_dns_walk_cache(const struct sess *sp,
ret = vdi_dns_cache_add(sp, vs, hostname, &backend);
AZ(pthread_rwlock_unlock(&vs->rwlock));
} else
- VSC_main->dir_dns_hit++;
+ VSC_C_main->dir_dns_hit++;
/* Bank backend == cached a failure, so to speak */
if (backend != NULL)
diff --git a/bin/varnishd/cache_esi_parse.c b/bin/varnishd/cache_esi_parse.c
index 265cb96..411db43 100644
--- a/bin/varnishd/cache_esi_parse.c
+++ b/bin/varnishd/cache_esi_parse.c
@@ -184,7 +184,7 @@ vep_error(const struct vep_state *vep, const char *p)
{
intmax_t l;
- VSC_main->esi_errors++;
+ VSC_C_main->esi_errors++;
l = (intmax_t)(vep->ver_p - vep->hack_p);
WSP(vep->sp, SLT_ESI_xmlerror, "ERR at %jd %s", l, p);
@@ -199,7 +199,7 @@ vep_warn(const struct vep_state *vep, const char *p)
{
intmax_t l;
- VSC_main->esi_warnings++;
+ VSC_C_main->esi_warnings++;
l = (intmax_t)(vep->ver_p - vep->hack_p);
printf("WARNING at %jd %s\n", l, p);
WSP(vep->sp, SLT_ESI_xmlerror, "WARN at %jd %s", l, p);
diff --git a/bin/varnishd/cache_expire.c b/bin/varnishd/cache_expire.c
index a8b391f..4a4255f 100644
--- a/bin/varnishd/cache_expire.c
+++ b/bin/varnishd/cache_expire.c
@@ -268,7 +268,7 @@ EXP_Touch(struct objcore *oc)
if (oc->timer_idx != BINHEAP_NOIDX) {
VTAILQ_REMOVE(&lru->lru_head, oc, lru_list);
VTAILQ_INSERT_TAIL(&lru->lru_head, oc, lru_list);
- VSC_main->n_lru_moved++;
+ VSC_C_main->n_lru_moved++;
}
Lck_Unlock(&lru->mtx);
return (1);
@@ -382,7 +382,7 @@ exp_timer(struct sess *sp, void *priv)
Lck_Unlock(&exp_mtx);
Lck_Unlock(&lru->mtx);
- VSC_main->n_expired++;
+ VSC_C_main->n_expired++;
CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
(void)HSH_Deref(sp->wrk, oc, NULL);
@@ -420,7 +420,7 @@ EXP_NukeOne(const struct sess *sp, struct lru *lru)
VTAILQ_REMOVE(&lru->lru_head, oc, lru_list);
binheap_delete(exp_heap, oc->timer_idx);
assert(oc->timer_idx == BINHEAP_NOIDX);
- VSC_main->n_lru_nuked++;
+ VSC_C_main->n_lru_nuked++;
}
Lck_Unlock(&exp_mtx);
Lck_Unlock(&lru->mtx);
diff --git a/bin/varnishd/cache_fetch.c b/bin/varnishd/cache_fetch.c
index ddbd3ab..b224146 100644
--- a/bin/varnishd/cache_fetch.c
+++ b/bin/varnishd/cache_fetch.c
@@ -433,7 +433,7 @@ FetchHdr(struct sess *sp)
WSL_Flush(w, 0);
/* XXX is this the right place? */
- VSC_main->backend_req++;
+ VSC_C_main->backend_req++;
/* Receive response */
diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 73a185e..e9ae902 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -161,7 +161,7 @@ VGZ_NewUngzip(struct sess *sp, const char *id)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
vg = vgz_alloc_vgz(sp, id);
vg->dir = VGZ_UN;
- VSC_main->n_gunzip++;
+ VSC_C_main->n_gunzip++;
/*
* Max memory usage according to zonf.h:
@@ -182,7 +182,7 @@ VGZ_NewGzip(struct sess *sp, const char *id)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
vg = vgz_alloc_vgz(sp, id);
vg->dir = VGZ_GZ;
- VSC_main->n_gzip++;
+ VSC_C_main->n_gzip++;
/*
* From zconf.h:
diff --git a/bin/varnishd/cache_hash.c b/bin/varnishd/cache_hash.c
index 457095b..98ec9b0 100644
--- a/bin/varnishd/cache_hash.c
+++ b/bin/varnishd/cache_hash.c
@@ -486,7 +486,7 @@ hsh_rush(struct objhead *oh)
* We could not schedule the session, leave the
* rest on the busy list.
*/
- VSC_main->client_drop_late++;
+ VSC_C_main->client_drop_late++;
break;
}
}
diff --git a/bin/varnishd/cache_http.c b/bin/varnishd/cache_http.c
index 5dc922a..40237e5 100644
--- a/bin/varnishd/cache_http.c
+++ b/bin/varnishd/cache_http.c
@@ -57,14 +57,14 @@
LOGMTX2(ax, HTTP_HDR_FIRST, Header), \
}
-static const enum vsl_tag logmtx[][HTTP_HDR_FIRST + 1] = {
+static const enum VSL_tag_e logmtx[][HTTP_HDR_FIRST + 1] = {
[HTTP_Rx] = LOGMTX1(Rx),
[HTTP_Tx] = LOGMTX1(Tx),
[HTTP_Obj] = LOGMTX1(Obj)
};
/*lint -restore */
-static enum vsl_tag
+static enum VSL_tag_e
http2shmlog(const struct http *hp, int t)
{
@@ -520,7 +520,7 @@ http_dissect_hdrs(struct worker *w, struct http *hp, int fd, char *p,
}
if (q - p > htc->maxhdr) {
- VSC_main->losthdr++;
+ VSC_C_main->losthdr++;
WSL(w, SLT_LostHeader, fd, "%.*s", q - p, p);
return (400);
}
@@ -545,7 +545,7 @@ http_dissect_hdrs(struct worker *w, struct http *hp, int fd, char *p,
WSLH(w, fd, hp, hp->nhd);
hp->nhd++;
} else {
- VSC_main->losthdr++;
+ VSC_C_main->losthdr++;
WSL(w, SLT_LostHeader, fd, "%.*s", q - p, p);
return (400);
}
@@ -787,7 +787,7 @@ http_copyheader(struct worker *w, int fd, struct http *to,
to->hdf[to->nhd] = 0;
to->nhd++;
} else {
- VSC_main->losthdr++;
+ VSC_C_main->losthdr++;
WSLR(w, SLT_LostHeader, fd, fm->hd[n]);
}
}
@@ -896,7 +896,7 @@ http_CopyHome(struct worker *w, int fd, const struct http *hp)
hp->hd[u].e = p + l;
} else {
/* XXX This leaves a slot empty */
- VSC_main->losthdr++;
+ VSC_C_main->losthdr++;
WSLR(w, SLT_LostHeader, fd, hp->hd[u]);
hp->hd[u].b = NULL;
hp->hd[u].e = NULL;
@@ -924,7 +924,7 @@ http_SetHeader(struct worker *w, int fd, struct http *to, const char *hdr)
CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
if (to->nhd >= to->shd) {
- VSC_main->losthdr++;
+ VSC_C_main->losthdr++;
WSL(w, SLT_LostHeader, fd, "%s", hdr);
return;
}
@@ -993,7 +993,7 @@ http_PrintfHeader(struct worker *w, int fd, struct http *to,
n = vsnprintf(to->ws->f, l, fmt, ap);
va_end(ap);
if (n + 1 >= l || to->nhd >= to->shd) {
- VSC_main->losthdr++;
+ VSC_C_main->losthdr++;
WSL(w, SLT_LostHeader, fd, "%s", to->ws->f);
WS_Release(to->ws, 0);
} else {
diff --git a/bin/varnishd/cache_lck.c b/bin/varnishd/cache_lck.c
index acb173a..6fb35c4 100644
--- a/bin/varnishd/cache_lck.c
+++ b/bin/varnishd/cache_lck.c
@@ -51,7 +51,7 @@ struct ilck {
pthread_t owner;
VTAILQ_ENTRY(ilck) list;
const char *w;
- struct vsc_lck *stat;
+ struct VSC_C_lck *stat;
};
static VTAILQ_HEAD(, ilck) ilck_head =
@@ -155,7 +155,7 @@ Lck_CondWait(pthread_cond_t *cond, struct lock *lck)
}
void
-Lck__New(struct lock *lck, struct vsc_lck *st, const char *w)
+Lck__New(struct lock *lck, struct VSC_C_lck *st, const char *w)
{
struct ilck *ilck;
@@ -188,7 +188,7 @@ Lck_Delete(struct lock *lck)
FREE_OBJ(ilck);
}
-#define LOCK(nam) struct vsc_lck *lck_##nam;
+#define LOCK(nam) struct VSC_C_lck *lck_##nam;
#include "locks.h"
#undef LOCK
@@ -198,7 +198,7 @@ LCK_Init(void)
AZ(pthread_mutex_init(&lck_mtx, NULL));
#define LOCK(nam) \
- lck_##nam = VSM_Alloc(sizeof(struct vsc_lck), \
+ lck_##nam = VSM_Alloc(sizeof(struct VSC_C_lck), \
VSC_CLASS, VSC_TYPE_LCK, #nam);
#include "locks.h"
#undef LOCK
diff --git a/bin/varnishd/cache_panic.c b/bin/varnishd/cache_panic.c
index 22a7fff..fc24607 100644
--- a/bin/varnishd/cache_panic.c
+++ b/bin/varnishd/cache_panic.c
@@ -338,18 +338,18 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
VSB_bcat(vsp, "", 1); /* NUL termination */
if (params->diag_bitmap & 0x4000)
- (void)fputs(vsm_head->panicstr, stderr);
+ (void)fputs(VSM_head->panicstr, stderr);
#ifdef HAVE_ABORT2
if (params->diag_bitmap & 0x8000) {
void *arg[1];
char *p;
- for (p = vsm_head->panicstr; *p; p++)
+ for (p = VSM_head->panicstr; *p; p++)
if (*p == '\n')
*p = ' ';
- arg[0] = vsm_head->panicstr;
- abort2(vsm_head->panicstr, 1, arg);
+ arg[0] = VSM_head->panicstr;
+ abort2(VSM_head->panicstr, 1, arg);
}
#endif
if (params->diag_bitmap & 0x1000)
@@ -366,6 +366,6 @@ PAN_Init(void)
VAS_Fail = pan_ic;
vsp = &vsps;
- AN(VSB_new(vsp, vsm_head->panicstr, sizeof vsm_head->panicstr,
+ AN(VSB_new(vsp, VSM_head->panicstr, sizeof VSM_head->panicstr,
VSB_FIXEDLEN));
}
diff --git a/bin/varnishd/cache_pool.c b/bin/varnishd/cache_pool.c
index 816bdbe..9a66f7b 100644
--- a/bin/varnishd/cache_pool.c
+++ b/bin/varnishd/cache_pool.c
@@ -92,7 +92,7 @@ wrk_sumstat(struct worker *w)
Lck_AssertHeld(&wstat_mtx);
#define L0(n)
-#define L1(n) (VSC_main->n += w->stats.n)
+#define L1(n) (VSC_C_main->n += w->stats.n)
#define VSC_DO_MAIN
#define VSC_F(n, t, l, f, d) L##l(n);
#include "vsc_fields.h"
@@ -367,7 +367,7 @@ wrk_addpools(const unsigned pools)
*/
static void
-wrk_decimate_flock(struct wq *qp, double t_idle, struct vsc_main *vs)
+wrk_decimate_flock(struct wq *qp, double t_idle, struct VSC_C_main *vs)
{
struct worker *w = NULL;
@@ -409,7 +409,7 @@ wrk_herdtimer_thread(void *priv)
{
volatile unsigned u;
double t_idle;
- struct vsc_main vsm, *vs;
+ struct VSC_C_main vsm, *vs;
int errno_is_multi_threaded;
THR_SetName("wrk_herdtimer");
@@ -452,10 +452,10 @@ wrk_herdtimer_thread(void *priv)
for (u = 0; u < nwq; u++)
wrk_decimate_flock(wq[u], t_idle, vs);
- VSC_main->n_wrk= vs->n_wrk;
- VSC_main->n_wrk_lqueue = vs->n_wrk_lqueue;
- VSC_main->n_wrk_drop = vs->n_wrk_drop;
- VSC_main->n_wrk_queued = vs->n_wrk_queued;
+ VSC_C_main->n_wrk= vs->n_wrk;
+ VSC_C_main->n_wrk_lqueue = vs->n_wrk_lqueue;
+ VSC_C_main->n_wrk_drop = vs->n_wrk_drop;
+ VSC_C_main->n_wrk_queued = vs->n_wrk_queued;
TIM_sleep(params->wthread_purge_delay * 1e-3);
}
@@ -479,15 +479,15 @@ wrk_breed_flock(struct wq *qp, const pthread_attr_t *tp_attr)
(qp->lqueue > params->wthread_add_threshold && /* more needed */
qp->lqueue > qp->last_lqueue)) { /* not getting better since last */
if (qp->nthr >= nthr_max) {
- VSC_main->n_wrk_max++;
+ VSC_C_main->n_wrk_max++;
} else if (pthread_create(&tp, tp_attr, wrk_thread, qp)) {
VSL(SLT_Debug, 0, "Create worker thread failed %d %s",
errno, strerror(errno));
- VSC_main->n_wrk_failed++;
+ VSC_C_main->n_wrk_failed++;
TIM_sleep(params->wthread_fail_delay * 1e-3);
} else {
AZ(pthread_detach(tp));
- VSC_main->n_wrk_create++;
+ VSC_C_main->n_wrk_create++;
TIM_sleep(params->wthread_add_delay * 1e-3);
}
}
diff --git a/bin/varnishd/cache_response.c b/bin/varnishd/cache_response.c
index ad8302c..16993f5 100644
--- a/bin/varnishd/cache_response.c
+++ b/bin/varnishd/cache_response.c
@@ -259,7 +259,7 @@ res_WriteGunzipObj(struct sess *sp)
u += st->len;
sp->acct_tmp.bodybytes += st->len; /* XXX ? */
- VSC_main->n_objwrite++;
+ VSC_C_main->n_objwrite++;
i = VGZ_WrwGunzip(sp, vg,
st->ptr, st->len,
@@ -319,12 +319,12 @@ res_WriteDirObj(struct sess *sp, ssize_t low, ssize_t high)
*/
if (st->fd >= 0 &&
st->len >= params->sendfile_threshold) {
- VSC_main->n_objsendfile++;
+ VSC_C_main->n_objsendfile++;
WRW_Sendfile(sp->wrk, st->fd, st->where + off, len);
continue;
}
#endif /* SENDFILE_WORKS */
- VSC_main->n_objwrite++;
+ VSC_C_main->n_objwrite++;
(void)WRW_Write(sp->wrk, st->ptr + off, len);
}
assert(u == sp->obj->len);
diff --git a/bin/varnishd/cache_session.c b/bin/varnishd/cache_session.c
index 05aaf19..fa478a6 100644
--- a/bin/varnishd/cache_session.c
+++ b/bin/varnishd/cache_session.c
@@ -105,7 +105,7 @@ ses_sm_alloc(void)
volatile unsigned nhttp;
unsigned l, hl;
- if (VSC_main->n_sess_mem >= params->max_sess)
+ if (VSC_C_main->n_sess_mem >= params->max_sess)
return (NULL);
/*
* It is not necessary to lock these, but we need to
@@ -122,7 +122,7 @@ ses_sm_alloc(void)
q = p + l;
Lck_Lock(&stat_mtx);
- VSC_main->n_sess_mem++;
+ VSC_C_main->n_sess_mem++;
Lck_Unlock(&stat_mtx);
/* Don't waste time zeroing the workspace */
@@ -214,7 +214,7 @@ SES_New(void)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
}
- VSC_main->n_sess++; /* XXX: locking ? */
+ VSC_C_main->n_sess++; /* XXX: locking ? */
return (sp);
}
@@ -255,7 +255,7 @@ SES_Delete(struct sess *sp)
AZ(sp->obj);
AZ(sp->vcl);
- VSC_main->n_sess--; /* XXX: locking ? */
+ VSC_C_main->n_sess--; /* XXX: locking ? */
assert(!isnan(b->first));
assert(!isnan(sp->t_end));
if (sp->addr == NULL)
@@ -268,7 +268,7 @@ SES_Delete(struct sess *sp)
b->fetch, b->hdrbytes, b->bodybytes);
if (sm->workspace != params->sess_workspace) {
Lck_Lock(&stat_mtx);
- VSC_main->n_sess_mem--;
+ VSC_C_main->n_sess_mem--;
Lck_Unlock(&stat_mtx);
free(sm);
} else {
@@ -280,7 +280,7 @@ SES_Delete(struct sess *sp)
}
/* Try to precreate some ses-mem so the acceptor will not have to */
- if (VSC_main->n_sess_mem < VSC_main->n_sess + 10) {
+ if (VSC_C_main->n_sess_mem < VSC_C_main->n_sess + 10) {
sm = ses_sm_alloc();
if (sm != NULL) {
ses_setup(sm);
diff --git a/bin/varnishd/cache_shmlog.c b/bin/varnishd/cache_shmlog.c
index dad28b6..b9f9dc8 100644
--- a/bin/varnishd/cache_shmlog.c
+++ b/bin/varnishd/cache_shmlog.c
@@ -56,7 +56,7 @@ vsl_w0(uint32_t type, uint32_t length)
/*--------------------------------------------------------------------*/
static inline void
-vsl_hdr(enum vsl_tag tag, uint32_t *p, unsigned len, unsigned id)
+vsl_hdr(enum VSL_tag_e tag, uint32_t *p, unsigned len, unsigned id)
{
assert(((uintptr_t)p & 0x3) == 0);
@@ -83,7 +83,7 @@ vsl_wrap(void)
*vsl_ptr = VSL_WRAPMARKER;
vsl_ptr = vsl_start + 1;
}
- VSC_main->shm_cycles++;
+ VSC_C_main->shm_cycles++;
}
/*--------------------------------------------------------------------
@@ -97,14 +97,14 @@ vsl_get(unsigned len, unsigned records, unsigned flushes)
if (pthread_mutex_trylock(&vsl_mtx)) {
AZ(pthread_mutex_lock(&vsl_mtx));
- VSC_main->shm_cont++;
+ VSC_C_main->shm_cont++;
}
assert(vsl_ptr < vsl_end);
assert(((uintptr_t)vsl_ptr & 0x3) == 0);
- VSC_main->shm_writes++;
- VSC_main->shm_flushes += flushes;
- VSC_main->shm_records += records;
+ VSC_C_main->shm_writes++;
+ VSC_C_main->shm_flushes += flushes;
+ VSC_C_main->shm_records += records;
/* Wrap if necessary */
if (VSL_END(vsl_ptr, len) >= vsl_end)
@@ -128,7 +128,7 @@ vsl_get(unsigned len, unsigned records, unsigned flushes)
*/
static void
-VSLR(enum vsl_tag tag, int id, const char *b, unsigned len)
+VSLR(enum VSL_tag_e tag, int id, const char *b, unsigned len)
{
uint32_t *p;
unsigned mlen;
@@ -148,7 +148,7 @@ VSLR(enum vsl_tag tag, int id, const char *b, unsigned len)
/*--------------------------------------------------------------------*/
void
-VSL(enum vsl_tag tag, int id, const char *fmt, ...)
+VSL(enum VSL_tag_e tag, int id, const char *fmt, ...)
{
va_list ap;
unsigned n, mlen = params->shm_reclen;
@@ -198,7 +198,7 @@ WSL_Flush(struct worker *w, int overflow)
/*--------------------------------------------------------------------*/
void
-WSLR(struct worker *w, enum vsl_tag tag, int id, txt t)
+WSLR(struct worker *w, enum VSL_tag_e tag, int id, txt t)
{
unsigned l, mlen;
@@ -230,7 +230,7 @@ WSLR(struct worker *w, enum vsl_tag tag, int id, txt t)
/*--------------------------------------------------------------------*/
void
-WSL(struct worker *w, enum vsl_tag tag, int id, const char *fmt, ...)
+WSL(struct worker *w, enum VSL_tag_e tag, int id, const char *fmt, ...)
{
va_list ap;
char *p;
@@ -271,7 +271,7 @@ WSL(struct worker *w, enum vsl_tag tag, int id, const char *fmt, ...)
void
VSL_Init(void)
{
- struct vsm_chunk *vsc;
+ struct VSM_chunk *vsc;
AZ(pthread_mutex_init(&vsl_mtx, NULL));
AZ(pthread_mutex_init(&vsm_mtx, NULL));
@@ -287,10 +287,10 @@ VSL_Init(void)
vsl_ptr = vsl_start + 1;
vsl_wrap();
- vsm_head->starttime = (intmax_t)TIM_real();
- vsm_head->panicstr[0] = '\0';
- memset(VSC_main, 0, sizeof *VSC_main);
- vsm_head->child_pid = getpid();
+ VSM_head->starttime = (intmax_t)TIM_real();
+ VSM_head->panicstr[0] = '\0';
+ memset(VSC_C_main, 0, sizeof *VSC_C_main);
+ VSM_head->child_pid = getpid();
}
/*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache_vcl.c b/bin/varnishd/cache_vcl.c
index 900f4ea..9137acd 100644
--- a/bin/varnishd/cache_vcl.c
+++ b/bin/varnishd/cache_vcl.c
@@ -179,8 +179,8 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
if (vcl_active == NULL)
vcl_active = vcl;
Lck_Unlock(&vcl_mtx);
- VSC_main->n_vcl++;
- VSC_main->n_vcl_avail++;
+ VSC_C_main->n_vcl++;
+ VSC_C_main->n_vcl_avail++;
return (0);
}
@@ -203,8 +203,8 @@ VCL_Nuke(struct vcls *vcl)
free(vcl->name);
(void)dlclose(vcl->dlh);
FREE_OBJ(vcl);
- VSC_main->n_vcl--;
- VSC_main->n_vcl_discard--;
+ VSC_C_main->n_vcl--;
+ VSC_C_main->n_vcl_discard--;
}
/*--------------------------------------------------------------------*/
@@ -278,8 +278,8 @@ ccf_config_discard(struct cli *cli, const char * const *av, void *priv)
cli_out(cli, "VCL %s is the active VCL", av[2]);
return;
}
- VSC_main->n_vcl_discard++;
- VSC_main->n_vcl_avail--;
+ VSC_C_main->n_vcl_discard++;
+ VSC_C_main->n_vcl_avail--;
vcl->conf->discard = 1;
Lck_Unlock(&vcl_mtx);
if (vcl->conf->busy == 0)
diff --git a/bin/varnishd/cache_vrt_vmod.c b/bin/varnishd/cache_vrt_vmod.c
index 4ba4ca8..1afa459 100644
--- a/bin/varnishd/cache_vrt_vmod.c
+++ b/bin/varnishd/cache_vrt_vmod.c
@@ -77,7 +77,7 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm, const char *path)
AN(v);
VTAILQ_INSERT_TAIL(&vmods, v, list);
- VSC_main->vmods++;
+ VSC_C_main->vmods++;
REPLACE(v->nm, nm);
REPLACE(v->path, path);
@@ -124,7 +124,7 @@ VRT_Vmod_Fini(void **hdl)
free(v->nm);
free(v->path);
VTAILQ_REMOVE(&vmods, v, list);
- VSC_main->vmods--;
+ VSC_C_main->vmods--;
FREE_OBJ(v);
}
diff --git a/bin/varnishd/common.h b/bin/varnishd/common.h
index ae3ec16..45bc894 100644
--- a/bin/varnishd/common.h
+++ b/bin/varnishd/common.h
@@ -37,7 +37,7 @@ extern pid_t mgt_pid;
void VCA_tweak_waiter(struct cli *cli, const char *arg);
/* mgt_shmem.c */
-extern struct vsc_main *VSC_main;
+extern struct VSC_C_main *VSC_C_main;
/* varnishd.c */
struct vsb;
@@ -69,8 +69,8 @@ const void *pick(const struct choice *cp, const char *which, const char *kind);
#define NEEDLESS_RETURN(foo) return (foo)
/* vsm.c */
-extern struct vsm_head *vsm_head;
-extern const struct vsm_chunk *vsm_end;
+extern struct VSM_head *VSM_head;
+extern const struct VSM_chunk *vsm_end;
/*
* These three should not be called directly, but only through
diff --git a/bin/varnishd/hash_critbit.c b/bin/varnishd/hash_critbit.c
index a5ad526..0eb426c 100644
--- a/bin/varnishd/hash_critbit.c
+++ b/bin/varnishd/hash_critbit.c
@@ -429,19 +429,19 @@ hcb_lookup(const struct sess *sp, struct objhead *noh)
if (with_lock) {
CAST_OBJ_NOTNULL(y, sp->wrk->nhashpriv, HCB_Y_MAGIC);
Lck_Lock(&hcb_mtx);
- VSC_main->hcb_lock++;
+ VSC_C_main->hcb_lock++;
assert(noh->refcnt == 1);
oh = hcb_insert(sp->wrk, &hcb_root, noh, 1);
Lck_Unlock(&hcb_mtx);
} else {
- VSC_main->hcb_nolock++;
+ VSC_C_main->hcb_nolock++;
oh = hcb_insert(sp->wrk, &hcb_root, noh, 0);
}
if (oh != NULL && oh == noh) {
/* Assert that we only muck with the tree with a lock */
assert(with_lock);
- VSC_main->hcb_insert++;
+ VSC_C_main->hcb_insert++;
assert(oh->refcnt > 0);
return (oh);
}
diff --git a/bin/varnishd/mgt_child.c b/bin/varnishd/mgt_child.c
index 4258af2..863e86b 100644
--- a/bin/varnishd/mgt_child.c
+++ b/bin/varnishd/mgt_child.c
@@ -424,17 +424,17 @@ static void
mgt_report_panic(pid_t r)
{
- if (vsm_head->panicstr[0] == '\0')
+ if (VSM_head->panicstr[0] == '\0')
return;
REPORT(LOG_ERR, "Child (%jd) Panic message: %s",
- (intmax_t)r, vsm_head->panicstr);
+ (intmax_t)r, VSM_head->panicstr);
}
static void
mgt_save_panic(void)
{
char time_str[30];
- if (vsm_head->panicstr[0] == '\0')
+ if (VSM_head->panicstr[0] == '\0')
return;
if (child_panic)
@@ -443,7 +443,7 @@ mgt_save_panic(void)
XXXAN(child_panic);
TIM_format(TIM_real(), time_str);
VSB_printf(child_panic, "Last panic at: %s\n", time_str);
- VSB_cat(child_panic, vsm_head->panicstr);
+ VSB_cat(child_panic, VSM_head->panicstr);
AZ(VSB_finish(child_panic));
}
diff --git a/bin/varnishd/mgt_shmem.c b/bin/varnishd/mgt_shmem.c
index 47a91c2..d3d1f87 100644
--- a/bin/varnishd/mgt_shmem.c
+++ b/bin/varnishd/mgt_shmem.c
@@ -110,7 +110,7 @@
#define MAP_NOSYNC 0 /* XXX Linux */
#endif
-struct vsc_main *VSC_main;
+struct VSC_C_main *VSC_C_main;
static int vsl_fd = -1;
@@ -122,7 +122,7 @@ static int vsl_fd = -1;
static void
vsl_n_check(int fd)
{
- struct vsm_head slh;
+ struct VSM_head slh;
int i;
struct stat st;
@@ -157,7 +157,7 @@ vsl_n_check(int fd)
static void
vsl_buildnew(const char *fn, unsigned size, int fill)
{
- struct vsm_head slh;
+ struct VSM_head slh;
int i;
unsigned u;
char buf[64*1024];
@@ -268,26 +268,26 @@ mgt_SHM_Init(const char *l_arg)
(void)close(i);
vsl_buildnew(VSM_FILENAME, size, fill);
- vsm_head = (void *)mmap(NULL, size,
+ VSM_head = (void *)mmap(NULL, size,
PROT_READ|PROT_WRITE,
MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED,
vsl_fd, 0);
- vsm_head->master_pid = getpid();
- xxxassert(vsm_head != MAP_FAILED);
- (void)mlock((void*)vsm_head, size);
-
- memset(&vsm_head->head, 0, sizeof vsm_head->head);
- vsm_head->head.magic = VSM_CHUNK_MAGIC;
- vsm_head->head.len =
- (uint8_t*)(vsm_head) + size - (uint8_t*)&vsm_head->head;
- bprintf(vsm_head->head.class, "%s", VSM_CLASS_FREE);
+ VSM_head->master_pid = getpid();
+ xxxassert(VSM_head != MAP_FAILED);
+ (void)mlock((void*)VSM_head, size);
+
+ memset(&VSM_head->head, 0, sizeof VSM_head->head);
+ VSM_head->head.magic = VSM_CHUNK_MAGIC;
+ VSM_head->head.len =
+ (uint8_t*)(VSM_head) + size - (uint8_t*)&VSM_head->head;
+ bprintf(VSM_head->head.class, "%s", VSM_CLASS_FREE);
VWMB();
- vsm_end = (void*)((uint8_t*)vsm_head + size);
+ vsm_end = (void*)((uint8_t*)VSM_head + size);
- VSC_main = VSM_Alloc(sizeof *VSC_main,
+ VSC_C_main = VSM_Alloc(sizeof *VSC_C_main,
VSC_CLASS, VSC_TYPE_MAIN, "");
- AN(VSC_main);
+ AN(VSC_C_main);
pp = VSM_Alloc(sizeof *pp, VSM_CLASS_PARAM, "", "");
AN(pp);
@@ -306,8 +306,8 @@ mgt_SHM_Init(const char *l_arg)
VWMB();
do
- vsm_head->alloc_seq = random();
- while (vsm_head->alloc_seq == 0);
+ VSM_head->alloc_seq = random();
+ while (VSM_head->alloc_seq == 0);
}
@@ -315,5 +315,5 @@ void
mgt_SHM_Pid(void)
{
- vsm_head->master_pid = getpid();
+ VSM_head->master_pid = getpid();
}
diff --git a/bin/varnishd/stevedore.h b/bin/varnishd/stevedore.h
index e284530..cef22ea 100644
--- a/bin/varnishd/stevedore.h
+++ b/bin/varnishd/stevedore.h
@@ -84,7 +84,7 @@ struct stevedore {
void *priv;
VTAILQ_ENTRY(stevedore) list;
- char ident[16]; /* XXX: match vsm_chunk.ident */
+ char ident[16]; /* XXX: match VSM_chunk.ident */
};
struct object *STV_MkObject(struct sess *sp, void *ptr, unsigned ltot,
diff --git a/bin/varnishd/storage_file.c b/bin/varnishd/storage_file.c
index eca769a..19ce1dd 100644
--- a/bin/varnishd/storage_file.c
+++ b/bin/varnishd/storage_file.c
@@ -90,7 +90,7 @@ struct smf_sc {
unsigned magic;
#define SMF_SC_MAGIC 0x52962ee7
struct lock mtx;
- struct vsc_smf *stats;
+ struct VSC_C_smf *stats;
const char *filename;
int fd;
diff --git a/bin/varnishd/storage_malloc.c b/bin/varnishd/storage_malloc.c
index 18a9cbf..1d13520 100644
--- a/bin/varnishd/storage_malloc.c
+++ b/bin/varnishd/storage_malloc.c
@@ -44,7 +44,7 @@ struct sma_sc {
#define SMA_SC_MAGIC 0x1ac8a345
struct lock sma_mtx;
size_t sma_max;
- struct vsc_sma *stats;
+ struct VSC_C_sma *stats;
};
struct sma {
diff --git a/bin/varnishd/storage_synth.c b/bin/varnishd/storage_synth.c
index 6894e99..b9e53d3 100644
--- a/bin/varnishd/storage_synth.c
+++ b/bin/varnishd/storage_synth.c
@@ -48,9 +48,9 @@ sms_free(struct storage *sto)
CHECK_OBJ_NOTNULL(sto, STORAGE_MAGIC);
Lck_Lock(&sms_mtx);
- VSC_main->sms_nobj--;
- VSC_main->sms_nbytes -= sto->len;
- VSC_main->sms_bfree += sto->len;
+ VSC_C_main->sms_nobj--;
+ VSC_C_main->sms_nbytes -= sto->len;
+ VSC_C_main->sms_bfree += sto->len;
Lck_Unlock(&sms_mtx);
VSB_delete(sto->priv);
free(sto);
@@ -80,8 +80,8 @@ SMS_Makesynth(struct object *obj)
obj->len = 0;
Lck_Lock(&sms_mtx);
- VSC_main->sms_nreq++;
- VSC_main->sms_nobj++;
+ VSC_C_main->sms_nreq++;
+ VSC_C_main->sms_nobj++;
Lck_Unlock(&sms_mtx);
sto = calloc(sizeof *sto, 1);
@@ -118,7 +118,7 @@ SMS_Finish(struct object *obj)
sto->space = VSB_len(vsb);
obj->len = sto->len;
Lck_Lock(&sms_mtx);
- VSC_main->sms_nbytes += sto->len;
- VSC_main->sms_balloc += sto->len;
+ VSC_C_main->sms_nbytes += sto->len;
+ VSC_C_main->sms_balloc += sto->len;
Lck_Unlock(&sms_mtx);
}
diff --git a/bin/varnishd/storage_umem.c b/bin/varnishd/storage_umem.c
index 016f5c9..37194e3 100644
--- a/bin/varnishd/storage_umem.c
+++ b/bin/varnishd/storage_umem.c
@@ -58,13 +58,13 @@ smu_alloc(struct stevedore *st, size_t size)
struct smu *smu;
Lck_Lock(&smu_mtx);
- VSC_main->sma_nreq++;
- if (VSC_main->sma_nbytes + size > smu_max)
+ VSC_C_main->sma_nreq++;
+ if (VSC_C_main->sma_nbytes + size > smu_max)
size = 0;
else {
- VSC_main->sma_nobj++;
- VSC_main->sma_nbytes += size;
- VSC_main->sma_balloc += size;
+ VSC_C_main->sma_nobj++;
+ VSC_C_main->sma_nbytes += size;
+ VSC_C_main->sma_balloc += size;
}
Lck_Unlock(&smu_mtx);
@@ -95,9 +95,9 @@ smu_free(struct storage *s)
smu = s->priv;
assert(smu->sz == smu->s.space);
Lck_Lock(&smu_mtx);
- VSC_main->sma_nobj--;
- VSC_main->sma_nbytes -= smu->sz;
- VSC_main->sma_bfree += smu->sz;
+ VSC_C_main->sma_nobj--;
+ VSC_C_main->sma_nbytes -= smu->sz;
+ VSC_C_main->sma_bfree += smu->sz;
Lck_Unlock(&smu_mtx);
umem_free(smu->s.ptr, smu->s.space);
umem_free(smu, sizeof *smu);
@@ -116,8 +116,8 @@ smu_trim(const struct storage *s, size_t size)
memcpy(p, smu->s.ptr, size);
umem_free(smu->s.ptr, smu->s.space);
Lck_Lock(&smu_mtx);
- VSC_main->sma_nbytes -= (smu->sz - size);
- VSC_main->sma_bfree += smu->sz - size;
+ VSC_C_main->sma_nbytes -= (smu->sz - size);
+ VSC_C_main->sma_bfree += smu->sz - size;
smu->sz = size;
Lck_Unlock(&smu_mtx);
smu->s.ptr = p;
diff --git a/bin/varnishd/varnishd.c b/bin/varnishd/varnishd.c
index 4a216a9..a3b6fa9 100644
--- a/bin/varnishd/varnishd.c
+++ b/bin/varnishd/varnishd.c
@@ -557,7 +557,7 @@ main(int argc, char * const *argv)
}
}
- if (vin_n_arg(n_arg, &heritage.name, &dirname, NULL) != 0) {
+ if (VIN_N_Arg(n_arg, &heritage.name, &dirname, NULL) != 0) {
fprintf(stderr, "Invalid instance name: %s\n",
strerror(errno));
exit(1);
diff --git a/bin/varnishd/vsm.c b/bin/varnishd/vsm.c
index 4312d83..cc6b125 100644
--- a/bin/varnishd/vsm.c
+++ b/bin/varnishd/vsm.c
@@ -58,16 +58,16 @@
#include "vmb.h"
/* These two come from beyond (mgt_shmem.c actually) */
-struct vsm_head *vsm_head;
-const struct vsm_chunk *vsm_end;
+struct VSM_head *VSM_head;
+const struct VSM_chunk *vsm_end;
static unsigned
vsm_mark(void)
{
unsigned seq;
- seq = vsm_head->alloc_seq;
- vsm_head->alloc_seq = 0;
+ seq = VSM_head->alloc_seq;
+ VSM_head->alloc_seq = 0;
VWMB();
return (seq);
}
@@ -80,8 +80,8 @@ vsm_release(unsigned seq)
return;
VWMB();
do
- vsm_head->alloc_seq = ++seq;
- while (vsm_head->alloc_seq == 0);
+ VSM_head->alloc_seq = ++seq;
+ while (VSM_head->alloc_seq == 0);
}
/*--------------------------------------------------------------------*/
@@ -90,10 +90,10 @@ static void
vsm_cleanup(void)
{
unsigned now = (unsigned)TIM_mono();
- struct vsm_chunk *sha, *sha2;
+ struct VSM_chunk *sha, *sha2;
unsigned seq;
- CHECK_OBJ_NOTNULL(vsm_head, VSM_HEAD_MAGIC);
+ CHECK_OBJ_NOTNULL(VSM_head, VSM_HEAD_MAGIC);
VSM_ITER(sha) {
if (strcmp(sha->class, VSM_CLASS_COOL))
continue;
@@ -146,10 +146,10 @@ vsm_cleanup(void)
void *
VSM__Alloc(unsigned size, const char *class, const char *type, const char *ident)
{
- struct vsm_chunk *sha, *sha2;
+ struct VSM_chunk *sha, *sha2;
unsigned seq;
- CHECK_OBJ_NOTNULL(vsm_head, VSM_HEAD_MAGIC);
+ CHECK_OBJ_NOTNULL(VSM_head, VSM_HEAD_MAGIC);
vsm_cleanup();
@@ -195,10 +195,10 @@ VSM__Alloc(unsigned size, const char *class, const char *type, const char *ident
void
VSM__Free(const void *ptr)
{
- struct vsm_chunk *sha;
+ struct VSM_chunk *sha;
unsigned seq;
- CHECK_OBJ_NOTNULL(vsm_head, VSM_HEAD_MAGIC);
+ CHECK_OBJ_NOTNULL(VSM_head, VSM_HEAD_MAGIC);
VSM_ITER(sha)
if (VSM_PTR(sha) == ptr)
break;
@@ -216,10 +216,10 @@ VSM__Free(const void *ptr)
void
VSM__Clean(void)
{
- struct vsm_chunk *sha;
+ struct VSM_chunk *sha;
unsigned f, seq;
- CHECK_OBJ_NOTNULL(vsm_head, VSM_HEAD_MAGIC);
+ CHECK_OBJ_NOTNULL(VSM_head, VSM_HEAD_MAGIC);
f = 0;
seq = vsm_mark();
VSM_ITER(sha) {
diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index 5772de6..948bd57 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -146,7 +146,7 @@ update(struct VSM_data *vd)
}
static int
-h_hist(void *priv, enum vsl_tag tag, unsigned fd, unsigned len,
+h_hist(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
unsigned spec, const char *ptr, uint64_t bm)
{
double b;
diff --git a/bin/varnishlog/varnishlog.c b/bin/varnishlog/varnishlog.c
index d0e39d0..0a359e0 100644
--- a/bin/varnishlog/varnishlog.c
+++ b/bin/varnishlog/varnishlog.c
@@ -55,7 +55,7 @@ static int b_flag, c_flag;
static struct vsb *ob[65536];
static unsigned char flg[65536];
-static enum vsl_tag last[65536];
+static enum VSL_tag_e last[65536];
static uint64_t bitmap[65536];
#define F_INVCL (1 << 0)
@@ -90,7 +90,7 @@ clean_order(struct VSM_data *vd)
}
static int
-h_order(void *priv, enum vsl_tag tag, unsigned fd, unsigned len,
+h_order(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
unsigned spec, const char *ptr, uint64_t bm)
{
char type;
diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index 39c5cce..20a9958 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -208,7 +208,7 @@ clean_logline(struct logline *lp)
}
static int
-collect_backend(struct logline *lp, enum vsl_tag tag, unsigned spec,
+collect_backend(struct logline *lp, enum VSL_tag_e tag, unsigned spec,
const char *ptr, unsigned len)
{
const char *end, *next;
@@ -322,7 +322,7 @@ collect_backend(struct logline *lp, enum vsl_tag tag, unsigned spec,
}
static int
-collect_client(struct logline *lp, enum vsl_tag tag, unsigned spec,
+collect_client(struct logline *lp, enum VSL_tag_e tag, unsigned spec,
const char *ptr, unsigned len)
{
const char *end, *next;
@@ -478,7 +478,7 @@ collect_client(struct logline *lp, enum vsl_tag tag, unsigned spec,
}
static int
-h_ncsa(void *priv, enum vsl_tag tag, unsigned fd,
+h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
unsigned len, unsigned spec, const char *ptr, uint64_t bitmap)
{
struct logline *lp;
diff --git a/bin/varnishreplay/varnishreplay.c b/bin/varnishreplay/varnishreplay.c
index 713f125..f0286b1 100644
--- a/bin/varnishreplay/varnishreplay.c
+++ b/bin/varnishreplay/varnishreplay.c
@@ -90,7 +90,7 @@ isequal(const char *str, const char *reference, const char *end)
*/
struct message {
- enum vsl_tag tag;
+ enum VSL_tag_e tag;
size_t len;
char *ptr;
VSTAILQ_ENTRY(message) list;
@@ -493,7 +493,7 @@ replay_thread(void *arg)
char space[1] = " ", crlf[2] = "\r\n";
struct replay_thread *thr = arg;
struct message *msg;
- enum vsl_tag tag;
+ enum VSL_tag_e tag;
size_t len;
char *ptr;
const char *next;
@@ -635,7 +635,7 @@ clear:
}
static int
-gen_traffic(void *priv, enum vsl_tag tag, unsigned fd,
+gen_traffic(void *priv, enum VSL_tag_e tag, unsigned fd,
unsigned len, unsigned spec, const char *ptr, uint64_t bitmap)
{
struct replay_thread *thr;
diff --git a/bin/varnishsizes/varnishsizes.c b/bin/varnishsizes/varnishsizes.c
index 8d14d3e..f0a51d6 100644
--- a/bin/varnishsizes/varnishsizes.c
+++ b/bin/varnishsizes/varnishsizes.c
@@ -146,7 +146,7 @@ update(struct VSM_data *vd)
}
static int
-h_hist(void *priv, enum vsl_tag tag, unsigned fd, unsigned len,
+h_hist(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
unsigned spec, const char *ptr, uint64_t bm)
{
double b;
diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c
index c1408dd..b389175 100644
--- a/bin/varnishstat/varnishstat.c
+++ b/bin/varnishstat/varnishstat.c
@@ -49,7 +49,7 @@
/*--------------------------------------------------------------------*/
static int
-do_xml_cb(void *priv, const struct vsc_point * const pt)
+do_xml_cb(void *priv, const struct VSC_point * const pt)
{
uint64_t val;
@@ -92,7 +92,7 @@ struct once_priv {
};
static int
-do_once_cb(void *priv, const struct vsc_point * const pt)
+do_once_cb(void *priv, const struct VSC_point * const pt)
{
struct once_priv *op;
uint64_t val;
@@ -118,12 +118,12 @@ do_once_cb(void *priv, const struct vsc_point * const pt)
}
static void
-do_once(struct VSM_data *vd, const struct vsc_main *VSC_main)
+do_once(struct VSM_data *vd, const struct VSC_C_main *VSC_C_main)
{
struct once_priv op;
memset(&op, 0, sizeof op);
- op.up = VSC_main->uptime;
+ op.up = VSC_C_main->uptime;
op.pad = 18;
(void)VSC_Iter(vd, do_once_cb, &op);
@@ -132,7 +132,7 @@ do_once(struct VSM_data *vd, const struct vsc_main *VSC_main)
/*--------------------------------------------------------------------*/
static int
-do_list_cb(void *priv, const struct vsc_point * const pt)
+do_list_cb(void *priv, const struct VSC_point * const pt)
{
int i;
@@ -192,7 +192,7 @@ main(int argc, char * const *argv)
{
int c;
struct VSM_data *vd;
- const struct vsc_main *VSC_main;
+ const struct VSC_C_main *VSC_C_main;
int delay = 1, once = 0, xml = 0;
vd = VSM_New();
@@ -227,14 +227,14 @@ main(int argc, char * const *argv)
if (VSC_Open(vd, 1))
exit(1);
- VSC_main = VSC_Main(vd);
+ VSC_C_main = VSC_Main(vd);
if (xml)
do_xml(vd);
else if (once)
- do_once(vd, VSC_main);
+ do_once(vd, VSC_C_main);
else
- do_curses(vd, VSC_main, delay);
+ do_curses(vd, VSC_C_main, delay);
exit(0);
}
diff --git a/bin/varnishstat/varnishstat.h b/bin/varnishstat/varnishstat.h
index 594eaa8..13d7363 100644
--- a/bin/varnishstat/varnishstat.h
+++ b/bin/varnishstat/varnishstat.h
@@ -27,4 +27,4 @@
*
*/
-void do_curses(struct VSM_data *vd, const struct vsc_main *VSC_main, int delay);
+void do_curses(struct VSM_data *vd, const struct VSC_C_main *VSC_C_main, int delay);
diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c
index 2672255..75fab45 100644
--- a/bin/varnishstat/varnishstat_curses.c
+++ b/bin/varnishstat/varnishstat_curses.c
@@ -67,7 +67,7 @@ struct pt {
static VTAILQ_HEAD(, pt) pthead = VTAILQ_HEAD_INITIALIZER(pthead);
static int
-do_curses_cb(void *priv, const struct vsc_point * const sp)
+do_curses_cb(void *priv, const struct VSC_point * const sp)
{
struct pt *pt;
char buf[128];
@@ -124,7 +124,7 @@ myexp(double *acc, double val, unsigned *n, unsigned nmax)
}
void
-do_curses(struct VSM_data *vd, const struct vsc_main *VSC_main,
+do_curses(struct VSM_data *vd, const struct VSC_C_main *VSC_C_main,
int delay)
{
intmax_t ju;
@@ -168,7 +168,7 @@ do_curses(struct VSM_data *vd, const struct vsc_main *VSC_main,
* Break to outher loop if we need to re-read file.
* Only check if it looks like nothing is happening.
*/
- act = VSC_main->cache_hit + VSC_main->cache_miss + 1;
+ act = VSC_C_main->cache_hit + VSC_C_main->cache_miss + 1;
if (act == lact && VSM_ReOpen(vd, 1))
break;
lact = act;
@@ -177,15 +177,15 @@ do_curses(struct VSM_data *vd, const struct vsc_main *VSC_main,
tt = tv.tv_usec * 1e-6 + tv.tv_sec;
lt = tt - lt;
- rt = VSC_main->uptime;
+ rt = VSC_C_main->uptime;
up = rt;
AC(mvprintw(0, 0, "%*s", COLS - 1, VSM_Name(vd)));
AC(mvprintw(0, 0, "%d+%02d:%02d:%02d", rt / 86400,
(rt % 86400) / 3600, (rt % 3600) / 60, rt % 60));
- hit = VSC_main->cache_hit;
- miss = VSC_main->cache_miss;
+ hit = VSC_C_main->cache_hit;
+ miss = VSC_C_main->cache_miss;
hr = (hit - lhit) / lt;
mr = (miss - lmiss) / lt;
lhit = hit;
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 52eafab..fb99657 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -584,7 +584,7 @@ struct stat_priv {
};
static int
-do_stat_cb(void *priv, const struct vsc_point * const pt)
+do_stat_cb(void *priv, const struct VSC_point * const pt)
{
struct stat_priv *sp = priv;
const char *p = sp->target;
diff --git a/include/varnishapi.h b/include/varnishapi.h
index dbb3931..6e3529c 100644
--- a/include/varnishapi.h
+++ b/include/varnishapi.h
@@ -56,9 +56,9 @@ struct VSM_data *VSM_New(void);
* Pointer to usable VSL_data handle.
*/
-typedef void vsm_diag_f(void *priv, const char *fmt, ...);
+typedef void VSM_diag_f(void *priv, const char *fmt, ...);
-void VSM_Diag(struct VSM_data *vd, vsm_diag_f *func, void *priv);
+void VSM_Diag(struct VSM_data *vd, VSM_diag_f *func, void *priv);
/*
* Set the diagnostics reporting function.
* Default is fprintf(stderr, ...)
@@ -114,7 +114,7 @@ unsigned VSM_Seq(struct VSM_data *vd);
* Return the allocation sequence number
*/
-struct vsm_head *VSM_Head(const struct VSM_data *vd);
+struct VSM_head *VSM_Head(const struct VSM_data *vd);
/*
* Return the head of the VSM.
*/
@@ -133,15 +133,15 @@ void VSM_Close(struct VSM_data *vd);
* Deallocate all storage (including VSC and VSL allocations)
*/
-struct vsm_chunk *vsm_iter0(struct VSM_data *vd);
-void vsm_itern(const struct VSM_data *vd, struct vsm_chunk **pp);
+struct VSM_chunk *VSM_iter0(struct VSM_data *vd);
+void VSM_itern(const struct VSM_data *vd, struct VSM_chunk **pp);
#define VSM_FOREACH(var, vd) \
- for((var) = vsm_iter0((vd)); (var) != NULL; vsm_itern((vd), &(var)))
+ for((var) = VSM_iter0((vd)); (var) != NULL; VSM_itern((vd), &(var)))
/*
* Iterate over all chunks in shared memory
- * var = "struct vsm_chunk *"
+ * var = "struct VSM_chunk *"
* vd = "struct VSM_data"
*/
@@ -173,12 +173,12 @@ int VSC_Open(struct VSM_data *vd, int diag);
* args and returns as VSM_Open()
*/
-struct vsc_main *VSC_Main(struct VSM_data *vd);
+struct VSC_C_main *VSC_Main(struct VSM_data *vd);
/*
* return Main stats structure
*/
-struct vsc_point {
+struct VSC_point {
const char *class; /* stat struct type */
const char *ident; /* stat struct ident */
const char *name; /* field name */
@@ -188,7 +188,7 @@ struct vsc_point {
const volatile void *ptr; /* field value */
};
-typedef int vsc_iter_f(void *priv, const struct vsc_point *const pt);
+typedef int vsc_iter_f(void *priv, const struct VSC_point *const pt);
int VSC_Iter(struct VSM_data *vd, vsc_iter_f *func, void *priv);
/*
@@ -248,16 +248,16 @@ int VSL_Arg(struct VSM_data *vd, int arg, const char *opt);
* 1 Handled.
*/
-typedef int vsl_handler(void *priv, enum vsl_tag tag, unsigned fd,
+typedef int VSL_handler_f(void *priv, enum VSL_tag_e tag, unsigned fd,
unsigned len, unsigned spec, const char *ptr, uint64_t bitmap);
#define VSL_S_CLIENT (1 << 0)
#define VSL_S_BACKEND (1 << 1)
-vsl_handler VSL_H_Print;
+VSL_handler_f VSL_H_Print;
struct VSM_data;
void VSL_Select(const struct VSM_data *vd, unsigned tag);
void VSL_NonBlocking(const struct VSM_data *vd, int nb);
-int VSL_Dispatch(struct VSM_data *vd, vsl_handler *func, void *priv);
+int VSL_Dispatch(struct VSM_data *vd, VSL_handler_f *func, void *priv);
int VSL_NextLog(const struct VSM_data *lh, uint32_t **pp, uint64_t *bitmap);
int VSL_Matched(const struct VSM_data *vd, uint64_t bitmap);
extern const char *VSL_tags[256];
diff --git a/include/vin.h b/include/vin.h
index f0e0d95..17ff389 100644
--- a/include/vin.h
+++ b/include/vin.h
@@ -32,5 +32,5 @@
#define VIN_H_INCLUDED
/* This function lives in both libvarnish and libvarnishapi */
-int vin_n_arg(const char *n_arg, char **name, char **dir, char **vsl);
+int VIN_N_Arg(const char *n_arg, char **name, char **dir, char **vsl);
#endif
diff --git a/include/vsc.h b/include/vsc.h
index 1e714c7..498f9df 100644
--- a/include/vsc.h
+++ b/include/vsc.h
@@ -40,7 +40,7 @@
#define VSC_F(n, t, l, f, e) t n;
-#define VSC_DO(u,l,t) struct vsc_##l {
+#define VSC_DO(u,l,t) struct VSC_C_##l {
#define VSC_DONE(u,l,t) };
#include "vsc_all.h"
diff --git a/include/vsl.h b/include/vsl.h
index 222167a..24acfa6 100644
--- a/include/vsl.h
+++ b/include/vsl.h
@@ -65,7 +65,7 @@
* The identifiers in shmlogtag are "SLT_" + XML tag. A script may be run
* on this file to extract the table rather than handcode it
*/
-enum vsl_tag {
+enum VSL_tag_e {
#define SLTM(foo) SLT_##foo,
#include "vsl_tags.h"
#undef SLTM
diff --git a/include/vsm.h b/include/vsm.h
index 0f67b1e..62f3b48 100644
--- a/include/vsm.h
+++ b/include/vsm.h
@@ -43,7 +43,7 @@
* This structure describes each allocation from the shmlog
*/
-struct vsm_chunk {
+struct VSM_chunk {
#define VSM_CHUNK_MAGIC 0x43907b6e /* From /dev/random */
unsigned magic;
unsigned len;
@@ -56,7 +56,7 @@ struct vsm_chunk {
#define VSM_NEXT(sha) ((void*)((uintptr_t)(sha) + (sha)->len))
#define VSM_PTR(sha) ((void*)((uintptr_t)((sha) + 1)))
-struct vsm_head {
+struct VSM_head {
#define VSM_HEAD_MAGIC 4185512502U /* From /dev/random */
unsigned magic;
@@ -73,7 +73,7 @@ struct vsm_head {
unsigned alloc_seq;
/* Must be last element */
- struct vsm_chunk head;
+ struct VSM_chunk head;
};
/*
@@ -82,20 +82,20 @@ struct vsm_head {
*/
#ifdef CHECK_OBJ_NOTNULL
-static inline struct vsm_chunk *
+static inline struct VSM_chunk *
vsm_iter_0(void)
{
- CHECK_OBJ_NOTNULL(vsm_head, VSM_HEAD_MAGIC);
- CHECK_OBJ_NOTNULL(&vsm_head->head, VSM_CHUNK_MAGIC);
- return (&vsm_head->head);
+ CHECK_OBJ_NOTNULL(VSM_head, VSM_HEAD_MAGIC);
+ CHECK_OBJ_NOTNULL(&VSM_head->head, VSM_CHUNK_MAGIC);
+ return (&VSM_head->head);
}
static inline void
-vsm_iter_n(struct vsm_chunk **pp)
+vsm_iter_n(struct VSM_chunk **pp)
{
- CHECK_OBJ_NOTNULL(vsm_head, VSM_HEAD_MAGIC);
+ CHECK_OBJ_NOTNULL(VSM_head, VSM_HEAD_MAGIC);
CHECK_OBJ_NOTNULL(*pp, VSM_CHUNK_MAGIC);
*pp = VSM_NEXT(*pp);
if (*pp >= vsm_end) {
diff --git a/lib/libvarnish/vin.c b/lib/libvarnish/vin.c
index 8ebd5fd..d05a581 100644
--- a/lib/libvarnish/vin.c
+++ b/lib/libvarnish/vin.c
@@ -41,7 +41,7 @@
#include "vin.h"
int
-vin_n_arg(const char *n_arg, char **name, char **dir, char **vsl)
+VIN_N_Arg(const char *n_arg, char **name, char **dir, char **vsl)
{
char nm[PATH_MAX];
char dn[PATH_MAX];
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index 2902e13..907a4d0 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -85,7 +85,7 @@ VSC_Setup(struct VSM_data *vd)
/*--------------------------------------------------------------------*/
void
-vsc_delete(struct VSM_data *vd)
+VSC_Delete(struct VSM_data *vd)
{
struct vsc_sf *sf;
struct vsc *vsc;
@@ -219,15 +219,15 @@ VSC_Open(struct VSM_data *vd, int diag)
/*--------------------------------------------------------------------*/
-struct vsc_main *
+struct VSC_C_main *
VSC_Main(struct VSM_data *vd)
{
- struct vsm_chunk *sha;
+ struct VSM_chunk *sha;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
CHECK_OBJ_NOTNULL(vd->vsc, VSC_MAGIC);
- sha = vsm_find_alloc(vd, VSC_CLASS, "", "");
+ sha = VSM_find_alloc(vd, VSC_CLASS, "", "");
assert(sha != NULL);
return (VSM_PTR(sha));
}
@@ -251,7 +251,7 @@ iter_test(const char *s1, const char *s2, int wc)
static int
iter_call(const struct vsc *vsc, vsc_iter_f *func, void *priv,
- const struct vsc_point *const sp)
+ const struct VSC_point *const sp)
{
struct vsc_sf *sf;
int good;
@@ -282,11 +282,11 @@ iter_call(const struct vsc *vsc, vsc_iter_f *func, void *priv,
#define VSC_DO(U,l,t) \
static int \
- iter_##l(const struct vsc *vsc, struct vsm_chunk *sha, \
+ iter_##l(const struct vsc *vsc, struct VSM_chunk *sha, \
vsc_iter_f *func, void *priv) \
{ \
- struct vsc_##l *st; \
- struct vsc_point sp; \
+ struct VSC_C_##l *st; \
+ struct VSC_point sp; \
int i; \
\
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); \
@@ -318,7 +318,7 @@ int
VSC_Iter(struct VSM_data *vd, vsc_iter_f *func, void *priv)
{
struct vsc *vsc;
- struct vsm_chunk *sha;
+ struct VSM_chunk *sha;
int i;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index 23d2ff7..e6ba5ae 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -93,7 +93,7 @@ VSL_Setup(struct VSM_data *vd)
/*--------------------------------------------------------------------*/
void
-vsl_delete(struct VSM_data *vd)
+VSL_Delete(struct VSM_data *vd)
{
struct vsl *vsl;
@@ -279,7 +279,7 @@ VSL_NextLog(const struct VSM_data *vd, uint32_t **pp, uint64_t *mb)
/*--------------------------------------------------------------------*/
int
-VSL_Dispatch(struct VSM_data *vd, vsl_handler *func, void *priv)
+VSL_Dispatch(struct VSM_data *vd, VSL_handler_f *func, void *priv)
{
struct vsl *vsl;
int i;
@@ -313,7 +313,7 @@ VSL_Dispatch(struct VSM_data *vd, vsl_handler *func, void *priv)
/*--------------------------------------------------------------------*/
int
-VSL_H_Print(void *priv, enum vsl_tag tag, unsigned fd, unsigned len,
+VSL_H_Print(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
unsigned spec, const char *ptr, uint64_t bitmap)
{
FILE *fo = priv;
@@ -344,15 +344,15 @@ VSL_H_Print(void *priv, enum vsl_tag tag, unsigned fd, unsigned len,
/*--------------------------------------------------------------------*/
void
-vsl_open_cb(struct VSM_data *vd)
+VSL_Open_CallBack(struct VSM_data *vd)
{
struct vsl *vsl;
- struct vsm_chunk *sha;
+ struct VSM_chunk *sha;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
vsl = vd->vsl;
CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC);
- sha = vsm_find_alloc(vd, VSL_CLASS, "", "");
+ sha = VSM_find_alloc(vd, VSL_CLASS, "", "");
assert(sha != NULL);
vsl->log_start = VSM_PTR(sha);
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index b0adc96..cb96782 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -63,7 +63,7 @@ VSM_New(void)
ALLOC_OBJ(vd, VSM_MAGIC);
AN(vd);
- vd->diag = (vsm_diag_f*)fprintf;
+ vd->diag = (VSM_diag_f*)fprintf;
vd->priv = stderr;
vd->vsm_fd = -1;
@@ -75,12 +75,12 @@ VSM_New(void)
/*--------------------------------------------------------------------*/
void
-VSM_Diag(struct VSM_data *vd, vsm_diag_f *func, void *priv)
+VSM_Diag(struct VSM_data *vd, VSM_diag_f *func, void *priv)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
if (func == NULL)
- vd->diag = (vsm_diag_f*)getpid;
+ vd->diag = (VSM_diag_f*)getpid;
else
vd->diag = func;
vd->priv = priv;
@@ -95,7 +95,7 @@ VSM_n_Arg(struct VSM_data *vd, const char *opt)
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
REPLACE(vd->n_opt, opt);
AN(vd->n_opt);
- if (vin_n_arg(vd->n_opt, NULL, NULL, &vd->fname)) {
+ if (VIN_N_Arg(vd->n_opt, NULL, NULL, &vd->fname)) {
vd->diag(vd->priv, "Invalid instance name: %s\n",
strerror(errno));
return (-1);
@@ -127,9 +127,9 @@ VSM_Delete(struct VSM_data *vd)
free(vd->fname);
if (vd->vsc != NULL)
- vsc_delete(vd);
+ VSC_Delete(vd);
if (vd->vsl != NULL)
- vsl_delete(vd);
+ VSL_Delete(vd);
free(vd);
}
@@ -140,10 +140,10 @@ static int
vsm_open(struct VSM_data *vd, int diag)
{
int i, j;
- struct vsm_head slh;
+ struct VSM_head slh;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- AZ(vd->vsm_head);
+ AZ(vd->VSM_head);
AN(vd->fname);
vd->vsm_fd = open(vd->fname, O_RDONLY);
@@ -182,15 +182,15 @@ vsm_open(struct VSM_data *vd, int diag)
return (1);
}
- vd->vsm_head = (void *)mmap(NULL, slh.shm_size,
+ vd->VSM_head = (void *)mmap(NULL, slh.shm_size,
PROT_READ, MAP_SHARED|MAP_HASSEMAPHORE, vd->vsm_fd, 0);
- if (vd->vsm_head == MAP_FAILED) {
+ if (vd->VSM_head == MAP_FAILED) {
if (diag)
vd->diag(vd->priv, "Cannot mmap %s: %s\n",
vd->fname, strerror(errno));
return (1);
}
- vd->vsm_end = (uint8_t *)vd->vsm_head + slh.shm_size;
+ vd->vsm_end = (uint8_t *)vd->VSM_head + slh.shm_size;
for (j = 0; j < 20 && slh.alloc_seq == 0; j++)
(void)usleep(50000);
@@ -198,7 +198,7 @@ vsm_open(struct VSM_data *vd, int diag)
if (diag)
vd->diag(vd->priv, "File not initialized %s\n",
vd->fname);
- assert(0 == munmap((void*)vd->vsm_head, slh.shm_size));
+ assert(0 == munmap((void*)vd->VSM_head, slh.shm_size));
AZ(close(vd->vsm_fd));
vd->vsm_fd = -1;
return (1);
@@ -206,7 +206,7 @@ vsm_open(struct VSM_data *vd, int diag)
vd->alloc_seq = slh.alloc_seq;
if (vd->vsl != NULL)
- vsl_open_cb(vd);
+ VSL_Open_CallBack(vd);
return (0);
}
@@ -218,7 +218,7 @@ VSM_Open(struct VSM_data *vd, int diag)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- AZ(vd->vsm_head);
+ AZ(vd->VSM_head);
if (!vd->n_opt)
VSM_n_Arg(vd, "");
return (vsm_open(vd, diag));
@@ -231,10 +231,10 @@ VSM_Close(struct VSM_data *vd)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- if (vd->vsm_head == NULL)
+ if (vd->VSM_head == NULL)
return;
- assert(0 == munmap((void*)vd->vsm_head, vd->vsm_head->shm_size));
- vd->vsm_head = NULL;
+ assert(0 == munmap((void*)vd->VSM_head, vd->VSM_head->shm_size));
+ vd->VSM_head = NULL;
assert(vd->vsm_fd >= 0);
assert(0 == close(vd->vsm_fd));
vd->vsm_fd = -1;
@@ -249,7 +249,7 @@ VSM_ReOpen(struct VSM_data *vd, int diag)
int i;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- AN(vd->vsm_head);
+ AN(vd->VSM_head);
if (stat(vd->fname, &st))
return (0);
@@ -269,25 +269,25 @@ VSM_ReOpen(struct VSM_data *vd, int diag)
/*--------------------------------------------------------------------*/
-struct vsm_head *
+struct VSM_head *
VSM_Head(const struct VSM_data *vd)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- AN(vd->vsm_head);
- return(vd->vsm_head);
+ AN(vd->VSM_head);
+ return(vd->VSM_head);
}
/*--------------------------------------------------------------------*/
-struct vsm_chunk *
-vsm_find_alloc(struct VSM_data *vd, const char *class, const char *type, const char *ident)
+struct VSM_chunk *
+VSM_find_alloc(struct VSM_data *vd, const char *class, const char *type, const char *ident)
{
- struct vsm_chunk *sha;
+ struct VSM_chunk *sha;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- AN(vd->vsm_head);
+ AN(vd->VSM_head);
VSM_FOREACH(sha, vd) {
CHECK_OBJ_NOTNULL(sha, VSM_CHUNK_MAGIC);
if (strcmp(sha->class, class))
@@ -307,10 +307,10 @@ void *
VSM_Find_Chunk(struct VSM_data *vd, const char *class, const char *type,
const char *ident, unsigned *lenp)
{
- struct vsm_chunk *sha;
+ struct VSM_chunk *sha;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- sha = vsm_find_alloc(vd, class, type, ident);
+ sha = VSM_find_alloc(vd, class, type, ident);
if (sha == NULL)
return (NULL);
if (lenp != NULL)
@@ -320,26 +320,26 @@ VSM_Find_Chunk(struct VSM_data *vd, const char *class, const char *type,
/*--------------------------------------------------------------------*/
-struct vsm_chunk *
-vsm_iter0(struct VSM_data *vd)
+struct VSM_chunk *
+VSM_iter0(struct VSM_data *vd)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- vd->alloc_seq = vd->vsm_head->alloc_seq;
+ vd->alloc_seq = vd->VSM_head->alloc_seq;
while (vd->alloc_seq == 0) {
usleep(50000);
- vd->alloc_seq = vd->vsm_head->alloc_seq;
+ vd->alloc_seq = vd->VSM_head->alloc_seq;
}
- CHECK_OBJ_NOTNULL(&vd->vsm_head->head, VSM_CHUNK_MAGIC);
- return (&vd->vsm_head->head);
+ CHECK_OBJ_NOTNULL(&vd->VSM_head->head, VSM_CHUNK_MAGIC);
+ return (&vd->VSM_head->head);
}
void
-vsm_itern(const struct VSM_data *vd, struct vsm_chunk **pp)
+VSM_itern(const struct VSM_data *vd, struct VSM_chunk **pp)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- if (vd->alloc_seq != vd->vsm_head->alloc_seq) {
+ if (vd->alloc_seq != vd->VSM_head->alloc_seq) {
*pp = NULL;
return;
}
@@ -358,5 +358,5 @@ VSM_Seq(struct VSM_data *vd)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- return (vd->vsm_head->alloc_seq);
+ return (vd->VSM_head->alloc_seq);
}
diff --git a/lib/libvarnishapi/vsm_api.h b/lib/libvarnishapi/vsm_api.h
index f88e0ee..30f2926 100644
--- a/lib/libvarnishapi/vsm_api.h
+++ b/lib/libvarnishapi/vsm_api.h
@@ -38,7 +38,7 @@ struct VSM_data {
unsigned magic;
#define VSM_MAGIC 0x6e3bd69b
- vsm_diag_f *diag;
+ VSM_diag_f *diag;
void *priv;
char *n_opt;
@@ -48,7 +48,7 @@ struct VSM_data {
struct stat fstat;
int vsm_fd;
- struct vsm_head *vsm_head;
+ struct VSM_head *VSM_head;
void *vsm_end;
unsigned alloc_seq;
@@ -58,9 +58,9 @@ struct VSM_data {
struct vsl *vsl;
};
-struct vsm_chunk *vsm_find_alloc(struct VSM_data *vd, const char *class,
+struct VSM_chunk *VSM_find_alloc(struct VSM_data *vd, const char *class,
const char *type, const char *ident);
-void vsc_delete(struct VSM_data *vd);
-void vsl_delete(struct VSM_data *vd);
-void vsl_open_cb(struct VSM_data *vd);
+void VSC_Delete(struct VSM_data *vd);
+void VSL_Delete(struct VSM_data *vd);
+void VSL_Open_CallBack(struct VSM_data *vd);
More information about the varnish-commit
mailing list