summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorRicardo M. Correia <[email protected]>2010-07-20 13:47:37 -0700
committerBrian Behlendorf <[email protected]>2010-07-20 13:47:52 -0700
commit22cd0f19b170394ac98ca3984e8f5b119fa32c7e (patch)
tree9a5e01e21799216e2f47be328cdd845c5ad5e2e1 /include/linux
parentb17edc10a9c66543bef54b08e4655832aefe8939 (diff)
Fix compilation error due to undefined ACCESS_ONCE macro.
When CONFIG_DEBUG_MUTEXES is turned on in RHEL5's kernel config, the mutexes store the owner for debugging purposes, therefore the SPL will enable HAVE_MUTEX_OWNER. However, the SPL code uses ACCESS_ONCE() to access the owner, and this macro is not defined in the RHEL5 kernel, therefore we define it ourselves in include/linux/compiler_compat.h. Signed-off-by: Ricardo M. Correia <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/compiler_compat.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/linux/compiler_compat.h b/include/linux/compiler_compat.h
new file mode 100644
index 000000000..de3b3c391
--- /dev/null
+++ b/include/linux/compiler_compat.h
@@ -0,0 +1,47 @@
+/*****************************************************************************\
+ * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
+ * Copyright (C) 2007 The Regents of the University of California.
+ * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+ * Written by Brian Behlendorf <[email protected]>.
+ * UCRL-CODE-235197
+ *
+ * This file is part of the SPL, Solaris Porting Layer.
+ * For details, see <http://github.com/behlendorf/spl/>.
+ *
+ * The SPL is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The SPL is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the SPL. If not, see <http://www.gnu.org/licenses/>.
+\*****************************************************************************/
+
+#ifndef _SPL_COMPILER_COMPAT_H
+#define _SPL_COMPILER_COMPAT_H
+
+#include <linux/compiler.h>
+
+#ifndef ACCESS_ONCE
+/*
+ * Prevent the compiler from merging or refetching accesses. The compiler
+ * is also forbidden from reordering successive instances of ACCESS_ONCE(),
+ * but only when the compiler is aware of some particular ordering. One way
+ * to make the compiler aware of ordering is to put the two invocations of
+ * ACCESS_ONCE() in different C statements.
+ *
+ * This macro does absolutely -nothing- to prevent the CPU from reordering,
+ * merging, or refetching absolutely anything at any time. Its main intended
+ * use is to mediate communication between process-level code and irq/NMI
+ * handlers, all running on the same CPU.
+ */
+/* Taken from 2.6.33.2 */
+# define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+#endif
+
+#endif /* _SPL_COMPILER_COMPAT_H */