r5578 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Mon Nov 22 09:51:04 CET 2010


Author: phk
Date: 2010-11-22 09:51:03 +0100 (Mon, 22 Nov 2010)
New Revision: 5578

Modified:
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/cache_waiter_kqueue.c
   trunk/varnish-cache/bin/varnishd/hash_critbit.c
   trunk/varnish-cache/bin/varnishd/stevedore.c
   trunk/varnish-cache/bin/varnishd/stevedore_utils.c
   trunk/varnish-cache/bin/varnishd/storage_persistent.c
Log:
Style and consistency fixes.



Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-11-21 20:49:15 UTC (rev 5577)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-11-22 08:51:03 UTC (rev 5578)
@@ -249,7 +249,7 @@
 	fprintf(stderr, ">\n");
 }
 
-/**********************************************************************
+/*---------------------------------------------------------------------
  * Insert an object which magically appears out of nowhere or, more likely,
  * comes off some persistent storage device.
  */
@@ -295,7 +295,7 @@
 	return (oc);
 }
 
-/**********************************************************************
+/*---------------------------------------------------------------------
  */
 
 struct objcore *
@@ -454,7 +454,7 @@
 	return (oc);
 }
 
-/**********************************************************************
+/*---------------------------------------------------------------------
  */
 
 static void
@@ -484,7 +484,7 @@
 	}
 }
 
-/**********************************************************************
+/*---------------------------------------------------------------------
  * Purge an entire objhead
  */
 
@@ -542,7 +542,7 @@
 }
 
 
-/**********************************************************************
+/*---------------------------------------------------------------------
  * Kill a busy object we don't need anyway.
  * There may be sessions on the waiting list, so we cannot just blow
  * it out of the water.
@@ -612,7 +612,7 @@
 	Lck_Unlock(&oh->mtx);
 }
 
-/*******************************************************************
+/*--------------------------------------------------------------------
  * Dereference objcore and or object
  *
  * Can deal with:
@@ -693,7 +693,7 @@
 	return (0);
 }
 
-/*******************************************************************
+/*--------------------------------------------------------------------
  * This one is slightly tricky.  This is called from the BAN module
  * to try to wash the object which holds the oldest ban.
  * We compete against HSH_Deref() which comes in the opposite

Modified: trunk/varnish-cache/bin/varnishd/cache_waiter_kqueue.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_waiter_kqueue.c	2010-11-21 20:49:15 UTC (rev 5577)
+++ trunk/varnish-cache/bin/varnishd/cache_waiter_kqueue.c	2010-11-22 08:51:03 UTC (rev 5578)
@@ -51,7 +51,7 @@
 #include "cache_waiter.h"
 
 
-/**********************************************************************/
+/*--------------------------------------------------------------------*/
 
 
 static pthread_t vca_kqueue_thread;

Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_critbit.c	2010-11-21 20:49:15 UTC (rev 5577)
+++ trunk/varnish-cache/bin/varnishd/hash_critbit.c	2010-11-22 08:51:03 UTC (rev 5578)
@@ -45,7 +45,7 @@
 
 static struct lock hcb_mtx;
 
-/**********************************************************************
+/*---------------------------------------------------------------------
  * Table for finding out how many bits two bytes have in common,
  * counting from the MSB towards the LSB.
  * ie:
@@ -80,7 +80,7 @@
 	assert(hcb_bits(0x10, 0x0b) == 3);
 }
 
-/**********************************************************************
+/*---------------------------------------------------------------------
  * For space reasons we overload the two pointers with two different
  * kinds of of pointers.  We cast them to uintptr_t's and abuse the
  * low two bits to tell them apart, assuming that Varnish will never
@@ -113,7 +113,7 @@
 static VTAILQ_HEAD(, objhead)	cool_h = VTAILQ_HEAD_INITIALIZER(cool_h);
 static VTAILQ_HEAD(, objhead)	dead_h = VTAILQ_HEAD_INITIALIZER(dead_h);
 
-/**********************************************************************
+/*---------------------------------------------------------------------
  * Pointer accessor functions
  */
 static int
@@ -165,7 +165,7 @@
 	return ((struct hcb_y *)(u & ~HCB_BIT_Y));
 }
 
-/**********************************************************************
+/*---------------------------------------------------------------------
  * Find the "critical" bit that separates these two digests
  */
 
@@ -186,7 +186,7 @@
 	return (y->critbit);
 }
 
-/*********************************************************************
+/*---------------------------------------------------------------------
  * Unless we have the lock, we need to be very careful about pointer
  * references into the tree, we cannot trust things to be the same
  * in two consequtive memory accesses.
@@ -267,7 +267,7 @@
 	return(oh);
 }
 
-/**********************************************************************/
+/*--------------------------------------------------------------------*/
 
 static void
 hcb_delete(struct hcb_root *r, struct objhead *oh)
@@ -299,7 +299,7 @@
 	}
 }
 
-/**********************************************************************/
+/*--------------------------------------------------------------------*/
 
 static void
 dumptree(struct cli *cli, uintptr_t p, int indent)
@@ -343,7 +343,7 @@
 	{ NULL }
 };
 
-/**********************************************************************/
+/*--------------------------------------------------------------------*/
 
 static void *
 hcb_cleaner(void *priv)
@@ -376,7 +376,7 @@
 	NEEDLESS_RETURN(NULL);
 }
 
-/**********************************************************************/
+/*--------------------------------------------------------------------*/
 
 static void
 hcb_start(void)

Modified: trunk/varnish-cache/bin/varnishd/stevedore.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.c	2010-11-21 20:49:15 UTC (rev 5577)
+++ trunk/varnish-cache/bin/varnishd/stevedore.c	2010-11-22 08:51:03 UTC (rev 5578)
@@ -55,7 +55,7 @@
 
 static struct stevedore *stv_transient;
 
-/*********************************************************************
+/*--------------------------------------------------------------------
  * NB! Dirty trick alert:
  *
  * We use a captive objcore as tail senteniel for LRU lists, but to
@@ -76,7 +76,7 @@
 	return (l);
 }
 
-/*********************************************************************
+/*--------------------------------------------------------------------
  * XXX: trust pointer writes to be atomic
  */
 
@@ -97,7 +97,7 @@
 	return (stv);
 }
 
-/*********************************************************************/
+/*-------------------------------------------------------------------*/
 
 static struct storage *
 stv_alloc(const struct sess *sp, size_t size)
@@ -143,7 +143,7 @@
 }
 
 
-/*********************************************************************
+/*-------------------------------------------------------------------*
  * Structure used to transport internal knowledge from STV_NewObject()
  * to STV_MkObject().  Nobody else should mess with this struct.
  */
@@ -157,7 +157,7 @@
 	double		ttl;
 };
 
-/*********************************************************************
+/*--------------------------------------------------------------------
  * This function is called by stevedores ->allocobj() method, which
  * very often will be stv_default_allocobj() below, to convert a slab
  * of storage into object which the stevedore can then register in its
@@ -212,7 +212,7 @@
 	return (o);
 }
 
-/*********************************************************************
+/*--------------------------------------------------------------------
  * This is the default ->allocobj() which all stevedores who do not
  * implement persistent storage can rely on.
  */
@@ -235,7 +235,7 @@
 	return (o);
 }
 
-/*********************************************************************/
+/*-------------------------------------------------------------------*/
 
 struct object *
 STV_NewObject(struct sess *sp, unsigned wsl, double ttl, unsigned nhttp)
@@ -305,7 +305,7 @@
 	.freeobj = default_oc_freeobj,
 };
 
-/*********************************************************************/
+/*-------------------------------------------------------------------*/
 
 struct storage *
 STV_alloc(const struct sess *sp, size_t size)
@@ -353,10 +353,12 @@
 {
 	struct stevedore *stv;
 
-	VTAILQ_FOREACH(stv, &stevedores, list) {
+	VTAILQ_FOREACH(stv, &stevedores, list)
 		if (stv->close != NULL)
 			stv->close(stv);
-	}
+	stv = stv_transient;
+	if (stv->close != NULL)
+		stv->close(stv);
 }
 
 struct lru *
@@ -367,6 +369,11 @@
 	return (st->stevedore->lru);
 }
 
+/*--------------------------------------------------------------------
+ * Parse a stevedore argument on the form:
+ *	[ name '=' ] strategy [ ',' arg ] *
+ */
+
 static const struct choice STV_choice[] = {
 	{ "file",	&smf_stevedore },
 	{ "malloc",	&sma_stevedore },
@@ -377,11 +384,6 @@
 	{ NULL,		NULL }
 };
 
-/*--------------------------------------------------------------------
- * Parse a stevedore argument on the form:
- *	[ name '=' ] strategy [ ',' arg ] *
- */
-
 void
 STV_Config(const char *spec)
 {
@@ -471,6 +473,7 @@
 {
 	const struct stevedore *stv;
 
+	ASSERT_MGT();
 	VTAILQ_FOREACH(stv, &stevedores, list)
 		if (!strcmp(stv->name, TRANSIENT_NAME))
 			return;

Modified: trunk/varnish-cache/bin/varnishd/stevedore_utils.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore_utils.c	2010-11-21 20:49:15 UTC (rev 5577)
+++ trunk/varnish-cache/bin/varnishd/stevedore_utils.c	2010-11-22 08:51:03 UTC (rev 5578)
@@ -227,7 +227,7 @@
 		    " to %ju (80%% of available disk space)\n", ctx, l);
 	}
 
-	if (sizeof(void *) == 4 && l > INT32_MAX) { /*lint !e506 !e774 */
+	if (sizeof(void *) == 4 && l > INT32_MAX) { /*lint !e506 !e774 !e845 */
 		fprintf(stderr,
 		    "NB: Storage size limited to 2GB on 32 bit architecture,\n"
 		    "NB: otherwise we could run out of address space.\n"

Modified: trunk/varnish-cache/bin/varnishd/storage_persistent.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_persistent.c	2010-11-21 20:49:15 UTC (rev 5577)
+++ trunk/varnish-cache/bin/varnishd/storage_persistent.c	2010-11-22 08:51:03 UTC (rev 5578)
@@ -183,7 +183,7 @@
  */
 static VTAILQ_HEAD(,smp_sc)	silos = VTAILQ_HEAD_INITIALIZER(silos);
 
-/*********************************************************************
+/*--------------------------------------------------------------------
  * SIGNATURE functions
  * The signature is SHA256 over:
  *    1. The smp_sign struct up to but not including the length field.




More information about the varnish-commit mailing list