[master] 5cbd8ca Make Varnish API aware of the new structure and make everything compile again. Much still outstanding.
Poul-Henning Kamp
phk at varnish-cache.org
Mon Nov 21 00:39:23 CET 2011
commit 5cbd8caab0650ab4178a5b387667fa8fc0672744
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sun Nov 20 16:11:50 2011 +0000
Make Varnish API aware of the new structure and make everything compile
again. Much still outstanding.
diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c
index d0ef409..2fe7ffb 100644
--- a/bin/varnishstat/varnishstat.c
+++ b/bin/varnishstat/varnishstat.c
@@ -289,6 +289,7 @@ main(int argc, char * const *argv)
exit(1);
VSC_C_main = VSC_Main(vd);
+ AN(VSC_C_main);
if (!(xml || json || once)) {
do_curses(vd, VSC_C_main, delay);
diff --git a/include/vapi/vsc.h b/include/vapi/vsc.h
index bc52d65..ac711ea 100644
--- a/include/vapi/vsc.h
+++ b/include/vapi/vsc.h
@@ -42,11 +42,14 @@ struct VSM_data;
void VSC_Setup(struct VSM_data *vd);
/*
* Setup vd for use with VSC functions.
+ * Must be called once before any other VSC function is called
*/
#define VSC_ARGS "f:n:"
#define VSC_n_USAGE VSM_n_USAGE
-#define VSC_USAGE VSC_N_USAGE
+#define VSC_f_USAGE "[-f field_name,...]"
+#define VSC_USAGE VSC_n_USAGE \
+ VSC_f_USAGE
int VSC_Arg(struct VSM_data *vd, int arg, const char *opt);
/*
@@ -66,6 +69,7 @@ int VSC_Open(struct VSM_data *vd, int diag);
struct VSC_C_main *VSC_Main(struct VSM_data *vd);
/*
* return Main stats structure
+ * returns NULL until child has been started.
*/
struct VSC_point {
diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h
index 9c9a4c9..fb02051 100644
--- a/include/vapi/vsl.h
+++ b/include/vapi/vsl.h
@@ -42,11 +42,12 @@ struct VSM_data;
void VSL_Setup(struct VSM_data *vd);
/*
* Setup vd for use with VSL functions.
+ * Must be called once before any other VSL function is called.
*/
int VSL_Open(struct VSM_data *vd, int diag);
/*
- * Attempt to open and map the shared memory file.
+ * Attempt to open the VSM (unless -r given)
* If diag is non-zero, diagnostics are emitted.
* Returns:
* 0 on success
diff --git a/include/vapi/vsm.h b/include/vapi/vsm.h
index 275f6d9..50a7dde 100644
--- a/include/vapi/vsm.h
+++ b/include/vapi/vsm.h
@@ -26,6 +26,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
+ * This is the public API for the VSM/VSC/VSL access.
+ *
*/
#ifndef VAPI_VSM_H_INCLUDED
@@ -35,10 +37,14 @@ struct VSM_head;
struct VSM_chunk;
struct VSM_data;
+/*
+ * This structure is used to reference a VSM chunk
+ */
+
struct VSM_fantom {
struct VSM_chunk *chunk;
- void *b;
- void *e;
+ void *b; /* first byte of payload */
+ void *e; /* first byte past payload */
uintptr_t priv;
};
@@ -120,12 +126,31 @@ struct VSM_head *VSM_Head(const struct VSM_data *vd);
* Return the head of the VSM.
*/
-void *VSM_Find_Chunk(struct VSM_data *vd, const char *class,
- const char *type, const char *ident, unsigned *lenp);
+void VSM__iter0(struct VSM_data *vd, struct VSM_fantom *vf);
+int VSM__itern(struct VSM_data *vd, struct VSM_fantom *vf);
+
+#define VSM_FOREACH_SAFE(vf, vd) \
+ for(VSM__iter0((vd), (vf)); VSM__itern((vd), (vf));)
/*
- * Find a given chunk in the shared memory.
- * Returns pointer or NULL.
- * Lenp, if non-NULL, is set to length of chunk.
+ * Iterate over all chunks in shared memory
+ * vf = "struct VSM_fantom *"
+ * vd = "struct VSM_data *"
+ */
+
+int VSM_StillValid(struct VSM_data *vd, struct VSM_fantom *vf);
+ /*
+ * Return:
+ * 0: fantom is invalid now.
+ * 1: fantom is still the same.
+ * 2: a fantom with same dimensions exist, check class/type/ident
+ */
+
+int VSM_Get(struct VSM_data *vd, struct VSM_fantom *vf, const char *class,
+ const char *type, const char *ident);
+ /*
+ * Find a chunk, produce fantom for it.
+ * Returns zero on failure.
+ * class is mandatory, type and ident optional.
*/
void VSM_Close(struct VSM_data *vd);
@@ -134,9 +159,28 @@ void VSM_Close(struct VSM_data *vd);
* Deallocate all storage (including VSC and VSL allocations)
*/
+/**********************************************************************
+ * These are old API functions which are less safe because there is
+ * fantom protecting the chunks worked on.
+ * They will g
+ */
+
+/* OBSOLETE: Will disappear from Varnish 4.x */
+void *VSM_Find_Chunk(struct VSM_data *vd, const char *class,
+ const char *type, const char *ident, unsigned *lenp);
+ /*
+ * Find a given chunk in the shared memory.
+ * Returns pointer or NULL.
+ * Lenp, if non-NULL, is set to length of chunk.
+ */
+
+/* OBSOLETE: Will disappear from Varnish 4.x */
struct VSM_chunk *VSM_iter0(struct VSM_data *vd);
-void VSM_itern(const struct VSM_data *vd, struct VSM_chunk **pp);
+/* OBSOLETE: Will disappear from Varnish 4.x */
+void VSM_itern(struct VSM_data *vd, struct VSM_chunk **pp);
+
+/* OBSOLETE: Will disappear from Varnish 4.x */
#define VSM_FOREACH(var, vd) \
for((var) = VSM_iter0((vd)); (var) != NULL; VSM_itern((vd), &(var)))
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index eea7f5c..1e2206b 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -79,7 +79,6 @@ VSC_Setup(struct VSM_data *vd)
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
AZ(vd->vsc);
- AZ(vd->vsl);
ALLOC_OBJ(vd->vsc, VSC_MAGIC);
AN(vd->vsc);
VTAILQ_INIT(&vd->vsc->sf_list);
@@ -225,14 +224,14 @@ VSC_Open(struct VSM_data *vd, int diag)
struct VSC_C_main *
VSC_Main(struct VSM_data *vd)
{
- struct VSM_chunk *sha;
+ struct VSM_fantom vf;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
CHECK_OBJ_NOTNULL(vd->vsc, VSC_MAGIC);
- sha = VSM_find_alloc(vd, VSC_CLASS, "", "");
- assert(sha != NULL);
- return (VSM_PTR(sha));
+ if (!VSM_Get(vd, &vf, VSC_CLASS, "", ""))
+ return (NULL);
+ return ((void*)vf.b);
}
/*--------------------------------------------------------------------
@@ -285,7 +284,7 @@ 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_fantom *vf, \
VSC_iter_f *func, void *priv) \
{ \
struct VSC_C_##l *st; \
@@ -293,10 +292,9 @@ iter_call(const struct vsc *vsc, VSC_iter_f *func, void *priv,
int i; \
\
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); \
- CHECK_OBJ_NOTNULL(sha, VSM_CHUNK_MAGIC); \
- st = VSM_PTR(sha); \
+ st = vf->b; \
sp.class = t; \
- sp.ident = sha->ident;
+ sp.ident = vf->chunk->ident;
#define VSC_F(nn,tt,ll,ff,dd,ee) \
sp.name = #nn; \
@@ -321,24 +319,22 @@ int
VSC_Iter(struct VSM_data *vd, VSC_iter_f *func, void *priv)
{
struct vsc *vsc;
- struct VSM_chunk *sha;
+ struct VSM_fantom vf;
int i;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
vsc = vd->vsc;
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC);
-
i = 0;
- VSM_FOREACH(sha, vd) {
- CHECK_OBJ_NOTNULL(sha, VSM_CHUNK_MAGIC);
- if (strcmp(sha->class, VSC_CLASS))
+ VSM_FOREACH_SAFE(&vf, vd) {
+ if (strcmp(vf.chunk->class, VSC_CLASS))
continue;
/*lint -save -e525 -e539 */
#define VSC_F(n,t,l,f,d,e)
#define VSC_DONE(a,b,c)
#define VSC_DO(U,l,t) \
- if (!strcmp(sha->type, t)) { \
- i = iter_##l(vsc, sha, func, priv); \
+ if (!strcmp(vf.chunk->type, t)) { \
+ i = iter_##l(vsc, &vf, func, priv); \
if (!i) \
continue; \
}
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index b17cd36..d896301 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -67,25 +67,14 @@ VSL_Setup(struct VSM_data *vd)
struct vsl *vsl;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- AZ(vd->vsc);
AZ(vd->vsl);
- ALLOC_OBJ(vsl, VSL_MAGIC);
- AN(vsl);
-
- vd->vsl = vsl;
-
+ ALLOC_OBJ(vd->vsl, VSL_MAGIC);
+ AN(vd->vsl);
+ vsl = vd->vsl;
vsl->regflags = 0;
-
- /* XXX: Allocate only if log access */
vsl->vbm_supress = vbit_init(256);
vsl->vbm_select = vbit_init(256);
-
vsl->r_fd = -1;
- /* XXX: Allocate only if -r option given ? */
- vsl->rbuflen = 256; /* XXX ?? */
- vsl->rbuf = malloc(vsl->rbuflen * 4L);
- assert(vsl->rbuf != NULL);
-
vsl->num_matchers = 0;
VTAILQ_INIT(&vsl->matchers);
}
@@ -343,28 +332,6 @@ VSL_H_Print(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
/*--------------------------------------------------------------------*/
-void
-VSL_Open_CallBack(struct VSM_data *vd)
-{
- struct vsl *vsl;
- 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, "", "");
- assert(sha != NULL);
-
- vsl->log_start = VSM_PTR(sha);
- vsl->log_end = VSM_NEXT(sha);
- vsl->log_ptr = vsl->log_start + 1;
-
- vsl->last_seq = vsl->log_start[0];
- VRMB();
-}
-
-/*--------------------------------------------------------------------*/
-
int
VSL_Open(struct VSM_data *vd, int diag)
{
@@ -379,11 +346,21 @@ VSL_Open(struct VSM_data *vd, int diag)
i = VSM_Open(vd, diag);
if (i)
return (i);
- }
-
- if (!vsl->d_opt && vsl->r_fd == -1) {
- while (*vsl->log_ptr != VSL_ENDMARKER)
- vsl->log_ptr = VSL_NEXT(vsl->log_ptr);
+ if (!VSM_Get(vd, &vsl->vf, VSL_CLASS, NULL, NULL)) {
+ VSM_Close(vd);
+ if (diag)
+ vd->diag(vd->priv,
+ "No VSL chunk found "
+ " (child not started ?)\n");
+ return (1);
+ }
+ vsl->log_start = vsl->vf.b;
+ vsl->log_end = vsl->vf.e;
+ vsl->log_ptr = vsl->log_start + 1;
+ if (!vsl->d_opt) {
+ while (*vsl->log_ptr != VSL_ENDMARKER)
+ vsl->log_ptr = VSL_NEXT(vsl->log_ptr);
+ }
}
return (0);
}
diff --git a/lib/libvarnishapi/vsl_api.h b/lib/libvarnishapi/vsl_api.h
index aa3d0f4..013d1ae 100644
--- a/lib/libvarnishapi/vsl_api.h
+++ b/lib/libvarnishapi/vsl_api.h
@@ -30,6 +30,10 @@
#include "vqueue.h"
+#define SLEEP_USEC (50*1000)
+#define TIMEOUT_USEC (5*1000*1000)
+
+
struct vsl_re_match {
unsigned magic;
#define VSL_RE_MATCH_MAGIC 0x4013151e
@@ -42,6 +46,8 @@ struct vsl {
unsigned magic;
#define VSL_MAGIC 0x7a31db38
+ struct VSM_fantom vf;
+
/* Stuff relating the log records below here */
volatile uint32_t *log_start;
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index 97e3847..1669278 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -141,7 +141,7 @@ VSM_Delete(struct VSM_data *vd)
*
* Return:
* 0 = sucess
- * 1 = failure
+ * <0 = failure
*
*/
@@ -150,9 +150,10 @@ vsm_open(struct VSM_data *vd, int diag)
{
int i;
struct VSM_head slh;
+ void *v;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- AZ(vd->VSM_head);
+ AZ(vd->head);
AN(vd->fname);
vd->vsm_fd = open(vd->fname, O_RDONLY);
@@ -160,7 +161,7 @@ vsm_open(struct VSM_data *vd, int diag)
if (diag)
vd->diag(vd->priv, "Cannot open %s: %s\n",
vd->fname, strerror(errno));
- return (1);
+ return (-1);
}
AZ(fstat(vd->vsm_fd, &vd->fstat));
@@ -170,7 +171,7 @@ vsm_open(struct VSM_data *vd, int diag)
vd->fname);
AZ(close(vd->vsm_fd));
vd->vsm_fd = -1;
- return (1);
+ return (-1);
}
i = read(vd->vsm_fd, &slh, sizeof slh);
@@ -180,33 +181,33 @@ vsm_open(struct VSM_data *vd, int diag)
vd->fname, strerror(errno));
AZ(close(vd->vsm_fd));
vd->vsm_fd = -1;
- return (1);
+ return (-1);
}
- if (slh.magic != VSM_HEAD_MAGIC || slh.alloc_seq == 0) {
+
+ if (memcmp(slh.marker, VSM_HEAD_MARKER, sizeof slh.marker) ||
+ slh.alloc_seq == 0) {
if (diag)
- vd->diag(vd->priv, "Not a ready VSM file %s\n",
+ vd->diag(vd->priv, "Not a VSM file %s\n",
vd->fname);
AZ(close(vd->vsm_fd));
vd->vsm_fd = -1;
- return (1);
+ return (-1);
}
- vd->VSM_head = mmap(NULL, slh.shm_size,
+ v = mmap(NULL, slh.shm_size,
PROT_READ, MAP_SHARED|MAP_HASSEMAPHORE, vd->vsm_fd, 0);
- if (vd->VSM_head == MAP_FAILED) {
+ if (v == MAP_FAILED) {
if (diag)
vd->diag(vd->priv, "Cannot mmap %s: %s\n",
vd->fname, strerror(errno));
AZ(close(vd->vsm_fd));
vd->vsm_fd = -1;
- vd->VSM_head = NULL;
- return (1);
+ return (-1);
}
- vd->vsm_end = (uint8_t *)vd->VSM_head + slh.shm_size;
- vd->my_alloc_seq = vd->VSM_head->alloc_seq;
+ vd->head = v;
+ vd->b = v;
+ vd->e = vd->b + slh.shm_size;
- if (vd->vsl != NULL)
- VSL_Open_CallBack(vd);
return (0);
}
@@ -218,7 +219,7 @@ VSM_Open(struct VSM_data *vd, int diag)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- AZ(vd->VSM_head);
+ AZ(vd->head);
if (!vd->n_opt)
(void)VSM_n_Arg(vd, "");
return (vsm_open(vd, diag));
@@ -231,11 +232,14 @@ VSM_Close(struct VSM_data *vd)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- if (vd->VSM_head == NULL)
+ if (vd->head == NULL)
return;
- AZ(munmap((void*)vd->VSM_head, vd->VSM_head->shm_size));
- vd->VSM_head = NULL;
+
assert(vd->vsm_fd >= 0);
+ AZ(munmap((void*)vd->b, vd->e - vd->b));
+ vd->b = NULL;
+ vd->e = NULL;
+ vd->head = NULL;
AZ(close(vd->vsm_fd));
vd->vsm_fd = -1;
}
@@ -246,25 +250,28 @@ int
VSM_ReOpen(struct VSM_data *vd, int diag)
{
struct stat st;
- int i;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- AN(vd->VSM_head);
-
- if (stat(vd->fname, &st))
- return (0);
+ AN(vd->head);
- if (st.st_dev == vd->fstat.st_dev && st.st_ino == vd->fstat.st_ino)
+ if (vd->head->alloc_seq &&
+ !stat(vd->fname, &st) &&
+ st.st_dev == vd->fstat.st_dev &&
+ st.st_ino == vd->fstat.st_ino)
return (0);
VSM_Close(vd);
- for (i = 0; i < 5; i++) { /* XXX param */
- if (!vsm_open(vd, 0))
- return (1);
- }
- if (vsm_open(vd, diag))
- return (-1);
- return (1);
+ return (vsm_open(vd, diag));
+}
+
+/*--------------------------------------------------------------------*/
+
+unsigned
+VSM_Seq(const struct VSM_data *vd)
+{
+
+ CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
+ return (vd->head->alloc_seq);
}
/*--------------------------------------------------------------------*/
@@ -274,31 +281,87 @@ VSM_Head(const struct VSM_data *vd)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- AN(vd->VSM_head);
- return(vd->VSM_head);
+ AN(vd->head);
+ return(vd->head);
+}
+
+/*--------------------------------------------------------------------*/
+
+void
+VSM__iter0(struct VSM_data *vd, struct VSM_fantom *vf)
+{
+
+ CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
+ memset(vf, 0, sizeof *vf);
}
+int
+VSM__itern(struct VSM_data *vd, struct VSM_fantom *vf)
+{
+
+ CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
+ if (vf->priv != 0) {
+ if (vf->priv != vd->head->alloc_seq)
+ return (0);
+ if (vf->chunk->len == 0)
+ return (0);
+ if (vf->chunk->next == 0)
+ return (0);
+ vf->chunk = (void*)(vd->b + vf->chunk->next);
+ } else if (vd->head->first == 0) {
+ return (0);
+ } else {
+ vf->chunk = (void*)(vd->b + vd->head->first);
+ }
+ if (memcmp(vf->chunk->marker, VSM_CHUNK_MARKER,
+ sizeof vf->chunk->marker))
+ return (0);
+ vf->priv = vd->head->alloc_seq;
+ vf->b = (void*)(vf->chunk + 1);
+ vf->e = (char*)vf->b + vf->chunk->len;
+ if (vf->b == vf->e)
+ return (0);
+ return (1);
+}
/*--------------------------------------------------------------------*/
-struct VSM_chunk *
-VSM_find_alloc(struct VSM_data *vd, const char *class, const char *type, const char *ident)
+int
+VSM_StillValid(struct VSM_data *vd, struct VSM_fantom *vf)
+{
+ struct VSM_fantom f2;
+
+ CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
+ if (vf->priv == vd->head->alloc_seq)
+ return (1);
+ VSM_FOREACH_SAFE(&f2, vd) {
+ if (f2.chunk == vf->chunk &&
+ f2.b == vf->b &&
+ f2.e == vf->e) {
+ vf->priv = vd->head->alloc_seq;
+ return (2);
+ }
+ }
+ return (0);
+}
+
+int
+VSM_Get(struct VSM_data *vd, struct VSM_fantom *vf, const char *class,
+ const char *type, const char *ident)
{
- struct VSM_chunk *sha;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- AN(vd->VSM_head);
- VSM_FOREACH(sha, vd) {
- CHECK_OBJ_NOTNULL(sha, VSM_CHUNK_MAGIC);
- if (strcmp(sha->class, class))
+ VSM_FOREACH_SAFE(vf, vd) {
+ if (strcmp(vf->chunk->class, class))
continue;
- if (type != NULL && strcmp(sha->type, type))
+ if (type != NULL && strcmp(vf->chunk->type, type))
continue;
- if (ident != NULL && strcmp(sha->ident, ident))
+ if (ident != NULL && strcmp(vf->chunk->ident, ident))
continue;
- return (sha);
+ return (1);
}
- return (NULL);
+ memset(vf, 0, sizeof *vf);
+ return (0);
}
/*--------------------------------------------------------------------*/
@@ -307,15 +370,16 @@ 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_fantom vf;
- CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- sha = VSM_find_alloc(vd, class, type, ident);
- if (sha == NULL)
- return (NULL);
+ if (VSM_Get(vd, &vf, class, type, ident)) {
+ if (lenp != NULL)
+ *lenp = (char*)vf.e - (char*)vf.b;
+ return (vf.chunk);
+ }
if (lenp != NULL)
- *lenp = sha->len - sizeof *sha;
- return (VSM_PTR(sha));
+ *lenp = 0;
+ return (NULL);
}
/*--------------------------------------------------------------------*/
@@ -325,38 +389,19 @@ VSM_iter0(struct VSM_data *vd)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- vd->my_alloc_seq = vd->VSM_head->alloc_seq;
- while (vd->my_alloc_seq == 0) {
- (void)usleep(50000);
- vd->my_alloc_seq = vd->VSM_head->alloc_seq;
- }
- CHECK_OBJ_NOTNULL(&vd->VSM_head->head, VSM_CHUNK_MAGIC);
- return (&vd->VSM_head->head);
+ VSM__iter0(vd, &vd->compat_vf);
+ if (VSM__itern(vd, &vd->compat_vf))
+ return(vd->compat_vf.chunk);
+ return (NULL);
}
void
-VSM_itern(const struct VSM_data *vd, struct VSM_chunk **pp)
+VSM_itern(struct VSM_data *vd, struct VSM_chunk **pp)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- if (vd->my_alloc_seq != vd->VSM_head->alloc_seq) {
- *pp = NULL;
- return;
- }
- CHECK_OBJ_NOTNULL(*pp, VSM_CHUNK_MAGIC);
- *pp = VSM_NEXT(*pp);
- if ((void*)(*pp) >= vd->vsm_end) {
+ if (VSM__itern(vd, &vd->compat_vf))
+ *pp = vd->compat_vf.chunk;
+ else
*pp = NULL;
- return;
- }
- CHECK_OBJ_NOTNULL(*pp, VSM_CHUNK_MAGIC);
-}
-
-/*--------------------------------------------------------------------*/
-unsigned
-VSM_Seq(const struct VSM_data *vd)
-{
-
- CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- return (vd->VSM_head->alloc_seq);
}
diff --git a/lib/libvarnishapi/vsm_api.h b/lib/libvarnishapi/vsm_api.h
index da5222e..84ea523 100644
--- a/lib/libvarnishapi/vsm_api.h
+++ b/lib/libvarnishapi/vsm_api.h
@@ -28,10 +28,6 @@
*
*/
-/* Parameters */
-#define SLEEP_USEC (50*1000)
-#define TIMEOUT_USEC (5*1000*1000)
-
struct vsc;
struct VSM_data {
@@ -47,9 +43,12 @@ struct VSM_data {
struct stat fstat;
int vsm_fd;
- struct VSM_head *VSM_head;
- void *vsm_end;
- unsigned my_alloc_seq;
+ struct VSM_head *head;
+ char *b;
+ char *e;
+
+ /* Stuff for backwards compat */
+ struct VSM_fantom compat_vf;
/* Stuff relating the stats fields start here */
@@ -62,4 +61,3 @@ struct VSM_chunk *VSM_find_alloc(struct VSM_data *vd, const char *class,
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