[master] 9699424 Split params.h from heritage.h, they are different beasts now. Reduce scope of heritage.h Reduce scope of libvcl.h
Poul-Henning Kamp
phk at varnish-cache.org
Sun Nov 13 10:30:16 CET 2011
commit 9699424ccd9f7fc51a8d1c651889433fdd200ce5
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sun Nov 13 09:29:46 2011 +0000
Split params.h from heritage.h, they are different beasts now.
Reduce scope of heritage.h
Reduce scope of libvcl.h
diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am
index f7c7620..002447f 100644
--- a/bin/varnishd/Makefile.am
+++ b/bin/varnishd/Makefile.am
@@ -89,6 +89,7 @@ noinst_HEADERS = \
heritage.h \
mgt/mgt.h \
mgt/mgt_cli.h \
+ params.h \
storage/storage.h \
storage/storage_persistent.h \
vparam.h
diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 5941fcc..b21f2d4 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -55,7 +55,7 @@
#endif
-#include "heritage.h"
+#include "params.h"
enum body_status {
#define BODYSTATUS(U,l) BS_##U,
@@ -909,6 +909,7 @@ void VCL_Init(void);
void VCL_Refresh(struct VCL_conf **vcc);
void VCL_Rel(struct VCL_conf **vcc);
void VCL_Poll(void);
+const char *VCL_Return_Name(unsigned method);
#define VCL_MET_MAC(l,u,b) void VCL_##l##_method(struct sess *);
#include "tbl/vcl_returns.h"
diff --git a/bin/varnishd/cache_acceptor.c b/bin/varnishd/cache_acceptor.c
index 550a53f..5161b09 100644
--- a/bin/varnishd/cache_acceptor.c
+++ b/bin/varnishd/cache_acceptor.c
@@ -31,6 +31,7 @@
#include "config.h"
#include "cache.h"
+#include "heritage.h"
#include "vcli.h"
#include "vcli_priv.h"
diff --git a/bin/varnishd/cache_cli.c b/bin/varnishd/cache_cli.c
index 1e09d23..0bbf94b 100644
--- a/bin/varnishd/cache_cli.c
+++ b/bin/varnishd/cache_cli.c
@@ -39,6 +39,7 @@
#include <stddef.h> // offsetof
#include "cache.h"
+#include "heritage.h"
#include "cache_backend.h" // struct vbc
#include "hash/hash_slinger.h" // struct objhead
diff --git a/bin/varnishd/cache_main.c b/bin/varnishd/cache_main.c
index f8f06e1..7a3bcd9 100644
--- a/bin/varnishd/cache_main.c
+++ b/bin/varnishd/cache_main.c
@@ -33,6 +33,7 @@
#include <stdlib.h>
#include "cache.h"
+#include "heritage.h"
#include "waiter/cache_waiter.h"
#include "hash/hash_slinger.h"
diff --git a/bin/varnishd/cache_panic.c b/bin/varnishd/cache_panic.c
index f69e90b..c626ae3 100644
--- a/bin/varnishd/cache_panic.c
+++ b/bin/varnishd/cache_panic.c
@@ -44,7 +44,6 @@
#include "cache_backend.h"
#include "waiter/cache_waiter.h"
-#include "libvcl.h"
#include "vcl.h"
/*
@@ -226,7 +225,7 @@ pan_sess(const struct sess *sp)
#undef STEP
default: stp = NULL;
}
- hand = VCC_Return_Name(sp->handling);
+ hand = VCL_Return_Name(sp->handling);
if (stp != NULL)
VSB_printf(vsp, " step = %s,\n", stp);
else
diff --git a/bin/varnishd/cache_pool.c b/bin/varnishd/cache_pool.c
index 62d58aa..eaf7602 100644
--- a/bin/varnishd/cache_pool.c
+++ b/bin/varnishd/cache_pool.c
@@ -46,6 +46,7 @@
#include <stdlib.h>
#include "cache.h"
+#include "heritage.h"
#include "waiter/cache_waiter.h"
#include "vtcp.h"
diff --git a/bin/varnishd/cache_vcl.c b/bin/varnishd/cache_vcl.c
index cc67a7f..068b482 100644
--- a/bin/varnishd/cache_vcl.c
+++ b/bin/varnishd/cache_vcl.c
@@ -38,7 +38,6 @@
#include "cache.h"
-#include "libvcl.h"
#include "vcl.h"
#include "vcli.h"
#include "vcli_priv.h"
@@ -65,6 +64,21 @@ static struct vcls *vcl_active; /* protected by vcl_mtx */
/*--------------------------------------------------------------------*/
+const char *
+VCL_Return_Name(unsigned method)
+{
+
+ switch (method) {
+#define VCL_RET_MAC(l, U, B) case VCL_RET_##U: return(#l);
+#include "tbl/vcl_returns.h"
+#undef VCL_RET_MAC
+ default:
+ return (NULL);
+ }
+}
+
+/*--------------------------------------------------------------------*/
+
static void
VCL_Get(struct VCL_conf **vcc)
{
@@ -323,7 +337,7 @@ VCL_##func##_method(struct sess *sp) \
sp->cur_method = VCL_MET_ ## upper; \
WSP(sp, SLT_VCL_call, "%s", #func); \
(void)sp->vcl->func##_func(sp); \
- WSP(sp, SLT_VCL_return, "%s", VCC_Return_Name(sp->handling)); \
+ WSP(sp, SLT_VCL_return, "%s", VCL_Return_Name(sp->handling)); \
sp->cur_method = 0; \
assert((1U << sp->handling) & bitmap); \
assert(!((1U << sp->handling) & ~bitmap)); \
diff --git a/bin/varnishd/cache_vrt_var.c b/bin/varnishd/cache_vrt_var.c
index 7a5aed0..a9bf87f 100644
--- a/bin/varnishd/cache_vrt_var.c
+++ b/bin/varnishd/cache_vrt_var.c
@@ -34,6 +34,7 @@
#include <stdlib.h>
#include "cache.h"
+#include "heritage.h"
#include "cache_backend.h"
#include "vrt_obj.h"
diff --git a/bin/varnishd/heritage.h b/bin/varnishd/heritage.h
index e6e6558..36433bb 100644
--- a/bin/varnishd/heritage.h
+++ b/bin/varnishd/heritage.h
@@ -29,8 +29,6 @@
* This file contains the heritage passed when mgt forks cache
*/
-#include "vre.h"
-
struct listen_sock {
unsigned magic;
#define LISTEN_SOCK_MAGIC 0x999e4b57
@@ -62,167 +60,6 @@ struct heritage {
char identity[1024];
};
-struct params {
-
- /* Unprivileged user / group */
- char *user;
- uid_t uid;
- char *group;
- gid_t gid;
-
- /* TTL used for lack of anything better */
- double default_ttl;
-
- /* Default grace period */
- double default_grace;
-
- /* Default keep period */
- double default_keep;
-
- /* Maximum concurrent sessions */
- unsigned max_sess;
-
- /* Worker threads and pool */
- unsigned wthread_min;
- unsigned wthread_max;
- unsigned wthread_timeout;
- unsigned wthread_pools;
- unsigned wthread_add_threshold;
- unsigned wthread_add_delay;
- unsigned wthread_fail_delay;
- unsigned wthread_purge_delay;
- unsigned wthread_stats_rate;
- unsigned wthread_stacksize;
- unsigned wthread_workspace;
-
- unsigned queue_max;
-
- /* Memory allocation hints */
- unsigned sess_workspace;
- unsigned shm_workspace;
- unsigned http_req_size;
- unsigned http_req_hdr_len;
- unsigned http_resp_size;
- unsigned http_resp_hdr_len;
- unsigned http_max_hdr;
-
- unsigned shm_reclen;
-
- /* Acceptor hints */
- unsigned sess_timeout;
- unsigned pipe_timeout;
- unsigned send_timeout;
- unsigned idle_send_timeout;
-
- /* Management hints */
- unsigned auto_restart;
-
- /* Fetcher hints */
- unsigned fetch_chunksize;
- unsigned fetch_maxchunksize;
- unsigned nuke_limit;
-
-#ifdef SENDFILE_WORKS
- /* Sendfile object minimum size */
- unsigned sendfile_threshold;
-#endif
-
- /* VCL traces */
- unsigned vcl_trace;
-
- /* Listen address */
- char *listen_address;
-
- /* Listen depth */
- unsigned listen_depth;
-
- /* CLI related */
- unsigned cli_timeout;
- unsigned ping_interval;
-
- /* LRU list ordering interval */
- unsigned lru_timeout;
-
- /* Maximum restarts allowed */
- unsigned max_restarts;
-
- /* Maximum esi:include depth allowed */
- unsigned max_esi_depth;
-
- /* ESI parser hints */
- unsigned esi_syntax;
-
- /* Rush exponent */
- unsigned rush_exponent;
-
- /* Default connection_timeout */
- double connect_timeout;
-
- /* Read timeouts for backend */
- double first_byte_timeout;
- double between_bytes_timeout;
-
- /* How long to linger on sessions */
- unsigned session_linger;
-
- /* CLI buffer size */
- unsigned cli_buffer;
-
- /* Control diagnostic code */
- unsigned diag_bitmap;
-
- /* Log hash string to shm */
- unsigned log_hash;
-
- /* Log local socket address to shm */
- unsigned log_local_addr;
-
- /* Prefer IPv6 connections to backend*/
- unsigned prefer_ipv6;
-
- /* Acceptable clockskew with backends */
- unsigned clock_skew;
-
- /* Expiry pacer parameters */
- double expiry_sleep;
-
- /* Acceptor pacer parameters */
- double acceptor_sleep_max;
- double acceptor_sleep_incr;
- double acceptor_sleep_decay;
-
- /* Get rid of duplicate bans */
- unsigned ban_dups;
-
- /* How long time does the ban lurker sleep */
- double ban_lurker_sleep;
-
- /* Max size of the saintmode list. 0 == no saint mode. */
- unsigned saintmode_threshold;
-
- unsigned syslog_cli_traffic;
-
- unsigned http_range_support;
-
- unsigned http_gzip_support;
- unsigned gzip_stack_buffer;
- unsigned gzip_tmp_space;
- unsigned gzip_level;
- unsigned gzip_window;
- unsigned gzip_memlevel;
-
- double critbit_cooloff;
-
- double shortlived;
-
- struct vre_limits vre_limits;
-};
-
-/*
- * We declare this a volatile pointer, so that reads of parameters
- * become atomic, leaving the CLI thread lattitude to change the values
- */
-extern volatile struct params * cache_param;
extern struct heritage heritage;
void child_main(void);
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index cfe0b2f..d2e0abd 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -44,8 +44,9 @@
#include <unistd.h>
#include "mgt/mgt.h"
-
#include "heritage.h"
+#include "params.h"
+
#include "vapi/vsm_int.h"
#include "vbm.h"
#include "vcli.h"
diff --git a/bin/varnishd/mgt/mgt_cli.c b/bin/varnishd/mgt/mgt_cli.c
index ec8fd4d..3fdb432 100644
--- a/bin/varnishd/mgt/mgt_cli.c
+++ b/bin/varnishd/mgt/mgt_cli.c
@@ -43,8 +43,9 @@
#include <unistd.h>
#include "mgt/mgt.h"
-
#include "heritage.h"
+#include "params.h"
+
#include "vcli.h"
#include "vcli_common.h"
#include "vcli_priv.h"
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index dd898ee..cd96e8b 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -38,9 +38,10 @@
#include <unistd.h>
#include "mgt/mgt.h"
+#include "heritage.h"
+#include "params.h"
#include "waiter/cache_waiter.h"
-#include "heritage.h"
#include "vav.h"
#include "vcli.h"
#include "vcli_common.h"
diff --git a/bin/varnishd/mgt/mgt_pool.c b/bin/varnishd/mgt/mgt_pool.c
index 94459b4..548ad78 100644
--- a/bin/varnishd/mgt/mgt_pool.c
+++ b/bin/varnishd/mgt/mgt_pool.c
@@ -48,8 +48,9 @@
#include <unistd.h>
#include "mgt/mgt.h"
-
#include "heritage.h"
+#include "params.h"
+
#include "vparam.h"
/*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/mgt/mgt_sandbox.c b/bin/varnishd/mgt/mgt_sandbox.c
index e5fe99c..a9fce93 100644
--- a/bin/varnishd/mgt/mgt_sandbox.c
+++ b/bin/varnishd/mgt/mgt_sandbox.c
@@ -53,8 +53,8 @@
#include <unistd.h>
#include "mgt/mgt.h"
-
#include "heritage.h"
+#include "params.h"
/*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/mgt/mgt_shmem.c b/bin/varnishd/mgt/mgt_shmem.c
index 3953bdb..bb87a8f 100644
--- a/bin/varnishd/mgt/mgt_shmem.c
+++ b/bin/varnishd/mgt/mgt_shmem.c
@@ -98,9 +98,10 @@
#include <unistd.h>
#include "mgt/mgt.h"
+#include "heritage.h"
+#include "params.h"
#include "flopen.h"
-#include "heritage.h"
#include "vapi/vsc_int.h"
#include "vapi/vsl_int.h"
#include "vapi/vsm_int.h"
diff --git a/bin/varnishd/params.h b/bin/varnishd/params.h
index e6e6558..fb71e33 100644
--- a/bin/varnishd/params.h
+++ b/bin/varnishd/params.h
@@ -31,37 +31,6 @@
#include "vre.h"
-struct listen_sock {
- unsigned magic;
-#define LISTEN_SOCK_MAGIC 0x999e4b57
- VTAILQ_ENTRY(listen_sock) list;
- int sock;
- char *name;
- struct vss_addr *addr;
-};
-
-VTAILQ_HEAD(listen_sock_head, listen_sock);
-
-struct heritage {
-
- /* Two pipe(2)'s for CLI connection between cache and mgt. */
- int cli_in;
- int cli_out;
-
- /* File descriptor for stdout/stderr */
- int std_fd;
-
- /* Sockets from which to accept connections */
- struct listen_sock_head socks;
- unsigned nsocks;
-
- /* Hash method */
- const struct hash_slinger *hash;
-
- char *name;
- char identity[1024];
-};
-
struct params {
/* Unprivileged user / group */
@@ -223,6 +192,3 @@ struct params {
* become atomic, leaving the CLI thread lattitude to change the values
*/
extern volatile struct params * cache_param;
-extern struct heritage heritage;
-
-void child_main(void);
diff --git a/bin/varnishd/varnishd.c b/bin/varnishd/varnishd.c
index 6ae1842..ccda130 100644
--- a/bin/varnishd/varnishd.c
+++ b/bin/varnishd/varnishd.c
@@ -44,9 +44,10 @@
#include <unistd.h>
#include "mgt/mgt.h"
+#include "heritage.h"
+#include "params.h"
#include "hash/hash_slinger.h"
-#include "heritage.h"
#include "vav.h"
#include "vcli.h"
#include "vcli_common.h"
diff --git a/include/libvcl.h b/include/libvcl.h
index a92906f..e046db9 100644
--- a/include/libvcl.h
+++ b/include/libvcl.h
@@ -37,4 +37,3 @@ void VCC_VMOD_dir(struct vcc *, const char *str);
void VCC_Err_Unref(struct vcc *tl, unsigned u);
char *VCC_Compile(const struct vcc *, struct vsb *sb, const char *b);
-const char *VCC_Return_Name(unsigned action);
diff --git a/lib/libvcl/vcc_compile.c b/lib/libvcl/vcc_compile.c
index a0c6232..5719cbf 100644
--- a/lib/libvcl/vcc_compile.c
+++ b/lib/libvcl/vcc_compile.c
@@ -710,21 +710,6 @@ VCC_Compile(const struct vcc *tl, struct vsb *sb, const char *b)
return (r);
}
-/*--------------------------------------------------------------------*/
-
-const char *
-VCC_Return_Name(unsigned method)
-{
-
- switch (method) {
-#define VCL_RET_MAC(l, U, B) case VCL_RET_##U: return(#l);
-#include "tbl/vcl_returns.h"
-#undef VCL_RET_MAC
- default:
- return (NULL);
- }
-}
-
/*--------------------------------------------------------------------
* Allocate a compiler instance
*/
More information about the varnish-commit
mailing list