Print this page
4185 New hash algorithm support

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/sys/zio_checksum.h
          +++ new/usr/src/uts/common/fs/zfs/sys/zio_checksum.h
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright Saso Kiselkov 2013, All rights reserved.
  23   24   */
  24   25  
  25   26  #ifndef _SYS_ZIO_CHECKSUM_H
  26   27  #define _SYS_ZIO_CHECKSUM_H
  27   28  
  28   29  #include <sys/zio.h>
  29   30  
  30   31  #ifdef  __cplusplus
  31   32  extern "C" {
  32   33  #endif
  33   34  
  34   35  /*
  35   36   * Signature for checksum functions.
  36   37   */
  37      -typedef void zio_checksum_t(const void *data, uint64_t size, zio_cksum_t *zcp);
       38 +typedef void zio_checksum_t(const void *data, uint64_t size,
       39 +    const zio_cksum_salt_t *salt, const void *ctx_template, zio_cksum_t *zcp);
       40 +typedef void *zio_checksum_tmpl_init_t(const zio_cksum_salt_t *salt);
       41 +typedef void zio_checksum_tmpl_free_t(void *ctx_template);
  38   42  
  39   43  /*
  40   44   * Information about each checksum function.
  41   45   */
  42   46  typedef struct zio_checksum_info {
  43      -        zio_checksum_t  *ci_func[2]; /* checksum function for each byteorder */
  44      -        int             ci_correctable; /* number of correctable bits   */
       47 +        /* checksum function for each byteorder */
       48 +        zio_checksum_t                  *ci_func[2];
       49 +        zio_checksum_tmpl_init_t        *ci_tmpl_init;
       50 +        zio_checksum_tmpl_free_t        *ci_tmpl_free;
       51 +        int             ci_correctable; /* number of correctable bits */
  45   52          int             ci_eck;         /* uses zio embedded checksum? */
  46   53          int             ci_dedup;       /* strong enough for dedup? */
       54 +        int             ci_salted;      /* does the checksum support salts */
  47   55          char            *ci_name;       /* descriptive name */
  48   56  } zio_checksum_info_t;
  49   57  
  50   58  typedef struct zio_bad_cksum {
  51   59          zio_cksum_t             zbc_expected;
  52   60          zio_cksum_t             zbc_actual;
  53   61          const char              *zbc_checksum_name;
  54   62          uint8_t                 zbc_byteswapped;
  55   63          uint8_t                 zbc_injected;
  56   64          uint8_t                 zbc_has_cksum;  /* expected/actual valid */
  57   65  } zio_bad_cksum_t;
  58   66  
  59   67  extern zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS];
  60   68  
  61   69  /*
  62   70   * Checksum routines.
  63   71   */
  64   72  extern zio_checksum_t zio_checksum_SHA256;
       73 +extern zio_checksum_t zio_checksum_SHA512_native;
       74 +extern zio_checksum_t zio_checksum_SHA512_byteswap;
  65   75  
       76 +/* Skein */
       77 +extern zio_checksum_t zio_checksum_skein_native;
       78 +extern zio_checksum_t zio_checksum_skein_byteswap;
       79 +extern zio_checksum_tmpl_init_t zio_checksum_skein_tmpl_init;
       80 +extern zio_checksum_tmpl_free_t zio_checksum_skein_tmpl_free;
       81 +
       82 +/* Edon-R */
       83 +extern zio_checksum_t zio_checksum_edonr_native;
       84 +extern zio_checksum_t zio_checksum_edonr_byteswap;
       85 +extern zio_checksum_tmpl_init_t zio_checksum_edonr_tmpl_init;
       86 +extern zio_checksum_tmpl_free_t zio_checksum_edonr_tmpl_free;
       87 +
  66   88  extern void zio_checksum_compute(zio_t *zio, enum zio_checksum checksum,
  67   89      void *data, uint64_t size);
  68   90  extern int zio_checksum_error(zio_t *zio, zio_bad_cksum_t *out);
  69   91  extern enum zio_checksum spa_dedup_checksum(spa_t *spa);
       92 +extern void zio_checksum_templates_free(spa_t *spa);
  70   93  
  71   94  #ifdef  __cplusplus
  72   95  }
  73   96  #endif
  74   97  
  75   98  #endif  /* _SYS_ZIO_CHECKSUM_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX