Print this page
4185 New hash algorithm support

@@ -20,10 +20,13 @@
  */
 /*
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+/*
+ * Copyright 2013 Saso Kiselkov. All rights reserved.
+ */
 
 /*
  * Fletcher Checksums
  * ------------------
  *

@@ -129,12 +132,14 @@
 #include <sys/sysmacros.h>
 #include <sys/byteorder.h>
 #include <sys/zio.h>
 #include <sys/spa.h>
 
+/*ARGSUSED*/
 void
-fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp)
+fletcher_2_native(const void *buf, uint64_t size, const zio_cksum_salt_t *salt,
+    const void *ctx_template, zio_cksum_t *zcp)
 {
         const uint64_t *ip = buf;
         const uint64_t *ipend = ip + (size / sizeof (uint64_t));
         uint64_t a0, b0, a1, b1;
 

@@ -146,12 +151,14 @@
         }
 
         ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1);
 }
 
+/*ARGSUSED*/
 void
-fletcher_2_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp)
+fletcher_2_byteswap(const void *buf, uint64_t size,
+    const zio_cksum_salt_t *salt, const void *ctx_template, zio_cksum_t *zcp)
 {
         const uint64_t *ip = buf;
         const uint64_t *ipend = ip + (size / sizeof (uint64_t));
         uint64_t a0, b0, a1, b1;
 

@@ -163,12 +170,14 @@
         }
 
         ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1);
 }
 
+/*ARGSUSED*/
 void
-fletcher_4_native(const void *buf, uint64_t size, zio_cksum_t *zcp)
+fletcher_4_native(const void *buf, uint64_t size, const zio_cksum_salt_t *salt,
+    const void *ctx_template, zio_cksum_t *zcp)
 {
         const uint32_t *ip = buf;
         const uint32_t *ipend = ip + (size / sizeof (uint32_t));
         uint64_t a, b, c, d;
 

@@ -180,12 +189,14 @@
         }
 
         ZIO_SET_CHECKSUM(zcp, a, b, c, d);
 }
 
+/*ARGSUSED*/
 void
-fletcher_4_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp)
+fletcher_4_byteswap(const void *buf, uint64_t size,
+    const zio_cksum_salt_t *salt, const void *ctx_template, zio_cksum_t *zcp)
 {
         const uint32_t *ip = buf;
         const uint32_t *ipend = ip + (size / sizeof (uint32_t));
         uint64_t a, b, c, d;