/*
- * linux/fs/ldiskfs/hash.c
- *
* Copyright (C) 2002 by Theodore Ts'o
*
* This file is released under the GPL v2.
* License.
*/
+/*
+ * obdclass/hash.c is copied from ldiskfs/hash.c.
+ * ldiskfs is used by server only.
+ * obdclass is shared by both client and server, it should not depend on ldiskfs.
+ */
+
#include <linux/fs.h>
-#include <linux/jbd.h>
#include <linux/sched.h>
+#ifdef HAVE_SERVER_SUPPORT
+
+#ifdef HAVE_EXT4_LDISKFS
+#include <ldiskfs/ldiskfs_jbd2.h>
+#include <ldiskfs/ldiskfs.h>
+#else
+#include <linux/jbd.h>
#include <linux/ldiskfs_fs.h>
+#endif
+
+#else
+# include <obd_class.h>
+#endif
#define DELTA 0x9E3779B9
+
static void TEA_transform(__u32 buf[4], __u32 const in[])
{
__u32 sum = 0;
return (hash0 << 1);
}
-static __u32 dx_r5_hash(const signed char *msg, int len)
-{
- __u32 a = 0;
- while (len--) {
- a += *msg << 4;
- a += *msg >> 4;
- a *= 11;
- msg++;
- }
- return a;
-}
-
-static __u32 dx_same_hash(const signed char *msg, int len)
-{
- return 0xcafebabeUL;
-}
-
static void str2hashbuf(const char *msg, int len, __u32 *buf, int num)
{
__u32 pad, val;
hash = buf[0];
minor_hash = buf[1];
break;
- case LDISKFS_DX_HASH_R5:
- hash = dx_r5_hash(name, len);
- break;
- case LDISKFS_DX_HASH_SAME:
- hash = dx_same_hash(name, len);
- break;
default:
hinfo->hash = 0;
return -1;