Commit f23fc8c5 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Style and consistency fixes.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5578 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 814ebbc9
...@@ -249,7 +249,7 @@ hsh_testmagic(void *result) ...@@ -249,7 +249,7 @@ hsh_testmagic(void *result)
fprintf(stderr, ">\n"); fprintf(stderr, ">\n");
} }
/********************************************************************** /*---------------------------------------------------------------------
* Insert an object which magically appears out of nowhere or, more likely, * Insert an object which magically appears out of nowhere or, more likely,
* comes off some persistent storage device. * comes off some persistent storage device.
*/ */
...@@ -295,7 +295,7 @@ HSH_Insert(const struct sess *sp) ...@@ -295,7 +295,7 @@ HSH_Insert(const struct sess *sp)
return (oc); return (oc);
} }
/********************************************************************** /*---------------------------------------------------------------------
*/ */
struct objcore * struct objcore *
...@@ -454,7 +454,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh) ...@@ -454,7 +454,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
return (oc); return (oc);
} }
/********************************************************************** /*---------------------------------------------------------------------
*/ */
static void static void
...@@ -484,7 +484,7 @@ hsh_rush(struct objhead *oh) ...@@ -484,7 +484,7 @@ hsh_rush(struct objhead *oh)
} }
} }
/********************************************************************** /*---------------------------------------------------------------------
* Purge an entire objhead * Purge an entire objhead
*/ */
...@@ -542,7 +542,7 @@ HSH_Purge(const struct sess *sp, struct objhead *oh, double ttl, double grace) ...@@ -542,7 +542,7 @@ HSH_Purge(const struct sess *sp, struct objhead *oh, double ttl, double grace)
} }
/********************************************************************** /*---------------------------------------------------------------------
* Kill a busy object we don't need anyway. * Kill a busy object we don't need anyway.
* There may be sessions on the waiting list, so we cannot just blow * There may be sessions on the waiting list, so we cannot just blow
* it out of the water. * it out of the water.
...@@ -612,7 +612,7 @@ HSH_Ref(struct objcore *oc) ...@@ -612,7 +612,7 @@ HSH_Ref(struct objcore *oc)
Lck_Unlock(&oh->mtx); Lck_Unlock(&oh->mtx);
} }
/******************************************************************* /*--------------------------------------------------------------------
* Dereference objcore and or object * Dereference objcore and or object
* *
* Can deal with: * Can deal with:
...@@ -693,7 +693,7 @@ HSH_Deref(struct worker *w, struct objcore *oc, struct object **oo) ...@@ -693,7 +693,7 @@ HSH_Deref(struct worker *w, struct objcore *oc, struct object **oo)
return (0); return (0);
} }
/******************************************************************* /*--------------------------------------------------------------------
* This one is slightly tricky. This is called from the BAN module * This one is slightly tricky. This is called from the BAN module
* to try to wash the object which holds the oldest ban. * to try to wash the object which holds the oldest ban.
* We compete against HSH_Deref() which comes in the opposite * We compete against HSH_Deref() which comes in the opposite
......
...@@ -51,7 +51,7 @@ SVNID("$Id$") ...@@ -51,7 +51,7 @@ SVNID("$Id$")
#include "cache_waiter.h" #include "cache_waiter.h"
/**********************************************************************/ /*--------------------------------------------------------------------*/
static pthread_t vca_kqueue_thread; static pthread_t vca_kqueue_thread;
......
...@@ -45,7 +45,7 @@ SVNID("$Id$") ...@@ -45,7 +45,7 @@ SVNID("$Id$")
static struct lock hcb_mtx; static struct lock hcb_mtx;
/********************************************************************** /*---------------------------------------------------------------------
* Table for finding out how many bits two bytes have in common, * Table for finding out how many bits two bytes have in common,
* counting from the MSB towards the LSB. * counting from the MSB towards the LSB.
* ie: * ie:
...@@ -80,7 +80,7 @@ hcb_build_bittbl(void) ...@@ -80,7 +80,7 @@ hcb_build_bittbl(void)
assert(hcb_bits(0x10, 0x0b) == 3); assert(hcb_bits(0x10, 0x0b) == 3);
} }
/********************************************************************** /*---------------------------------------------------------------------
* For space reasons we overload the two pointers with two different * 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 * 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 * low two bits to tell them apart, assuming that Varnish will never
...@@ -113,7 +113,7 @@ static VSTAILQ_HEAD(, hcb_y) dead_y = VSTAILQ_HEAD_INITIALIZER(dead_y); ...@@ -113,7 +113,7 @@ static VSTAILQ_HEAD(, hcb_y) dead_y = VSTAILQ_HEAD_INITIALIZER(dead_y);
static VTAILQ_HEAD(, objhead) cool_h = VTAILQ_HEAD_INITIALIZER(cool_h); static VTAILQ_HEAD(, objhead) cool_h = VTAILQ_HEAD_INITIALIZER(cool_h);
static VTAILQ_HEAD(, objhead) dead_h = VTAILQ_HEAD_INITIALIZER(dead_h); static VTAILQ_HEAD(, objhead) dead_h = VTAILQ_HEAD_INITIALIZER(dead_h);
/********************************************************************** /*---------------------------------------------------------------------
* Pointer accessor functions * Pointer accessor functions
*/ */
static int static int
...@@ -165,7 +165,7 @@ hcb_l_y(uintptr_t u) ...@@ -165,7 +165,7 @@ hcb_l_y(uintptr_t u)
return ((struct hcb_y *)(u & ~HCB_BIT_Y)); return ((struct hcb_y *)(u & ~HCB_BIT_Y));
} }
/********************************************************************** /*---------------------------------------------------------------------
* Find the "critical" bit that separates these two digests * Find the "critical" bit that separates these two digests
*/ */
...@@ -186,7 +186,7 @@ hcb_crit_bit(const struct objhead *oh1, const struct objhead *oh2, ...@@ -186,7 +186,7 @@ hcb_crit_bit(const struct objhead *oh1, const struct objhead *oh2,
return (y->critbit); return (y->critbit);
} }
/********************************************************************* /*---------------------------------------------------------------------
* Unless we have the lock, we need to be very careful about pointer * 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 * references into the tree, we cannot trust things to be the same
* in two consequtive memory accesses. * in two consequtive memory accesses.
...@@ -267,7 +267,7 @@ hcb_insert(struct worker *wrk, struct hcb_root *root, struct objhead *oh, int ha ...@@ -267,7 +267,7 @@ hcb_insert(struct worker *wrk, struct hcb_root *root, struct objhead *oh, int ha
return(oh); return(oh);
} }
/**********************************************************************/ /*--------------------------------------------------------------------*/
static void static void
hcb_delete(struct hcb_root *r, struct objhead *oh) hcb_delete(struct hcb_root *r, struct objhead *oh)
...@@ -299,7 +299,7 @@ hcb_delete(struct hcb_root *r, struct objhead *oh) ...@@ -299,7 +299,7 @@ hcb_delete(struct hcb_root *r, struct objhead *oh)
} }
} }
/**********************************************************************/ /*--------------------------------------------------------------------*/
static void static void
dumptree(struct cli *cli, uintptr_t p, int indent) dumptree(struct cli *cli, uintptr_t p, int indent)
...@@ -343,7 +343,7 @@ static struct cli_proto hcb_cmds[] = { ...@@ -343,7 +343,7 @@ static struct cli_proto hcb_cmds[] = {
{ NULL } { NULL }
}; };
/**********************************************************************/ /*--------------------------------------------------------------------*/
static void * static void *
hcb_cleaner(void *priv) hcb_cleaner(void *priv)
...@@ -376,7 +376,7 @@ hcb_cleaner(void *priv) ...@@ -376,7 +376,7 @@ hcb_cleaner(void *priv)
NEEDLESS_RETURN(NULL); NEEDLESS_RETURN(NULL);
} }
/**********************************************************************/ /*--------------------------------------------------------------------*/
static void static void
hcb_start(void) hcb_start(void)
......
...@@ -55,7 +55,7 @@ static const struct stevedore * volatile stv_next; ...@@ -55,7 +55,7 @@ static const struct stevedore * volatile stv_next;
static struct stevedore *stv_transient; static struct stevedore *stv_transient;
/********************************************************************* /*--------------------------------------------------------------------
* NB! Dirty trick alert: * NB! Dirty trick alert:
* *
* We use a captive objcore as tail senteniel for LRU lists, but to * We use a captive objcore as tail senteniel for LRU lists, but to
...@@ -76,7 +76,7 @@ LRU_Alloc(void) ...@@ -76,7 +76,7 @@ LRU_Alloc(void)
return (l); return (l);
} }
/********************************************************************* /*--------------------------------------------------------------------
* XXX: trust pointer writes to be atomic * XXX: trust pointer writes to be atomic
*/ */
...@@ -97,7 +97,7 @@ stv_pick_stevedore(void) ...@@ -97,7 +97,7 @@ stv_pick_stevedore(void)
return (stv); return (stv);
} }
/*********************************************************************/ /*-------------------------------------------------------------------*/
static struct storage * static struct storage *
stv_alloc(const struct sess *sp, size_t size) stv_alloc(const struct sess *sp, size_t size)
...@@ -143,7 +143,7 @@ stv_alloc(const struct sess *sp, size_t size) ...@@ -143,7 +143,7 @@ stv_alloc(const struct sess *sp, size_t size)
} }
/********************************************************************* /*-------------------------------------------------------------------*
* Structure used to transport internal knowledge from STV_NewObject() * Structure used to transport internal knowledge from STV_NewObject()
* to STV_MkObject(). Nobody else should mess with this struct. * to STV_MkObject(). Nobody else should mess with this struct.
*/ */
...@@ -157,7 +157,7 @@ struct stv_objsecrets { ...@@ -157,7 +157,7 @@ struct stv_objsecrets {
double ttl; double ttl;
}; };
/********************************************************************* /*--------------------------------------------------------------------
* This function is called by stevedores ->allocobj() method, which * This function is called by stevedores ->allocobj() method, which
* very often will be stv_default_allocobj() below, to convert a slab * very often will be stv_default_allocobj() below, to convert a slab
* of storage into object which the stevedore can then register in its * of storage into object which the stevedore can then register in its
...@@ -212,7 +212,7 @@ STV_MkObject(struct sess *sp, void *ptr, unsigned ltot, ...@@ -212,7 +212,7 @@ STV_MkObject(struct sess *sp, void *ptr, unsigned ltot,
return (o); return (o);
} }
/********************************************************************* /*--------------------------------------------------------------------
* This is the default ->allocobj() which all stevedores who do not * This is the default ->allocobj() which all stevedores who do not
* implement persistent storage can rely on. * implement persistent storage can rely on.
*/ */
...@@ -235,7 +235,7 @@ stv_default_allocobj(struct stevedore *stv, struct sess *sp, unsigned ltot, ...@@ -235,7 +235,7 @@ stv_default_allocobj(struct stevedore *stv, struct sess *sp, unsigned ltot,
return (o); return (o);
} }
/*********************************************************************/ /*-------------------------------------------------------------------*/
struct object * struct object *
STV_NewObject(struct sess *sp, unsigned wsl, double ttl, unsigned nhttp) STV_NewObject(struct sess *sp, unsigned wsl, double ttl, unsigned nhttp)
...@@ -305,7 +305,7 @@ struct objcore_methods default_oc_methods = { ...@@ -305,7 +305,7 @@ struct objcore_methods default_oc_methods = {
.freeobj = default_oc_freeobj, .freeobj = default_oc_freeobj,
}; };
/*********************************************************************/ /*-------------------------------------------------------------------*/
struct storage * struct storage *
STV_alloc(const struct sess *sp, size_t size) STV_alloc(const struct sess *sp, size_t size)
...@@ -353,10 +353,12 @@ STV_close(void) ...@@ -353,10 +353,12 @@ STV_close(void)
{ {
struct stevedore *stv; 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) if (stv->close != NULL)
stv->close(stv); stv->close(stv);
}
} }
struct lru * struct lru *
...@@ -367,6 +369,11 @@ STV_lru(const struct storage *st) ...@@ -367,6 +369,11 @@ STV_lru(const struct storage *st)
return (st->stevedore->lru); return (st->stevedore->lru);
} }
/*--------------------------------------------------------------------
* Parse a stevedore argument on the form:
* [ name '=' ] strategy [ ',' arg ] *
*/
static const struct choice STV_choice[] = { static const struct choice STV_choice[] = {
{ "file", &smf_stevedore }, { "file", &smf_stevedore },
{ "malloc", &sma_stevedore }, { "malloc", &sma_stevedore },
...@@ -377,11 +384,6 @@ static const struct choice STV_choice[] = { ...@@ -377,11 +384,6 @@ static const struct choice STV_choice[] = {
{ NULL, NULL } { NULL, NULL }
}; };
/*--------------------------------------------------------------------
* Parse a stevedore argument on the form:
* [ name '=' ] strategy [ ',' arg ] *
*/
void void
STV_Config(const char *spec) STV_Config(const char *spec)
{ {
...@@ -471,6 +473,7 @@ STV_Config_Transient(void) ...@@ -471,6 +473,7 @@ STV_Config_Transient(void)
{ {
const struct stevedore *stv; const struct stevedore *stv;
ASSERT_MGT();
VTAILQ_FOREACH(stv, &stevedores, list) VTAILQ_FOREACH(stv, &stevedores, list)
if (!strcmp(stv->name, TRANSIENT_NAME)) if (!strcmp(stv->name, TRANSIENT_NAME))
return; return;
......
...@@ -227,7 +227,7 @@ STV_FileSize(int fd, const char *size, unsigned *granularity, const char *ctx) ...@@ -227,7 +227,7 @@ STV_FileSize(int fd, const char *size, unsigned *granularity, const char *ctx)
" to %ju (80%% of available disk space)\n", ctx, l); " 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, fprintf(stderr,
"NB: Storage size limited to 2GB on 32 bit architecture,\n" "NB: Storage size limited to 2GB on 32 bit architecture,\n"
"NB: otherwise we could run out of address space.\n" "NB: otherwise we could run out of address space.\n"
......
...@@ -183,7 +183,7 @@ struct smp_sc { ...@@ -183,7 +183,7 @@ struct smp_sc {
*/ */
static VTAILQ_HEAD(,smp_sc) silos = VTAILQ_HEAD_INITIALIZER(silos); static VTAILQ_HEAD(,smp_sc) silos = VTAILQ_HEAD_INITIALIZER(silos);
/********************************************************************* /*--------------------------------------------------------------------
* SIGNATURE functions * SIGNATURE functions
* The signature is SHA256 over: * The signature is SHA256 over:
* 1. The smp_sign struct up to but not including the length field. * 1. The smp_sign struct up to but not including the length field.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment