[master] 31a7949 Split truly private parts of vapi/vsl_int.h into vsl_priv.h

Poul-Henning Kamp phk at FreeBSD.org
Wed Mar 4 12:06:58 CET 2015


commit 31a79493ab7c7a392509326127e81d3e29c13e48
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Mar 4 11:02:50 2015 +0000

    Split truly private parts of vapi/vsl_int.h into vsl_priv.h

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 9b408ac..8f58e00 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -38,7 +38,7 @@
 
 #include "common/common.h"
 
-#include "vapi/vsl_int.h"
+#include "vsl_priv.h"
 
 #include <sys/socket.h>
 
diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index d48f776..98c04aa 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -35,6 +35,7 @@
 #include "cache.h"
 #include "common/heritage.h"
 
+#include "vsl_priv.h"
 #include "vmb.h"
 #include "vtim.h"
 
diff --git a/bin/varnishd/mgt/mgt_param_bits.c b/bin/varnishd/mgt/mgt_param_bits.c
index 32a4593..627c7a9 100644
--- a/bin/varnishd/mgt/mgt_param_bits.c
+++ b/bin/varnishd/mgt/mgt_param_bits.c
@@ -39,7 +39,7 @@
 
 #include "vav.h"
 
-#include "vapi/vsl_int.h"
+#include "vsl_priv.h"
 
 /*--------------------------------------------------------------------
  */
diff --git a/include/Makefile.am b/include/Makefile.am
index ec6c2aa..603a085 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -79,6 +79,7 @@ nobase_noinst_HEADERS = \
 	vnum.h \
 	vpf.h \
 	vrnd.h \
+	vsl_priv.h \
 	vsm_priv.h \
 	vsub.h \
 	vss.h \
diff --git a/include/vapi/vsl_int.h b/include/vapi/vsl_int.h
index 30692ba..a694341 100644
--- a/include/vapi/vsl_int.h
+++ b/include/vapi/vsl_int.h
@@ -27,15 +27,16 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * Define the layout of the shared memory log segment.
+ * Define the layout of the shared memory log segment, which must be kept
+ * in sync between vsl_priv.h and vapi/vsl.h.
+ *
+ * This file SHALL not be included from anywhere but those two files.
  *
  * NB: THIS IS NOT A PUBLIC API TO VARNISH!
  */
 
-#ifndef VAPI_VSL_FMT_H_INCLUDED
-#define VAPI_VSL_FMT_H_INCLUDED
-
-#include "vapi/vsm_int.h"
+#ifndef VAPI_VSL_INT_H_INCLUDED
+#define VAPI_VSL_INT_H_INCLUDED
 
 #define VSL_CLASS		"Log"
 #define VSL_SEGMENTS		8
@@ -43,17 +44,6 @@
 /*
  * Shared memory log format
  *
- * The segments array has index values providing safe entry points into
- * the log, where each element N gives the index of the first log record
- * in the Nth fraction of the log. An index value of -1 indicated that no
- * log records in this fraction exists.
- *
- * The segment member shows the current segment where Varnish is currently
- * appending log data.
- *
- * The seq member contains a non-zero seq number randomly initialized,
- * which increases whenever writing the log starts from the front.
- *
  * The log member points to an array of 32bit unsigned integers containing
  * log records.
  *
@@ -69,15 +59,6 @@
  * changing corresponding magic numbers in varnishd/cache/cache_shmlog.c
  */
 
-struct VSL_head {
-#define VSL_HEAD_MARKER		"VSLHEAD0"	/* Incr. as version# */
-	char			marker[VSM_MARKER_LEN];
-	volatile ssize_t	segments[VSL_SEGMENTS];
-	volatile unsigned	segment;	/* Current varnishd segment */
-	volatile unsigned	seq;		/* Non-zero seq number */
-	uint32_t		log[];
-};
-
 #define VSL_CLIENTMARKER	(1U<<30)
 #define VSL_BACKENDMARKER	(1U<<31)
 #define VSL_IDENTMASK		(~(3U<<30))
@@ -118,4 +99,4 @@ enum VSL_tag_e {
 #define SLT_F_UNUSED		(1 << 0)
 #define SLT_F_BINARY		(1 << 1)
 
-#endif /* VAPI_VSL_FMT_H_INCLUDED */
+#endif /* VAPI_VSL_INT_H_INCLUDED */
diff --git a/include/vsl_priv.h b/include/vsl_priv.h
new file mode 100644
index 0000000..d5643ed
--- /dev/null
+++ b/include/vsl_priv.h
@@ -0,0 +1,71 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2014 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ * Author: Martin Blix Grydeland <martin at varnish-software.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Define the layout of the shared memory log segment.
+ *
+ * NB: THIS IS NOT A PUBLIC API TO VARNISH!
+ */
+
+#ifndef VSL_PRIV_H_INCLUDED
+#define VSL_PRIV_H_INCLUDED
+
+#include "vapi/vsl_int.h"
+#include "vapi/vsm_int.h"
+
+#define VSL_CLASS		"Log"
+#define VSL_SEGMENTS		8
+
+/*
+ * Shared memory log format
+ *
+ * The segments array has index values providing safe entry points into
+ * the log, where each element N gives the index of the first log record
+ * in the Nth fraction of the log. An index value of -1 indicated that no
+ * log records in this fraction exists.
+ *
+ * The segment member shows the current segment where Varnish is currently
+ * appending log data.
+ *
+ * The seq member contains a non-zero seq number randomly initialized,
+ * which increases whenever writing the log starts from the front.
+ *
+ * The format of the actual log is in vapi/vsl_int.h
+ *
+ */
+
+struct VSL_head {
+#define VSL_HEAD_MARKER		"VSLHEAD0"	/* Incr. as version# */
+	char			marker[VSM_MARKER_LEN];
+	volatile ssize_t	segments[VSL_SEGMENTS];
+	volatile unsigned	segment;	/* Current varnishd segment */
+	volatile unsigned	seq;		/* Non-zero seq number */
+	uint32_t		log[];
+};
+
+#endif /* VSL_PRIV_H_INCLUDED */
diff --git a/lib/libvarnishapi/vsl_cursor.c b/lib/libvarnishapi/vsl_cursor.c
index 7dcd7d5..22d68bf 100644
--- a/lib/libvarnishapi/vsl_cursor.c
+++ b/lib/libvarnishapi/vsl_cursor.c
@@ -41,9 +41,9 @@
 
 #include "vas.h"
 #include "miniobj.h"
-#include "vapi/vsm.h"
 #include "vsm_api.h"
 #include "vapi/vsl.h"
+#include "vsl_priv.h"
 #include "vsl_api.h"
 
 struct vslc_vsm {



More information about the varnish-commit mailing list