summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs-common.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2010-10-29 05:38:13 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-10-29 04:17:08 -0700
commitc65be2d304c67e57447d6d4a2e53fae07e31ff5c (patch)
tree29261d0e1fcd46136889a4a9542789b8a6fd4d03 /xlators/nfs/server/src/nfs-common.c
parent413b2a5f9b77fd3d7f3b26c848482ec7b914102f (diff)
nfs: Introduce nfs.enable-ino32 to support legacy 32-bit only apps
Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1972 (xcs get doesn't work with gNFS) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1972
Diffstat (limited to 'xlators/nfs/server/src/nfs-common.c')
-rw-r--r--xlators/nfs/server/src/nfs-common.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c
index 6628c297f..ef2d1d3fd 100644
--- a/xlators/nfs/server/src/nfs-common.c
+++ b/xlators/nfs/server/src/nfs-common.c
@@ -393,3 +393,35 @@ err:
return ret;
}
+
+
+uint32_t
+nfs_hash_gfid (uuid_t gfid)
+{
+ uint32_t hash = 0;
+ uint64_t msb64 = 0;
+ uint64_t lsb64 = 0;
+ uint32_t a1 = 0;
+ uint32_t a2 = 0;
+ uint32_t a3 = 0;
+ uint32_t a4 = 0;
+ uint32_t b1 = 0;
+ uint32_t b2 = 0;
+
+ memcpy (&msb64, &gfid[8], 8);
+ memcpy (&lsb64, &gfid[0], 8);
+
+ a1 = (msb64 << 32);
+ a2 = (msb64 >> 32);
+ a3 = (lsb64 << 32);
+ a4 = (lsb64 >> 32);
+
+ b1 = a1 ^ a4;
+ b2 = a2 ^ a3;
+
+ hash = b1 ^ b2;
+
+ return hash;
+}
+
+