[master] bf43a64 Split waiter stuff into private and public headers

Poul-Henning Kamp phk at FreeBSD.org
Wed Jan 14 10:01:24 CET 2015


commit bf43a6479bbb623d3aff70db208350cb17e4dd39
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jan 14 09:00:53 2015 +0000

    Split waiter stuff into private and public headers

diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am
index c0f6c1f..b5aafb0 100644
--- a/bin/varnishd/Makefile.am
+++ b/bin/varnishd/Makefile.am
@@ -102,7 +102,8 @@ noinst_HEADERS = \
 	mgt/mgt_param.h \
 	storage/storage.h \
 	storage/storage_persistent.h \
-	waiter/waiter.h
+	waiter/waiter.h \
+	waiter/waiter_priv.h
 
 # Headers for use with vmods
 nobase_pkginclude_HEADERS = \
diff --git a/bin/varnishd/waiter/cache_waiter.c b/bin/varnishd/waiter/cache_waiter.c
index f9d3a42..82f2175 100644
--- a/bin/varnishd/waiter/cache_waiter.c
+++ b/bin/varnishd/waiter/cache_waiter.c
@@ -38,14 +38,7 @@
 #include "cache/cache.h"
 
 #include "waiter/waiter.h"
-
-struct waiter {
-	unsigned			magic;
-#define WAITER_MAGIC			0x17c399db
-	const struct waiter_impl	*impl;
-	void				*priv;
-	int				pfd;
-};
+#include "waiter/waiter_priv.h"
 
 const char *
 WAIT_GetName(void)
diff --git a/bin/varnishd/waiter/cache_waiter_epoll.c b/bin/varnishd/waiter/cache_waiter_epoll.c
index e8c7110..6c25918 100644
--- a/bin/varnishd/waiter/cache_waiter_epoll.c
+++ b/bin/varnishd/waiter/cache_waiter_epoll.c
@@ -42,6 +42,7 @@
 #include "cache/cache.h"
 
 #include "waiter/waiter.h"
+#include "waiter/waiter_priv.h"
 #include "vtim.h"
 #include "vfil.h"
 
diff --git a/bin/varnishd/waiter/cache_waiter_kqueue.c b/bin/varnishd/waiter/cache_waiter_kqueue.c
index 4fcdbfa..162c799 100644
--- a/bin/varnishd/waiter/cache_waiter_kqueue.c
+++ b/bin/varnishd/waiter/cache_waiter_kqueue.c
@@ -44,6 +44,7 @@
 #include "cache/cache.h"
 
 #include "waiter/waiter.h"
+#include "waiter/waiter_priv.h"
 #include "vtim.h"
 #include "vfil.h"
 
diff --git a/bin/varnishd/waiter/cache_waiter_poll.c b/bin/varnishd/waiter/cache_waiter_poll.c
index d7c8f92..9029007 100644
--- a/bin/varnishd/waiter/cache_waiter_poll.c
+++ b/bin/varnishd/waiter/cache_waiter_poll.c
@@ -37,6 +37,7 @@
 #include "cache/cache.h"
 
 #include "waiter/waiter.h"
+#include "waiter/waiter_priv.h"
 #include "vtim.h"
 #include "vfil.h"
 
diff --git a/bin/varnishd/waiter/cache_waiter_ports.c b/bin/varnishd/waiter/cache_waiter_ports.c
index be110c0..6599ea3 100644
--- a/bin/varnishd/waiter/cache_waiter_ports.c
+++ b/bin/varnishd/waiter/cache_waiter_ports.c
@@ -43,6 +43,7 @@
 #include "cache/cache.h"
 
 #include "waiter/waiter.h"
+#include "waiter/waiter_priv.h"
 #include "vtim.h"
 
 #define MAX_EVENTS 256
diff --git a/bin/varnishd/waiter/mgt_waiter.c b/bin/varnishd/waiter/mgt_waiter.c
index 89f2949..54c3c34 100644
--- a/bin/varnishd/waiter/mgt_waiter.c
+++ b/bin/varnishd/waiter/mgt_waiter.c
@@ -36,6 +36,7 @@
 #include "common/common.h"
 
 #include "waiter/waiter.h"
+#include "waiter/waiter_priv.h"
 
 static const struct waiter_impl *const waiter_impls[] = {
     #if defined(HAVE_KQUEUE)
diff --git a/bin/varnishd/waiter/waiter.h b/bin/varnishd/waiter/waiter.h
index e1b24d3..be9791d 100644
--- a/bin/varnishd/waiter/waiter.h
+++ b/bin/varnishd/waiter/waiter.h
@@ -38,6 +38,8 @@
  * - kqueue on FreeBSD
  * - epoll on Linux
  * - ports on Solaris
+ *
+ * Public interfaces
  */
 
 struct waited;
@@ -49,17 +51,9 @@ enum wait_event {
 	WAITER_ACTION
 };
 
-typedef void waiter_handle_f(struct waited *, enum wait_event, double now);
-typedef void* waiter_init_f(waiter_handle_f *, int *, volatile double *);
-typedef int waiter_pass_f(void *priv, struct waited *);
-
 #define WAITER_DEFAULT		"platform dependent"
 
-struct waiter_impl {
-	const char		*name;
-	waiter_init_f		*init;
-	waiter_pass_f		*pass;
-};
+typedef void waiter_handle_f(struct waited *, enum wait_event, double now);
 
 /* cache_waiter.c */
 int WAIT_Enter(const struct waiter *, struct waited *);
@@ -67,19 +61,4 @@ struct waiter *WAIT_Init(waiter_handle_f *, volatile double *timeout);
 const char *WAIT_GetName(void);
 
 /* mgt_waiter.c */
-extern struct waiter_impl const * waiter;
 int WAIT_tweak_waiter(struct vsb *vsb, const char *arg);
-
-#if defined(HAVE_EPOLL_CTL)
-extern const struct waiter_impl waiter_epoll;
-#endif
-
-#if defined(HAVE_KQUEUE)
-extern const struct waiter_impl waiter_kqueue;
-#endif
-
-#if defined(HAVE_PORT_CREATE)
-extern const struct waiter_impl waiter_ports;
-#endif
-
-extern const struct waiter_impl waiter_poll;
diff --git a/bin/varnishd/waiter/waiter_priv.h b/bin/varnishd/waiter/waiter_priv.h
new file mode 100644
index 0000000..afa8cf0
--- /dev/null
+++ b/bin/varnishd/waiter/waiter_priv.h
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2011 Varnish Software 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.
+ *
+ * Private interfaces
+ */
+
+struct waited;
+
+struct waiter {
+	unsigned			magic;
+	#define WAITER_MAGIC		0x17c399db
+	const struct waiter_impl	*impl;
+	void				*priv;
+	int				pfd;
+};
+
+typedef void* waiter_init_f(waiter_handle_f *, int *, volatile double *);
+typedef int waiter_pass_f(void *priv, struct waited *);
+
+struct waiter_impl {
+	const char		*name;
+	waiter_init_f		*init;
+	waiter_pass_f		*pass;
+};
+
+/* mgt_waiter.c */
+extern struct waiter_impl const * waiter;
+
+#if defined(HAVE_EPOLL_CTL)
+extern const struct waiter_impl waiter_epoll;
+#endif
+
+#if defined(HAVE_KQUEUE)
+extern const struct waiter_impl waiter_kqueue;
+#endif
+
+#if defined(HAVE_PORT_CREATE)
+extern const struct waiter_impl waiter_ports;
+#endif
+
+extern const struct waiter_impl waiter_poll;



More information about the varnish-commit mailing list