[master] 57fed77 Add a LRU_Free() function

Poul-Henning Kamp phk at varnish-cache.org
Wed Feb 9 14:50:27 CET 2011


commit 57fed777acfb201560f85f7f6c40df6588f52368
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Feb 9 13:50:16 2011 +0000

    Add a LRU_Free() function

diff --git a/bin/varnishd/stevedore.c b/bin/varnishd/stevedore.c
index 5dd9982..912fd68 100644
--- a/bin/varnishd/stevedore.c
+++ b/bin/varnishd/stevedore.c
@@ -55,12 +55,6 @@ static const struct stevedore * volatile stv_next;
 static struct stevedore *stv_transient;
 
 /*--------------------------------------------------------------------
- * NB! Dirty trick alert:
- *
- * We use a captive objcore as tail senteniel for LRU lists, but to
- * make sure it does not get into play by accident, we do _not_
- * initialize its magic with OBJCORE_MAGIC.
- *
  */
 
 struct lru *
@@ -75,6 +69,14 @@ LRU_Alloc(void)
 	return (l);
 }
 
+void
+LRU_Free(struct lru *lru)
+{
+	CHECK_OBJ_NOTNULL(lru, LRU_MAGIC);
+	Lck_Delete(&lru->mtx);
+	FREE_OBJ(lru);
+}
+
 /*--------------------------------------------------------------------
  * XXX: trust pointer writes to be atomic
  */
diff --git a/bin/varnishd/stevedore.h b/bin/varnishd/stevedore.h
index c0c3c31..e97d70f 100644
--- a/bin/varnishd/stevedore.h
+++ b/bin/varnishd/stevedore.h
@@ -102,6 +102,7 @@ void STV_Config_Transient(void);
 void STV_Freestore(struct object *o);
 
 struct lru *LRU_Alloc(void);
+void LRU_Free(struct lru *lru);
 
 int STV_GetFile(const char *fn, int *fdp, const char **fnp, const char *ctx);
 uintmax_t STV_FileSize(int fd, const char *size, unsigned *granularity,



More information about the varnish-commit mailing list