From: phk Date: Tue, 25 Sep 2007 11:11:15 +0000 (+0000) Subject: Mega-Const'ification X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7dabf0b4b75ed8733bced653405b991b1d6b2274;p=varnish Mega-Const'ification git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2041 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index a511ba9b..8d41d1f6 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -94,7 +94,7 @@ void WS_Init(struct ws *ws, void *space, unsigned len); unsigned WS_Reserve(struct ws *ws, unsigned bytes); void WS_Release(struct ws *ws, unsigned bytes); void WS_ReleaseP(struct ws *ws, char *ptr); -void WS_Assert(struct ws *ws); +void WS_Assert(const struct ws *ws); void WS_Reset(struct ws *ws); char *WS_Alloc(struct ws *ws, unsigned bytes); @@ -332,13 +332,13 @@ struct vbe_conn { /* Backend method */ -typedef struct vbe_conn *vbe_getfd_f(struct sess *sp); +typedef struct vbe_conn *vbe_getfd_f(const struct sess *sp); typedef void vbe_close_f(struct worker *w, struct vbe_conn *vc); typedef void vbe_recycle_f(struct worker *w, struct vbe_conn *vc); typedef void vbe_init_f(void); -typedef const char *vbe_gethostname_f(struct backend *); -typedef void vbe_cleanup_f(struct backend *); -typedef void vbe_updatehealth_f(struct sess *sp, struct vbe_conn *vc, int); +typedef const char *vbe_gethostname_f(const struct backend *); +typedef void vbe_cleanup_f(const struct backend *); +typedef void vbe_updatehealth_f(const struct sess *sp, const struct vbe_conn *vc, int); struct backend_method { const char *name; @@ -388,7 +388,7 @@ extern int vca_pipes[2]; /* cache_backend.c */ void VBE_Init(void); -struct vbe_conn *VBE_GetFd(struct sess *sp); +struct vbe_conn *VBE_GetFd(const struct sess *sp); void VBE_ClosedFd(struct worker *w, struct vbe_conn *vc); void VBE_RecycleFd(struct worker *w, struct vbe_conn *vc); struct bereq * VBE_new_bereq(void); @@ -399,7 +399,7 @@ void VBE_DropRefLocked(struct backend *); struct backend *VBE_NewBackend(struct backend_method *method); struct vbe_conn *VBE_NewConn(void); void VBE_ReleaseConn(struct vbe_conn *); -void VBE_UpdateHealth(struct sess *sp, struct vbe_conn *, int); +void VBE_UpdateHealth(const struct sess *sp, const struct vbe_conn *, int); /* convenience functions for backend methods */ int VBE_TryConnect(const struct sess *sp, const struct addrinfo *ai); @@ -449,7 +449,7 @@ void HSH_Init(void); const char *http_StatusMessage(int); void HTTP_Init(void); void http_ClrHeader(struct http *to); -unsigned http_Write(struct worker *w, struct http *hp, int resp); +unsigned http_Write(struct worker *w, const struct http *hp, int resp); void http_CopyResp(struct http *to, const struct http *fm); void http_SetResp(struct http *to, const char *proto, const char *status, const char *response); void http_FilterFields(struct worker *w, int fd, struct http *to, const struct http *fm, unsigned how); @@ -493,14 +493,14 @@ void WRK_QueueSession(struct sess *sp); void WRK_Reset(struct worker *w, int *fd); unsigned WRK_Flush(struct worker *w); unsigned WRK_Write(struct worker *w, const void *ptr, int len); -unsigned WRK_WriteH(struct worker *w, struct http_hdr *hh, const char *suf); +unsigned WRK_WriteH(struct worker *w, const struct http_hdr *hh, const char *suf); #ifdef HAVE_SENDFILE void WRK_Sendfile(struct worker *w, int fd, off_t off, unsigned len); #endif /* HAVE_SENDFILE */ /* cache_session.c [SES] */ void SES_Init(void); -struct sess *SES_New(struct sockaddr *addr, unsigned len); +struct sess *SES_New(const struct sockaddr *addr, unsigned len); void SES_Delete(struct sess *sp); void SES_RefSrcAddr(struct sess *sp); void SES_Charge(struct sess *sp); @@ -530,8 +530,8 @@ void RES_WriteObj(struct sess *sp); void SYN_ErrorPage(struct sess *sp, int status, const char *reason, int ttl); /* cache_vary.c */ -void VRY_Create(struct sess *sp); -int VRY_Match(struct sess *sp, unsigned char *vary); +void VRY_Create(const struct sess *sp); +int VRY_Match(const struct sess *sp, const unsigned char *vary); /* cache_vcl.c */ void VCL_Init(void); @@ -554,7 +554,7 @@ cli_func_t cli_func_dump_pool; #endif /* rfc2616.c */ -int RFC2616_cache_policy(struct sess *sp, struct http *hp); +int RFC2616_cache_policy(const struct sess *sp, const struct http *hp); #if 1 #define MTX pthread_mutex_t diff --git a/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c b/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c index 42ac6ba9..218c0f3d 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c +++ b/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c @@ -73,7 +73,7 @@ vca_kq_sess(struct sess *sp, short arm) } static void -vca_kev(struct kevent *kp) +vca_kev(const struct kevent *kp) { int i, j; struct sess *sp; diff --git a/varnish-cache/bin/varnishd/cache_backend.c b/varnish-cache/bin/varnishd/cache_backend.c index ec12bf29..00671bc1 100644 --- a/varnish-cache/bin/varnishd/cache_backend.c +++ b/varnish-cache/bin/varnishd/cache_backend.c @@ -267,7 +267,7 @@ VBE_DropRef(struct backend *b) /*--------------------------------------------------------------------*/ struct vbe_conn * -VBE_GetFd(struct sess *sp) +VBE_GetFd(const struct sess *sp) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); @@ -314,7 +314,7 @@ VBE_RecycleFd(struct worker *w, struct vbe_conn *vc) * details and comments about this function. */ void -VBE_UpdateHealth(struct sess *sp, struct vbe_conn *vc, int a) +VBE_UpdateHealth(const struct sess *sp, const struct vbe_conn *vc, int a) { struct backend *b; diff --git a/varnish-cache/bin/varnishd/cache_backend_random.c b/varnish-cache/bin/varnishd/cache_backend_random.c index 8fa0e4f4..645519fe 100644 --- a/varnish-cache/bin/varnishd/cache_backend_random.c +++ b/varnish-cache/bin/varnishd/cache_backend_random.c @@ -84,7 +84,7 @@ struct brspec { */ static int -ber_conn_try_list(struct sess *sp, struct brspec *bs) +ber_conn_try_list(const struct sess *sp, struct brspec *bs) { struct addrinfo *ai, *from; int s, loops; @@ -170,7 +170,7 @@ ber_dns_lookup(struct backend *bp, struct brspec *bs) /*--------------------------------------------------------------------*/ static int -ber_conn_try(struct sess *sp, struct backend *bp, struct brspec *bs) +ber_conn_try(const struct sess *sp, struct backend *bp, struct brspec *bs) { int s; @@ -217,7 +217,7 @@ ber_conn_try(struct sess *sp, struct backend *bp, struct brspec *bs) */ static struct vbe_conn * -ber_nextfd(struct sess *sp) +ber_nextfd(const struct sess *sp) { struct vbe_conn *vc; struct backend *bp; @@ -292,7 +292,7 @@ ber_nextfd(struct sess *sp) } static struct vbe_conn * -ber_GetFd(struct sess *sp) +ber_GetFd(const struct sess *sp) { struct vbe_conn *vc; unsigned n; @@ -350,7 +350,7 @@ ber_RecycleFd(struct worker *w, struct vbe_conn *vc) /*--------------------------------------------------------------------*/ static void -ber_Cleanup(struct backend *b) +ber_Cleanup(const struct backend *b) { struct ber *ber; struct vbe_conn *vbe; @@ -386,7 +386,7 @@ ber_Cleanup(struct backend *b) /* Will return the hostname of the first backend in the list */ static const char * -ber_GetHostname(struct backend *b) +ber_GetHostname(const struct backend *b) { struct ber *ber; @@ -402,7 +402,7 @@ ber_GetHostname(struct backend *b) * towards neutral (0) as time passes */ static void -ber_UpdateHealth(struct sess *sp, struct vbe_conn *vc, int add) +ber_UpdateHealth(const struct sess *sp, const struct vbe_conn *vc, int add) { struct brspec *bs, *first; struct ber *ber; @@ -438,7 +438,7 @@ struct backend_method backend_method_random = { /*--------------------------------------------------------------------*/ void -VRT_init_random_backend(struct backend **bp, struct vrt_random_backend *t) +VRT_init_random_backend(struct backend **bp, const struct vrt_random_backend *t) { struct backend *b; struct ber *ber; diff --git a/varnish-cache/bin/varnishd/cache_backend_round_robin.c b/varnish-cache/bin/varnishd/cache_backend_round_robin.c index 001d2650..157bfd9d 100644 --- a/varnish-cache/bin/varnishd/cache_backend_round_robin.c +++ b/varnish-cache/bin/varnishd/cache_backend_round_robin.c @@ -83,7 +83,7 @@ struct bspec { */ static int -brr_conn_try_list(struct sess *sp, struct bspec *bs) +brr_conn_try_list(const struct sess *sp, struct bspec *bs) { struct addrinfo *ai, *from; int s, loops; @@ -169,7 +169,7 @@ brr_dns_lookup(struct backend *bp, struct bspec *bs) /*--------------------------------------------------------------------*/ static int -brr_conn_try(struct sess *sp, struct backend *bp, struct bspec *bs) +brr_conn_try(const struct sess *sp, struct backend *bp, struct bspec *bs) { int s; @@ -215,7 +215,7 @@ brr_conn_try(struct sess *sp, struct backend *bp, struct bspec *bs) */ static struct vbe_conn * -brr_nextfd(struct sess *sp) +brr_nextfd(const struct sess *sp) { struct vbe_conn *vc; struct backend *bp; @@ -277,7 +277,7 @@ brr_nextfd(struct sess *sp) } static struct vbe_conn * -brr_GetFd(struct sess *sp) +brr_GetFd(const struct sess *sp) { struct vbe_conn *vc; unsigned n; @@ -335,7 +335,7 @@ brr_RecycleFd(struct worker *w, struct vbe_conn *vc) /*--------------------------------------------------------------------*/ static void -brr_Cleanup(struct backend *b) +brr_Cleanup(const struct backend *b) { struct brr *brr; struct vbe_conn *vbe; @@ -371,7 +371,7 @@ brr_Cleanup(struct backend *b) /* Will return the hostname of the first backend in the list */ static const char * -brr_GetHostname(struct backend *b) +brr_GetHostname(const struct backend *b) { struct brr *brr; @@ -387,7 +387,7 @@ brr_GetHostname(struct backend *b) * towards neutral (0) as time passes */ static void -brr_UpdateHealth(struct sess *sp, struct vbe_conn *vc, int add) +brr_UpdateHealth(const struct sess *sp, const struct vbe_conn *vc, int add) { struct bspec *bs, *first; struct brr *brr; @@ -424,7 +424,7 @@ struct backend_method backend_method_round_robin = { /*--------------------------------------------------------------------*/ void -VRT_init_round_robin_backend(struct backend **bp, struct vrt_round_robin_backend *t) +VRT_init_round_robin_backend(struct backend **bp, const struct vrt_round_robin_backend *t) { struct backend *b; struct brr *brr; diff --git a/varnish-cache/bin/varnishd/cache_backend_simple.c b/varnish-cache/bin/varnishd/cache_backend_simple.c index 869a741a..bb85518a 100644 --- a/varnish-cache/bin/varnishd/cache_backend_simple.c +++ b/varnish-cache/bin/varnishd/cache_backend_simple.c @@ -67,7 +67,7 @@ struct bes { */ static int -bes_conn_try_list(struct sess *sp, struct bes *bes) +bes_conn_try_list(const struct sess *sp, struct bes *bes) { struct addrinfo *ai, *from; int s, loops; @@ -154,7 +154,7 @@ bes_dns_lookup(struct backend *bp) /*--------------------------------------------------------------------*/ static int -bes_conn_try(struct sess *sp, struct backend *bp) +bes_conn_try(const struct sess *sp, struct backend *bp) { int s; struct bes *bes; @@ -200,7 +200,7 @@ bes_conn_try(struct sess *sp, struct backend *bp) */ static struct vbe_conn * -bes_nextfd(struct sess *sp) +bes_nextfd(const struct sess *sp) { struct vbe_conn *vc; struct backend *bp; @@ -250,7 +250,7 @@ bes_nextfd(struct sess *sp) /*--------------------------------------------------------------------*/ static struct vbe_conn * -bes_GetFd(struct sess *sp) +bes_GetFd(const struct sess *sp) { struct vbe_conn *vc; unsigned n; @@ -309,7 +309,7 @@ bes_RecycleFd(struct worker *w, struct vbe_conn *vc) /*--------------------------------------------------------------------*/ static void -bes_Cleanup(struct backend *b) +bes_Cleanup(const struct backend *b) { struct bes *bes; struct vbe_conn *vbe; @@ -334,7 +334,7 @@ bes_Cleanup(struct backend *b) /*--------------------------------------------------------------------*/ static const char * -bes_GetHostname(struct backend *b) +bes_GetHostname(const struct backend *b) { struct bes *bes; @@ -357,7 +357,7 @@ struct backend_method backend_method_simple = { /*--------------------------------------------------------------------*/ void -VRT_init_simple_backend(struct backend **bp, struct vrt_simple_backend *t) +VRT_init_simple_backend(struct backend **bp, const struct vrt_simple_backend *t) { struct backend *b; struct bes *bes; diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index c8cd06a9..3d90a5a4 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -986,7 +986,7 @@ http_Unset(struct http *hp, const char *hdr) /*--------------------------------------------------------------------*/ unsigned -http_Write(struct worker *w, struct http *hp, int resp) +http_Write(struct worker *w, const struct http *hp, int resp) { unsigned u, l; diff --git a/varnish-cache/bin/varnishd/cache_pool.c b/varnish-cache/bin/varnishd/cache_pool.c index cc0c1c52..5e8e2833 100644 --- a/varnish-cache/bin/varnishd/cache_pool.c +++ b/varnish-cache/bin/varnishd/cache_pool.c @@ -108,7 +108,7 @@ WRK_Flush(struct worker *w) } unsigned -WRK_WriteH(struct worker *w, struct http_hdr *hh, const char *suf) +WRK_WriteH(struct worker *w, const struct http_hdr *hh, const char *suf) { unsigned u; diff --git a/varnish-cache/bin/varnishd/cache_session.c b/varnish-cache/bin/varnishd/cache_session.c index 62331e72..3fab3975 100644 --- a/varnish-cache/bin/varnishd/cache_session.c +++ b/varnish-cache/bin/varnishd/cache_session.c @@ -209,7 +209,7 @@ ses_relsrcaddr(struct sess *sp) /*--------------------------------------------------------------------*/ static void -ses_sum_acct(struct acct *sum, struct acct *inc) +ses_sum_acct(struct acct *sum, const struct acct *inc) { sum->sess += inc->sess; @@ -256,7 +256,7 @@ SES_Charge(struct sess *sp) /*--------------------------------------------------------------------*/ struct sess * -SES_New(struct sockaddr *addr, unsigned len) +SES_New(const struct sockaddr *addr, unsigned len) { struct sessmem *sm; struct sess *sp; diff --git a/varnish-cache/bin/varnishd/cache_vary.c b/varnish-cache/bin/varnishd/cache_vary.c index 563cd36a..a6b76f27 100644 --- a/varnish-cache/bin/varnishd/cache_vary.c +++ b/varnish-cache/bin/varnishd/cache_vary.c @@ -61,7 +61,7 @@ #include "cache.h" void -VRY_Create(struct sess *sp) +VRY_Create(const struct sess *sp) { char *v, *p, *q, *h, *e; struct vsb *sb, *sbh; @@ -129,7 +129,7 @@ VRY_Create(struct sess *sp) } int -VRY_Match(struct sess *sp, unsigned char *vary) +VRY_Match(const struct sess *sp, const unsigned char *vary) { char *h, *e; int i, l, lh; @@ -137,7 +137,7 @@ VRY_Match(struct sess *sp, unsigned char *vary) while (*vary) { /* Look for header */ - i = http_GetHdr(sp->http, (char*)vary, &h); + i = http_GetHdr(sp->http, (const char*)vary, &h); vary += *vary + 2; /* Expected length of header (or 0xffff) */ diff --git a/varnish-cache/bin/varnishd/cache_ws.c b/varnish-cache/bin/varnishd/cache_ws.c index de36078a..2629126b 100644 --- a/varnish-cache/bin/varnishd/cache_ws.c +++ b/varnish-cache/bin/varnishd/cache_ws.c @@ -46,7 +46,7 @@ #include "cache.h" void -WS_Assert(struct ws *ws) +WS_Assert(const struct ws *ws) { assert(ws != NULL); diff --git a/varnish-cache/bin/varnishd/hash_classic.c b/varnish-cache/bin/varnishd/hash_classic.c index 449c81d2..bdee5314 100644 --- a/varnish-cache/bin/varnishd/hash_classic.c +++ b/varnish-cache/bin/varnishd/hash_classic.c @@ -119,7 +119,7 @@ hcl_start(void) */ static struct objhead * -hcl_lookup(struct sess *sp, struct objhead *noh) +hcl_lookup(const struct sess *sp, struct objhead *noh) { struct objhead *roh; struct hcl_entry *he, *he2; @@ -213,7 +213,7 @@ hcl_lookup(struct sess *sp, struct objhead *noh) */ static int -hcl_deref(struct objhead *oh) +hcl_deref(const struct objhead *oh) { struct hcl_entry *he; struct hcl_hd *hp; diff --git a/varnish-cache/bin/varnishd/hash_simple_list.c b/varnish-cache/bin/varnishd/hash_simple_list.c index 85e91d4d..3c52f2fc 100644 --- a/varnish-cache/bin/varnishd/hash_simple_list.c +++ b/varnish-cache/bin/varnishd/hash_simple_list.c @@ -71,7 +71,7 @@ hsl_start(void) */ static struct objhead * -hsl_lookup(struct sess *sp, struct objhead *nobj) +hsl_lookup(const struct sess *sp, struct objhead *nobj) { struct hsl_entry *he, *he2; int i; @@ -116,7 +116,7 @@ hsl_lookup(struct sess *sp, struct objhead *nobj) */ static int -hsl_deref(struct objhead *obj) +hsl_deref(const struct objhead *obj) { struct hsl_entry *he; int ret; diff --git a/varnish-cache/bin/varnishd/hash_slinger.h b/varnish-cache/bin/varnishd/hash_slinger.h index 38bc2710..0674ce81 100644 --- a/varnish-cache/bin/varnishd/hash_slinger.h +++ b/varnish-cache/bin/varnishd/hash_slinger.h @@ -33,8 +33,8 @@ struct sess; typedef int hash_init_f(const char *); typedef void hash_start_f(void); -typedef struct objhead *hash_lookup_f(struct sess *sp, struct objhead *nobj); -typedef int hash_deref_f(struct objhead *obj); +typedef struct objhead *hash_lookup_f(const struct sess *sp, struct objhead *nobj); +typedef int hash_deref_f(const struct objhead *obj); struct hash_slinger { const char *name; diff --git a/varnish-cache/bin/varnishd/mgt_child.c b/varnish-cache/bin/varnishd/mgt_child.c index b14cbb6c..13e70587 100644 --- a/varnish-cache/bin/varnishd/mgt_child.c +++ b/varnish-cache/bin/varnishd/mgt_child.c @@ -81,7 +81,7 @@ static struct ev *ev_listen; /*--------------------------------------------------------------------*/ static int -child_listener(struct ev *e, int what) +child_listener(const struct ev *e, int what) { int i; char buf[BUFSIZ]; @@ -105,7 +105,7 @@ child_listener(struct ev *e, int what) /*--------------------------------------------------------------------*/ static int -child_poker(struct ev *e, int what) +child_poker(const struct ev *e, int what) { (void)e; @@ -290,7 +290,7 @@ stop_child(void) /*--------------------------------------------------------------------*/ static int -mgt_sigchld(struct ev *e, int what) +mgt_sigchld(const struct ev *e, int what) { int status; pid_t r; @@ -353,7 +353,7 @@ mgt_sigchld(struct ev *e, int what) /*--------------------------------------------------------------------*/ static int -mgt_sigint(struct ev *e, int what) +mgt_sigint(const struct ev *e, int what) { (void)e; diff --git a/varnish-cache/bin/varnishd/mgt_cli.c b/varnish-cache/bin/varnishd/mgt_cli.c index 38f4e79b..e80dbc5b 100644 --- a/varnish-cache/bin/varnishd/mgt_cli.c +++ b/varnish-cache/bin/varnishd/mgt_cli.c @@ -293,7 +293,7 @@ struct cli_port { }; static int -mgt_cli_callback(struct ev *e, int what) +mgt_cli_callback(const struct ev *e, int what) { struct cli_port *cp; char *p, *q; @@ -391,7 +391,7 @@ mgt_cli_setup(int fdi, int fdo, int verbose) } static int -telnet_accept(struct ev *ev, int what) +telnet_accept(const struct ev *ev, int what) { struct sockaddr_storage addr; socklen_t addrlen; diff --git a/varnish-cache/bin/varnishd/mgt_event.h b/varnish-cache/bin/varnishd/mgt_event.h index d0846659..d93579d3 100644 --- a/varnish-cache/bin/varnishd/mgt_event.h +++ b/varnish-cache/bin/varnishd/mgt_event.h @@ -36,7 +36,7 @@ struct ev; struct evbase; -typedef int ev_cb_f(struct ev *, int what); +typedef int ev_cb_f(const struct ev *, int what); struct ev { unsigned magic; diff --git a/varnish-cache/bin/varnishd/rfc2616.c b/varnish-cache/bin/varnishd/rfc2616.c index a47b09b5..862f2cb9 100644 --- a/varnish-cache/bin/varnishd/rfc2616.c +++ b/varnish-cache/bin/varnishd/rfc2616.c @@ -99,7 +99,7 @@ #endif static double -RFC2616_Ttl(const struct sess *sp, struct http *hp, struct object *obj) +RFC2616_Ttl(const struct sess *sp, const struct http *hp, struct object *obj) { int retirement_age; unsigned u1, u2; @@ -163,7 +163,7 @@ RFC2616_Ttl(const struct sess *sp, struct http *hp, struct object *obj) } int -RFC2616_cache_policy(struct sess *sp, struct http *hp) +RFC2616_cache_policy(const struct sess *sp, const struct http *hp) { int body = 0; diff --git a/varnish-cache/bin/varnishd/stevedore.c b/varnish-cache/bin/varnishd/stevedore.c index 9fa75f3b..36395d3c 100644 --- a/varnish-cache/bin/varnishd/stevedore.c +++ b/varnish-cache/bin/varnishd/stevedore.c @@ -72,7 +72,7 @@ STV_alloc(struct sess *sp, size_t size) } void -STV_trim(struct storage *st, size_t size) +STV_trim(const struct storage *st, size_t size) { CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); @@ -82,7 +82,7 @@ STV_trim(struct storage *st, size_t size) } void -STV_free(struct storage *st) +STV_free(const struct storage *st) { CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); diff --git a/varnish-cache/bin/varnishd/stevedore.h b/varnish-cache/bin/varnishd/stevedore.h index adc66210..1cbc1a5f 100644 --- a/varnish-cache/bin/varnishd/stevedore.h +++ b/varnish-cache/bin/varnishd/stevedore.h @@ -36,7 +36,7 @@ struct sess; struct iovec; typedef void storage_init_f(struct stevedore *, const char *spec); -typedef void storage_open_f(struct stevedore *); +typedef void storage_open_f(const struct stevedore *); typedef struct storage *storage_alloc_f(struct stevedore *, size_t size); typedef void storage_trim_f(const struct storage *, size_t size); typedef void storage_free_f(const struct storage *); @@ -56,7 +56,7 @@ struct stevedore { }; struct storage *STV_alloc(struct sess *sp, size_t size); -void STV_trim(struct storage *st, size_t size); -void STV_free(struct storage *st); +void STV_trim(const struct storage *st, size_t size); +void STV_free(const struct storage *st); void STV_add(const char *spec); void STV_open(void); diff --git a/varnish-cache/bin/varnishd/storage_file.c b/varnish-cache/bin/varnishd/storage_file.c index 4ff21037..7d96565a 100644 --- a/varnish-cache/bin/varnishd/storage_file.c +++ b/varnish-cache/bin/varnishd/storage_file.c @@ -373,7 +373,7 @@ insfree(struct smf_sc *sc, struct smf *sp) } static void -remfree(struct smf_sc *sc, struct smf *sp) +remfree(const struct smf_sc *sc, struct smf *sp) { size_t b; @@ -601,7 +601,7 @@ smf_open_chunk(struct smf_sc *sc, off_t sz, off_t off, off_t *fail, off_t *sum) } static void -smf_open(struct stevedore *st) +smf_open(const struct stevedore *st) { struct smf_sc *sc; off_t fail = 1 << 30; /* XXX: where is OFF_T_MAX ? */ diff --git a/varnish-cache/bin/varnishd/varnishd.c b/varnish-cache/bin/varnishd/varnishd.c index 0c718b9b..92cea490 100644 --- a/varnish-cache/bin/varnishd/varnishd.c +++ b/varnish-cache/bin/varnishd/varnishd.c @@ -77,7 +77,7 @@ volatile struct params *params; /*--------------------------------------------------------------------*/ static int -cmp_hash(struct hash_slinger *s, const char *p, const char *q) +cmp_hash(const struct hash_slinger *s, const char *p, const char *q) { if (strlen(s->name) != q - p) return (1); @@ -350,7 +350,7 @@ DebugStunt(void) /*--------------------------------------------------------------------*/ static void -cli_check(struct cli *cli) +cli_check(const struct cli *cli) { if (cli->result == CLIS_OK) { vsb_clear(cli->sb); diff --git a/varnish-cache/include/vrt.h b/varnish-cache/include/vrt.h index b06cd391..1f5b3d09 100644 --- a/varnish-cache/include/vrt.h +++ b/varnish-cache/include/vrt.h @@ -115,9 +115,9 @@ int VRT_strcmp(const char *s1, const char *s2); /* Backend related */ -void VRT_init_simple_backend(struct backend **, struct vrt_simple_backend *); -void VRT_init_round_robin_backend(struct backend **, struct vrt_round_robin_backend *); -void VRT_init_random_backend(struct backend **, struct vrt_random_backend *); +void VRT_init_simple_backend(struct backend **, const struct vrt_simple_backend *); +void VRT_init_round_robin_backend(struct backend **, const struct vrt_round_robin_backend *); +void VRT_init_random_backend(struct backend **, const struct vrt_random_backend *); void VRT_fini_backend(struct backend *); char *VRT_IP_string(struct sess *sp, struct sockaddr *sa); diff --git a/varnish-cache/lib/libvcl/vcc_backend.c b/varnish-cache/lib/libvcl/vcc_backend.c index f0733371..af81603c 100644 --- a/varnish-cache/lib/libvcl/vcc_backend.c +++ b/varnish-cache/lib/libvcl/vcc_backend.c @@ -172,7 +172,7 @@ vcc_ParseSimpleBackend(struct tokenlist *tl) } vcc_NextToken(tl); - Fc(tl, 0, "\nstatic struct vrt_simple_backend sbe_%.*s = {\n", + Fc(tl, 0, "\nstatic const struct vrt_simple_backend sbe_%.*s = {\n", PF(t_be)); Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(t_be)); if (t_port != NULL) diff --git a/varnish-cache/lib/libvcl/vcc_compile.c b/varnish-cache/lib/libvcl/vcc_compile.c index 7c66800d..fa053705 100644 --- a/varnish-cache/lib/libvcl/vcc_compile.c +++ b/varnish-cache/lib/libvcl/vcc_compile.c @@ -341,7 +341,7 @@ EmitStruct(const struct tokenlist *tl) Fc(tl, 0, "\nstatic struct backend\t*backends[%d];\n", tl->nbackend); - Fc(tl, 0, "\nstruct VCL_conf VCL_conf = {\n"); + Fc(tl, 0, "\nconst struct VCL_conf VCL_conf = {\n"); Fc(tl, 0, "\t.magic = VCL_CONF_MAGIC,\n"); Fc(tl, 0, "\t.init_func = VGC_Init,\n"); Fc(tl, 0, "\t.fini_func = VGC_Fini,\n"); @@ -558,7 +558,7 @@ vcc_CompileSource(struct vsb *sb, struct source *sp) vcl_output_lang_h(tl->fh); Fh(tl, 0, "\n/* ---===### VCC generated below here ###===---*/\n"); - Fh(tl, 0, "\nextern struct VCL_conf VCL_conf;\n"); + Fh(tl, 0, "\nextern const struct VCL_conf VCL_conf;\n"); /* Register and lex the main source */ VTAILQ_INSERT_TAIL(&tl->sources, sp, list); diff --git a/varnish-cache/lib/libvcl/vcc_fixed_token.c b/varnish-cache/lib/libvcl/vcc_fixed_token.c index aad2f95c..8f471d73 100644 --- a/varnish-cache/lib/libvcl/vcc_fixed_token.c +++ b/varnish-cache/lib/libvcl/vcc_fixed_token.c @@ -493,9 +493,9 @@ vcl_output_lang_h(struct vsb *sb) vsb_cat(sb, "\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "/* Backend related */\n"); - vsb_cat(sb, "void VRT_init_simple_backend(struct backend **, struct vrt_simple_backend *);\n"); - vsb_cat(sb, "void VRT_init_round_robin_backend(struct backend **, struct vrt_round_robin_backend *);\n"); - vsb_cat(sb, "void VRT_init_random_backend(struct backend **, struct vrt_random_backend *);\n"); + vsb_cat(sb, "void VRT_init_simple_backend(struct backend **, const struct vrt_simple_backend *);\n"); + vsb_cat(sb, "void VRT_init_round_robin_backend(struct backend **, const struct vrt_round_robin_backend *);\n"); + vsb_cat(sb, "void VRT_init_random_backend(struct backend **, const struct vrt_random_backend *);\n"); vsb_cat(sb, "void VRT_fini_backend(struct backend *);\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "char *VRT_IP_string(struct sess *sp, struct sockaddr *sa);\n");