summaryrefslogtreecommitdiffstats
path: root/sys/cddl/compat
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2013-08-06 15:51:56 +0000
committeravg <avg@FreeBSD.org>2013-08-06 15:51:56 +0000
commita07c9d34c39b8316691600e021968b318b087434 (patch)
tree43da06fcd1bc6c1b678d5db8fc0a0a2cfcf19f6e /sys/cddl/compat
parentcd60e1fa27e6b6272254aba34a77694d9954788c (diff)
downloadFreeBSD-src-a07c9d34c39b8316691600e021968b318b087434.zip
FreeBSD-src-a07c9d34c39b8316691600e021968b318b087434.tar.gz
opensolaris code: translate INVARIANTS to DEBUG and ZFS_DEBUG
Do this by forcing inclusion of sys/cddl/compat/opensolaris/sys/debug_compat.h via -include option into all source files from OpenSolaris. Note that this -include option must always be after -include opt_global.h. Additionally, remove forced definition of DEBUG for some modules and fix their build without DEBUG. Also, meaning of DEBUG was overloaded to enable WITNESS support for some OpenSolaris (primarily ZFS) locks. Now this overloading is removed and that use of DEBUG is replaced with a new option OPENSOLARIS_WITNESS. MFC after: 17 days
Diffstat (limited to 'sys/cddl/compat')
-rw-r--r--sys/cddl/compat/opensolaris/sys/debug_compat.h37
-rw-r--r--sys/cddl/compat/opensolaris/sys/mutex.h2
-rw-r--r--sys/cddl/compat/opensolaris/sys/rwlock.h2
3 files changed, 39 insertions, 2 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/debug_compat.h b/sys/cddl/compat/opensolaris/sys/debug_compat.h
new file mode 100644
index 0000000..72756a9
--- /dev/null
+++ b/sys/cddl/compat/opensolaris/sys/debug_compat.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2013 Andriy Gapon <avg@FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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 AUTHORS 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 THE AUTHORS 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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * This is a special file that SHOULD NOT be included using #include directive.
+ */
+
+#if defined(INVARIANTS)
+#ifndef DEBUG
+#define DEBUG
+#endif
+#endif
diff --git a/sys/cddl/compat/opensolaris/sys/mutex.h b/sys/cddl/compat/opensolaris/sys/mutex.h
index eff4166..b1982e7 100644
--- a/sys/cddl/compat/opensolaris/sys/mutex.h
+++ b/sys/cddl/compat/opensolaris/sys/mutex.h
@@ -46,7 +46,7 @@ typedef enum {
typedef struct sx kmutex_t;
-#ifndef DEBUG
+#ifndef OPENSOLARIS_WITNESS
#define MUTEX_FLAGS (SX_DUPOK | SX_NOWITNESS)
#else
#define MUTEX_FLAGS (SX_DUPOK)
diff --git a/sys/cddl/compat/opensolaris/sys/rwlock.h b/sys/cddl/compat/opensolaris/sys/rwlock.h
index 996a426..3724136 100644
--- a/sys/cddl/compat/opensolaris/sys/rwlock.h
+++ b/sys/cddl/compat/opensolaris/sys/rwlock.h
@@ -47,7 +47,7 @@ typedef enum {
typedef struct sx krwlock_t;
-#ifndef DEBUG
+#ifndef OPENSOLARIS_WITNESS
#define RW_FLAGS (SX_DUPOK | SX_NOWITNESS)
#else
#define RW_FLAGS (SX_DUPOK)
OpenPOWER on IntegriCloud