[PATCH] NFS: add crc hash to nfs_display_fhandle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Match wireshark's CRC-32 hash for easier debugging.

Signed-off-by: Weston Andros Adamson <dros@xxxxxxxxxx>
---
Requested by Chuck and others.

Nothing in trond/nfs-for-next uses nfs_display_fhandle() yet.
I tested by calling it in nfs4xdr.c:encode_putfh().

 fs/nfs/inode.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 99a4f52..c1f44e9 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -39,6 +39,7 @@
 #include <linux/slab.h>
 #include <linux/compat.h>
 #include <linux/freezer.h>
+#include <linux/crc32.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -1057,13 +1058,18 @@ struct nfs_fh *nfs_alloc_fhandle(void)
 void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption)
 {
 	unsigned short i;
+	u32 crc;
 
 	if (fh->size == 0 || fh == NULL) {
 		printk(KERN_DEFAULT "%s at %p is empty\n", caption, fh);
 		return;
 	}
 
-	printk(KERN_DEFAULT "%s at %p is %u bytes:\n", caption, fh, fh->size);
+	/* match wireshark's CRC-32 hash */
+	crc = ~crc32(0xFFFFFFFF, &fh->data[0], fh->size);
+
+	printk(KERN_DEFAULT "%s at %p is %u bytes, crc: 0x%08x:\n",
+	                    caption, fh, fh->size, crc);
 	for (i = 0; i < fh->size; i += 16) {
 		__be32 *pos = (__be32 *)&fh->data[i];
 
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux