r4928 - in trunk/varnish-cache: bin/varnishd include lib/libvarnish lib/libvarnishapi

phk at varnish-cache.org phk at varnish-cache.org
Tue Jun 8 11:23:38 CEST 2010


Author: phk
Date: 2010-06-08 11:23:38 +0200 (Tue, 08 Jun 2010)
New Revision: 4928

Added:
   trunk/varnish-cache/include/vin.h
   trunk/varnish-cache/include/vsm.h
Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_panic.c
   trunk/varnish-cache/bin/varnishd/cache_shmlog.c
   trunk/varnish-cache/bin/varnishd/mgt.h
   trunk/varnish-cache/bin/varnishd/mgt_child.c
   trunk/varnish-cache/bin/varnishd/mgt_shmem.c
   trunk/varnish-cache/bin/varnishd/varnishd.c
   trunk/varnish-cache/include/Makefile.am
   trunk/varnish-cache/include/shmlog.h
   trunk/varnish-cache/lib/libvarnish/vin.c
   trunk/varnish-cache/lib/libvarnishapi/vsl.c
   trunk/varnish-cache/lib/libvarnishapi/vsl_arg.c
   trunk/varnish-cache/lib/libvarnishapi/vsl_log.c
   trunk/varnish-cache/lib/libvarnishapi/vsl_stat.c
Log:
Move vin stuff into vin.h and vsm stuff into vsm.h



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2010-06-08 09:23:38 UTC (rev 4928)
@@ -634,7 +634,7 @@
 
 /* cache_shmlog.c */
 void VSL_Init(void);
-#ifdef VSM_HEAD_MAGIC
+#ifdef VSL_ENDMARKER
 void VSL(enum shmlogtag tag, int id, const char *fmt, ...);
 void WSLR(struct worker *w, enum shmlogtag tag, int id, txt t);
 void WSL(struct worker *w, enum shmlogtag tag, int id, const char *fmt, ...);

Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_panic.c	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/bin/varnishd/cache_panic.c	2010-06-08 09:23:38 UTC (rev 4928)
@@ -44,6 +44,7 @@
 #include <execinfo.h>
 #endif
 #include "cache.h"
+#include "vsm.h"
 #include "shmlog.h"
 #include "cache_backend.h"
 #include "vcl.h"

Modified: trunk/varnish-cache/bin/varnishd/cache_shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_shmlog.c	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/bin/varnishd/cache_shmlog.c	2010-06-08 09:23:38 UTC (rev 4928)
@@ -36,6 +36,7 @@
 #include <unistd.h>
 #include <stdarg.h>
 
+#include "vsm.h"
 #include "shmlog.h"
 #include "cache.h"
 #include "vmb.h"

Modified: trunk/varnish-cache/bin/varnishd/mgt.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt.h	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/bin/varnishd/mgt.h	2010-06-08 09:23:38 UTC (rev 4928)
@@ -71,7 +71,7 @@
 #endif
 
 /* mgt_shmem.c */
-void mgt_SHM_Init(const char *fn, const char *arg);
+void mgt_SHM_Init(const char *arg);
 void mgt_SHM_Pid(void);
 
 /* mgt_vcc.c */

Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c	2010-06-08 09:23:38 UTC (rev 4928)
@@ -59,7 +59,7 @@
 #endif
 
 #include "mgt.h"
-#include "shmlog.h"
+#include "vsm.h"
 #include "heritage.h"
 #include "cli.h"
 #include "cli_priv.h"

Modified: trunk/varnish-cache/bin/varnishd/mgt_shmem.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_shmem.c	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/bin/varnishd/mgt_shmem.c	2010-06-08 09:23:38 UTC (rev 4928)
@@ -41,6 +41,7 @@
 #include <sys/mman.h>
 #include <sys/stat.h>
 
+#include "vsm.h"
 #include "shmlog.h"
 #include "mgt.h"
 #include "heritage.h"
@@ -194,7 +195,7 @@
 }
 
 void
-mgt_SHM_Init(const char *fn, const char *l_arg)
+mgt_SHM_Init(const char *l_arg)
 {
 	int i, fill;
 	struct params *pp;
@@ -259,13 +260,13 @@
 	size += ps - 1;
 	size &= ~(ps - 1);
 
-	i = open(fn, O_RDWR, 0644);
+	i = open(VSM_FILENAME, O_RDWR, 0644);
 	if (i >= 0) {
 		vsl_n_check(i);
 		(void)close(i);
 	}
 	(void)close(i);
-	vsl_buildnew(fn, size, fill);
+	vsl_buildnew(VSM_FILENAME, size, fill);
 
 	loghead = (void *)mmap(NULL, size,
 	    PROT_READ|PROT_WRITE,

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2010-06-08 09:23:38 UTC (rev 4928)
@@ -66,7 +66,7 @@
 #include "cli_priv.h"
 #include "cli_common.h"
 
-#include "shmlog.h"
+#include "vin.h"
 #include "heritage.h"
 #include "mgt.h"
 #include "hash_slinger.h"
@@ -623,7 +623,7 @@
 
 	HSH_config(h_arg);
 
-	mgt_SHM_Init(VSM_FILENAME, l_arg);
+	mgt_SHM_Init(l_arg);
 
 	vsb_finish(vident);
 	AZ(vsb_overflowed(vident));

Modified: trunk/varnish-cache/include/Makefile.am
===================================================================
--- trunk/varnish-cache/include/Makefile.am	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/include/Makefile.am	2010-06-08 09:23:38 UTC (rev 4928)
@@ -1,6 +1,7 @@
 # $Id$
 
 pkginclude_HEADERS = \
+	vsm.h \
 	shmlog.h \
 	shmlog_tags.h \
 	stat_field.h \

Modified: trunk/varnish-cache/include/shmlog.h
===================================================================
--- trunk/varnish-cache/include/shmlog.h	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/include/shmlog.h	2010-06-08 09:23:38 UTC (rev 4928)
@@ -36,49 +36,8 @@
 #ifndef SHMLOG_H_INCLUDED
 #define SHMLOG_H_INCLUDED
 
-#define VSM_FILENAME		"_.vsm"
-
-#include <time.h>
-#include <sys/types.h>
-
 #include "stats.h"
 
-/*
- * This structure describes each allocation from the shmlog
- */
-
-struct vsm_chunk {
-#define VSM_CHUNK_MAGIC		0x43907b6e	/* From /dev/random */
-	unsigned		magic;
-	unsigned		len;
-	char			class[8];
-	char			type[8];
-	char			ident[16];
-};
-
-#define VSM_NEXT(sha)		((void*)((uintptr_t)(sha) + (sha)->len))
-#define VSM_PTR(sha)		((void*)((uintptr_t)((sha) + 1)))
-
-struct vsm_head {
-#define VSM_HEAD_MAGIC		4185512502U	/* From /dev/random */
-	unsigned		magic;
-
-	unsigned		hdrsize;
-
-	time_t			starttime;
-	pid_t			master_pid;
-	pid_t			child_pid;
-
-	unsigned		shm_size;
-
-	/* Panic message buffer */
-	char			panicstr[64 * 1024];
-
-	unsigned		alloc_seq;
-	/* Must be last element */
-	struct vsm_chunk	head;
-};
-
 #define VSM_CLASS_LOG		"Log"
 #define VSM_CLASS_STAT		"Stat"
 
@@ -118,12 +77,4 @@
 	SLT_Reserved = 255
 };
 
-/* This function lives in both libvarnish and libvarnishapi */
-int vin_n_arg(const char *n_arg, char **name, char **dir, char **vsl);
-char *vin_L_arg(unsigned L_arg);
-#define VIN_L_LOW	1024
-#define VIN_L_HIGH	65000
-#define VIN_L_OK(a)	(a >= VIN_L_LOW && a <= VIN_L_HIGH)
-#define VIN_L_MSG	"-L argument must be [1024...65000]"
-
 #endif

Copied: trunk/varnish-cache/include/vin.h (from rev 4927, trunk/varnish-cache/include/shmlog.h)
===================================================================
--- trunk/varnish-cache/include/vin.h	                        (rev 0)
+++ trunk/varnish-cache/include/vin.h	2010-06-08 09:23:38 UTC (rev 4928)
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2009 Linpro AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * 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.
+ *
+ * $Id$
+ *
+ */
+
+#ifndef VIN_H_INCLUDED
+#define VIN_H_INCLUDED
+
+/* This function lives in both libvarnish and libvarnishapi */
+int vin_n_arg(const char *n_arg, char **name, char **dir, char **vsl);
+char *vin_L_arg(unsigned L_arg);
+#define VIN_L_LOW	1024
+#define VIN_L_HIGH	65000
+#define VIN_L_OK(a)	(a >= VIN_L_LOW && a <= VIN_L_HIGH)
+#define VIN_L_MSG	"-L argument must be [1024...65000]"
+
+#endif

Copied: trunk/varnish-cache/include/vsm.h (from rev 4927, trunk/varnish-cache/include/shmlog.h)
===================================================================
--- trunk/varnish-cache/include/vsm.h	                        (rev 0)
+++ trunk/varnish-cache/include/vsm.h	2010-06-08 09:23:38 UTC (rev 4928)
@@ -0,0 +1,80 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2009 Linpro AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * 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.
+ *
+ * $Id$
+ *
+ * Define the layout of the shared memory log segment.
+ *
+ * NB: THIS IS NOT A PUBLIC API TO VARNISH!
+ */
+
+#ifndef VSM_H_INCLUDED
+#define VSM_H_INCLUDED
+
+#define VSM_FILENAME		"_.vsm"
+
+#include <time.h>
+#include <sys/types.h>
+
+/*
+ * This structure describes each allocation from the shmlog
+ */
+
+struct vsm_chunk {
+#define VSM_CHUNK_MAGIC		0x43907b6e	/* From /dev/random */
+	unsigned		magic;
+	unsigned		len;
+	char			class[8];
+	char			type[8];
+	char			ident[16];
+};
+
+#define VSM_NEXT(sha)		((void*)((uintptr_t)(sha) + (sha)->len))
+#define VSM_PTR(sha)		((void*)((uintptr_t)((sha) + 1)))
+
+struct vsm_head {
+#define VSM_HEAD_MAGIC		4185512502U	/* From /dev/random */
+	unsigned		magic;
+
+	unsigned		hdrsize;
+
+	time_t			starttime;
+	pid_t			master_pid;
+	pid_t			child_pid;
+
+	unsigned		shm_size;
+
+	/* Panic message buffer */
+	char			panicstr[64 * 1024];
+
+	unsigned		alloc_seq;
+	/* Must be last element */
+	struct vsm_chunk	head;
+};
+
+#endif

Modified: trunk/varnish-cache/lib/libvarnish/vin.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/vin.c	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/lib/libvarnish/vin.c	2010-06-08 09:23:38 UTC (rev 4928)
@@ -40,7 +40,8 @@
 #include <unistd.h>
 
 #include "libvarnish.h"
-#include "shmlog.h"
+#include "vsm.h"
+#include "vin.h"
 
 int
 vin_n_arg(const char *n_arg, char **name, char **dir, char **vsl)

Modified: trunk/varnish-cache/lib/libvarnishapi/vsl.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/vsl.c	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/lib/libvarnishapi/vsl.c	2010-06-08 09:23:38 UTC (rev 4928)
@@ -44,7 +44,8 @@
 #include <unistd.h>
 
 #include "vas.h"
-#include "shmlog.h"
+#include "vin.h"
+#include "vsm.h"
 #include "vre.h"
 #include "vbm.h"
 #include "vqueue.h"

Modified: trunk/varnish-cache/lib/libvarnishapi/vsl_arg.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/vsl_arg.c	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/lib/libvarnishapi/vsl_arg.c	2010-06-08 09:23:38 UTC (rev 4928)
@@ -45,7 +45,7 @@
 
 #include "vas.h"
 #include "argv.h"
-#include "shmlog.h"
+#include "vin.h"
 #include "vre.h"
 #include "vbm.h"
 #include "vqueue.h"

Modified: trunk/varnish-cache/lib/libvarnishapi/vsl_log.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/vsl_log.c	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/lib/libvarnishapi/vsl_log.c	2010-06-08 09:23:38 UTC (rev 4928)
@@ -41,6 +41,7 @@
 #include <unistd.h>
 
 #include "vas.h"
+#include "vsm.h"
 #include "shmlog.h"
 #include "vre.h"
 #include "vbm.h"

Modified: trunk/varnish-cache/lib/libvarnishapi/vsl_stat.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/vsl_stat.c	2010-06-08 09:09:49 UTC (rev 4927)
+++ trunk/varnish-cache/lib/libvarnishapi/vsl_stat.c	2010-06-08 09:23:38 UTC (rev 4928)
@@ -37,6 +37,7 @@
 #include <string.h>
 
 #include "vas.h"
+#include "vsm.h"
 #include "shmlog.h"
 #include "vre.h"
 #include "vqueue.h"




More information about the varnish-commit mailing list