[master] a5d9851 Introduce a function to initialize a VSL buffer
Poul-Henning Kamp
phk at varnish-cache.org
Mon Feb 13 22:40:40 CET 2012
commit a5d9851ae5120aaa434838dcd576d2af54b74a89
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Feb 13 21:40:29 2012 +0000
Introduce a function to initialize a VSL buffer
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 0ff57c9..dd3b004 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -911,6 +911,7 @@ extern struct VSC_C_main *VSC_C_main;
void VSM_Init(void);
void *VSM_Alloc(unsigned size, const char *class, const char *type,
const char *ident);
+void VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len);
void VSM_Free(void *ptr);
#ifdef VSL_ENDMARKER
void VSL(enum VSL_tag_e tag, int id, const char *fmt, ...)
diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index 461aa97..ab715b7 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -304,6 +304,18 @@ WSLB(struct worker *wrk, enum VSL_tag_e tag, const char *fmt, ...)
/*--------------------------------------------------------------------*/
+void
+VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len)
+{
+ vsl->wlp = ptr;
+ vsl->wlb = ptr;
+ vsl->wle = ptr;
+ vsl->wle += len / sizeof(*vsl->wle);
+ vsl->wlr = 0;
+}
+
+/*--------------------------------------------------------------------*/
+
static void *
vsm_cleaner(void *priv)
{
diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index 591e633..d421740 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -104,8 +104,7 @@ wrk_bgthread(void *arg)
memset(&wrk, 0, sizeof wrk);
sp->wrk = &wrk;
wrk.magic = WORKER_MAGIC;
- wrk.vsl->wlp = wrk.vsl->wlb = logbuf;
- wrk.vsl->wle = logbuf + (sizeof logbuf) / 4;
+ VSL_Setup(wrk.vsl, logbuf, sizeof logbuf);
(void)bt->func(sp, bt->priv);
More information about the varnish-commit
mailing list