Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/iscsi Make digests work also on big endian machines.



details:   https://anonhg.NetBSD.org/src/rev/f5ce5c14aa8a
branches:  trunk
changeset: 779895:f5ce5c14aa8a
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Jun 25 20:34:26 2012 +0000

description:
Make digests work also on big endian machines.

diffstat:

 sys/dev/iscsi/iscsi_utils.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 2cb039eb501c -r f5ce5c14aa8a sys/dev/iscsi/iscsi_utils.c
--- a/sys/dev/iscsi/iscsi_utils.c       Mon Jun 25 20:33:56 2012 +0000
+++ b/sys/dev/iscsi/iscsi_utils.c       Mon Jun 25 20:34:26 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iscsi_utils.c,v 1.3 2012/06/24 17:01:35 mlelstv Exp $  */
+/*     $NetBSD: iscsi_utils.c,v 1.4 2012/06/25 20:34:26 mlelstv Exp $  */
 
 /*-
  * Copyright (c) 2004,2005,2006,2008 The NetBSD Foundation, Inc.
@@ -33,6 +33,7 @@
 #include <sys/systm.h>
 #include <sys/buf.h>
 #include <sys/socketvar.h>
+#include <sys/bswap.h>
 
 
 #ifdef ISCSI_DEBUG
@@ -166,7 +167,7 @@
        while (len--) {
                crc = ((crc >> 8) & 0x00ffffff) ^ crc_table[(crc ^ *bp++) & 0xff];
        }
-       return crc ^ 0xffffffff;
+       return htonl(bswap32(crc ^ 0xffffffff));
 }
 
 
@@ -195,7 +196,7 @@
        while (len2--) {
                crc = ((crc >> 8) & 0x00ffffff) ^ crc_table[(crc ^ *bp++) & 0xff];
        }
-       return crc ^ 0xffffffff;
+       return htonl(bswap32(crc ^ 0xffffffff));
 }
 
 /*****************************************************************************



Home | Main Index | Thread Index | Old Index