|
@@ -5,6 +5,7 @@
|
|
|
#include "nfs4_fs.h"
|
|
|
#include <linux/mount.h>
|
|
|
#include <linux/security.h>
|
|
|
+#include <linux/crc32.h>
|
|
|
|
|
|
#define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS)
|
|
|
|
|
@@ -574,3 +575,22 @@ u64 nfs_timespec_to_change_attr(const struct timespec *ts)
|
|
|
{
|
|
|
return ((u64)ts->tv_sec << 30) + ts->tv_nsec;
|
|
|
}
|
|
|
+
|
|
|
+#ifdef CONFIG_CRC32
|
|
|
+/**
|
|
|
+ * nfs_fhandle_hash - calculate the crc32 hash for the filehandle
|
|
|
+ * @fh - pointer to filehandle
|
|
|
+ *
|
|
|
+ * returns a crc32 hash for the filehandle that is compatible with
|
|
|
+ * the one displayed by "wireshark".
|
|
|
+ */
|
|
|
+static inline u32 nfs_fhandle_hash(const struct nfs_fh *fh)
|
|
|
+{
|
|
|
+ return ~crc32_le(0xFFFFFFFF, &fh->data[0], fh->size);
|
|
|
+}
|
|
|
+#else
|
|
|
+static inline u32 nfs_fhandle_hash(const struct nfs_fh *fh)
|
|
|
+{
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+#endif
|