Print this page
Integrated Edon-R hash function.


  60  */
  61 
  62 /*ARGSUSED*/
  63 static void
  64 zio_checksum_off(const void *buf, uint64_t size, zio_cksum_t *zcp)
  65 {
  66         ZIO_SET_CHECKSUM(zcp, 0, 0, 0, 0);
  67 }
  68 
  69 zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
  70         {{NULL,                 NULL},                  0, 0, 0, "inherit"},
  71         {{NULL,                 NULL},                  0, 0, 0, "on"},
  72         {{zio_checksum_off,     zio_checksum_off},      0, 0, 0, "off"},
  73         {{zio_checksum_SHA256,  zio_checksum_SHA256},   1, 1, 0, "label"},
  74         {{zio_checksum_SHA256,  zio_checksum_SHA256},   1, 1, 0, "gang_header"},
  75         {{fletcher_2_native,    fletcher_2_byteswap},   0, 1, 0, "zilog"},
  76         {{fletcher_2_native,    fletcher_2_byteswap},   0, 0, 0, "fletcher2"},
  77         {{fletcher_4_native,    fletcher_4_byteswap},   1, 0, 0, "fletcher4"},
  78         {{zio_checksum_SHA256,  zio_checksum_SHA256},   1, 0, 1, "sha256"},
  79         {{fletcher_4_native,    fletcher_4_byteswap},   0, 1, 0, "zilog2"},


  80 };
  81 
  82 enum zio_checksum
  83 zio_checksum_select(enum zio_checksum child, enum zio_checksum parent)
  84 {
  85         ASSERT(child < ZIO_CHECKSUM_FUNCTIONS);
  86         ASSERT(parent < ZIO_CHECKSUM_FUNCTIONS);
  87         ASSERT(parent != ZIO_CHECKSUM_INHERIT && parent != ZIO_CHECKSUM_ON);
  88 
  89         if (child == ZIO_CHECKSUM_INHERIT)
  90                 return (parent);
  91 
  92         if (child == ZIO_CHECKSUM_ON)
  93                 return (ZIO_CHECKSUM_ON_VALUE);
  94 
  95         return (child);
  96 }
  97 
  98 enum zio_checksum
  99 zio_checksum_dedup_select(spa_t *spa, enum zio_checksum child,




  60  */
  61 
  62 /*ARGSUSED*/
  63 static void
  64 zio_checksum_off(const void *buf, uint64_t size, zio_cksum_t *zcp)
  65 {
  66         ZIO_SET_CHECKSUM(zcp, 0, 0, 0, 0);
  67 }
  68 
  69 zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
  70         {{NULL,                 NULL},                  0, 0, 0, "inherit"},
  71         {{NULL,                 NULL},                  0, 0, 0, "on"},
  72         {{zio_checksum_off,     zio_checksum_off},      0, 0, 0, "off"},
  73         {{zio_checksum_SHA256,  zio_checksum_SHA256},   1, 1, 0, "label"},
  74         {{zio_checksum_SHA256,  zio_checksum_SHA256},   1, 1, 0, "gang_header"},
  75         {{fletcher_2_native,    fletcher_2_byteswap},   0, 1, 0, "zilog"},
  76         {{fletcher_2_native,    fletcher_2_byteswap},   0, 0, 0, "fletcher2"},
  77         {{fletcher_4_native,    fletcher_4_byteswap},   1, 0, 0, "fletcher4"},
  78         {{zio_checksum_SHA256,  zio_checksum_SHA256},   1, 0, 1, "sha256"},
  79         {{fletcher_4_native,    fletcher_4_byteswap},   0, 1, 0, "zilog2"},
  80         {{zio_checksum_EdonR512_256,    zio_checksum_EdonR512_256_byteswap},
  81             1, 0, 1, "edonr512/256"},
  82 };
  83 
  84 enum zio_checksum
  85 zio_checksum_select(enum zio_checksum child, enum zio_checksum parent)
  86 {
  87         ASSERT(child < ZIO_CHECKSUM_FUNCTIONS);
  88         ASSERT(parent < ZIO_CHECKSUM_FUNCTIONS);
  89         ASSERT(parent != ZIO_CHECKSUM_INHERIT && parent != ZIO_CHECKSUM_ON);
  90 
  91         if (child == ZIO_CHECKSUM_INHERIT)
  92                 return (parent);
  93 
  94         if (child == ZIO_CHECKSUM_ON)
  95                 return (ZIO_CHECKSUM_ON_VALUE);
  96 
  97         return (child);
  98 }
  99 
 100 enum zio_checksum
 101 zio_checksum_dedup_select(spa_t *spa, enum zio_checksum child,