]) # LIBCFS_ENABLE_CRC32C_ACCEL
#
+# Kernel version v3.8-rc4-82-g4f522a247bc2 exported d_hash_and_lookup()
+# It was added in v2.6.16-3821-g3e7e241f8c5c, so no worries about header.
+#
+AC_DEFUN([LIBCFS_D_HASH_AND_LOOKUP],[
+LB_CHECK_EXPORT([d_hash_and_lookup], [fs/dcache.c],
+ [AC_DEFINE(HAVE_D_HASH_AND_LOOKUP, 1,
+ [d_hash_and_lookup is exported by the kernel])])
+]) # LIBCFS_D_HASH_AND_LOOKUP
+
+#
# Kernel version 3.11 introduced ktime_get_ts64
#
AC_DEFUN([LIBCFS_KTIME_GET_TS64],[
LIBCFS_I_UID_READ
# 3.8
LIBCFS_HAVE_CRC32
+LIBCFS_D_HASH_AND_LOOKUP
LIBCFS_ENABLE_CRC32_ACCEL
# 3.10
LIBCFS_ENABLE_CRC32C_ACCEL
symlinks->target);
}
+#ifndef HAVE_D_HASH_AND_LOOKUP
+/**
+ * d_hash_and_lookup - hash the qstr then search for a dentry
+ * @dir: Directory to search in
+ * @name: qstr of name we wish to find
+ *
+ * On lookup failure NULL is returned; on bad name - ERR_PTR(-error)
+ */
+struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name)
+{
+ /*
+ * Check for a fs-specific hash function. Note that we must
+ * calculate the standard hash first, as the d_op->d_hash()
+ * routine may choose to leave the hash value unchanged.
+ */
+ name->hash = full_name_hash(name->name, name->len);
+ if (dir->d_op && dir->d_op->d_hash) {
+ int err = dir->d_op->d_hash(dir, name);
+ if (unlikely(err < 0))
+ return ERR_PTR(err);
+ }
+ return d_lookup(dir, name);
+}
+#endif
+
void lnet_remove_debugfs(struct ctl_table *table)
{
for (; table && table->procname; table++) {