* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
#endif
#include <linux/smp_lock.h>
+#include <linux/mutex.h>
/*
* IMPORTANT !!!!!!!!
* - wait_for_completion(c)
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
+
+/**************************************************************************
+ *
+ * Mutex interface from newer Linux kernels.
+ *
+ * this augments compatibility interface from include/linux/mutex.h
+ *
+ **************************************************************************/
+
+struct mutex;
+
+static inline void mutex_destroy(struct mutex *lock)
+{
+}
+
+/*
+ * This is for use in assertions _only_, i.e., this function should always
+ * return 1.
+ *
+ * \retval 1 mutex is locked.
+ *
+ * \retval 0 mutex is not locked. This should never happen.
+ */
+static inline int mutex_is_locked(struct mutex *lock)
+{
+ return 1;
+}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+
+/**************************************************************************
+ *
+ * Lockdep "implementation". Also see liblustre.h
+ *
+ **************************************************************************/
+
+struct lock_class_key {
+ ;
+};
+
+#ifndef lockdep_set_class
+# define lockdep_set_class(lock, key) do {;} while (0)
+#endif
+
+/* This has to be a macro, so that `subclass' can be undefined in kernels that
+ * do not support lockdep. */
+#ifndef mutex_lock_nested
+# define mutex_lock_nested(mutex, subclass) mutex_lock(mutex)
+#endif
+
+#ifndef spin_lock_nested
+# define spin_lock_nested(lock, subclass) spin_lock(lock)
#endif
+
+#ifndef down_read_nested
+# define down_read_nested(lock, subclass) down_read(lock)
+#endif
+
+#ifndef down_write_nested
+# define down_write_nested(lock, subclass) down_write(lock)
+#endif
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
+
+#endif /* __LIBCFS_LINUX_CFS_LOCK_H__ */